Solved

Passing Date objcet as parameter

Posted on 2003-11-16
4
212 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

In this article, I show you step by step with screenshots to assist you - HOW TO: Deploy and Install the VMware vCenter Server Appliance 6.5 (VCSA 6.5), with some helpful tips along the way.
Use of TCL script on Cisco devices:  - create file and merge it with running configuration to apply configuration changes
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

21 Experts available now in Live!

Get 1:1 Help Now