Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing Date objcet as parameter

Posted on 2003-11-16
4
Medium Priority
?
222 Views
Last Modified: 2010-04-01
Hello,

How to pass a date object as a parameter between two jsp pages

Thanks in advance

Regards

-Dipali
0
Comment
Question by:dipjsp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 15

Accepted Solution

by:
dualsoul earned 252 total points
ID: 9762018
you can use:

    request.setAttribute("Attribute name" , yourObject); //sets the object for request

, you can retrive it the same way:

     Object yourObject=request.getAttribute("Attribut name");

, or you can store your object in session, if you want, the methods are absolutely the same as i've shown above.
 
0
 
LVL 14

Assisted Solution

by:kennethxu
kennethxu earned 248 total points
ID: 9764958
if you need to pass them as url parameter, you can make user of SimpleDataFormat object:

java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat( "yyyyMMdd" );

then construct the url as
page.jsp?mydate=<%=sdf.format( myDate ) %>

you can then retrieve it as parameter in page.jsp as:

String strMyDate = request.getParameter( "mydate" );
// you need to check for null.
java.util.Date date = sdf.parse( strMyDate );
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Files go missing when using DFS (Distributed File System) Replication and how to recover them and fix it.
By default Outlook 2016 displays only one time zone in the Calendar. The following article explains how to display two time zones in one calendar view.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question