Solved

Passing Date objcet as parameter

Posted on 2003-11-16
4
215 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
4 Comments
 
LVL 15

Accepted Solution

by:
dualsoul earned 63 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 62 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

With more and more people tethered to the internet, advertisers can reach you in new and creative ways. Push notifications on your smartphone, customized advertisements based on your previous searches, and email inboxes filled with promotional pitch…
Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…

930 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now