Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Passing Date objcet as parameter

Posted on 2003-11-16
4
Medium Priority
?
223 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
2 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Transferring FSMO roles is done when an admin wants to split roles between certain Domain Controllers or the Domain Controller holding the Roles has been forcefully demoted using dcpromo / forceremoval
Hello there! As a developer I have modified and refactored the unit tests which was written by fellow developers in the past. On the course, I have gone through various misconceptions and technical challenges when it comes to implementation. I would…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

824 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