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
Solved

HTTPRequest.setAttribute() question

Posted on 2000-03-02
9
301 Views
Last Modified: 2013-11-24
My JSP generates a page which contains a frameset.  The frameset has two sources which are both jsp.  My question is how do I pass objects from the jsp, that generates frameset, to the two jsp sources using the setAttribute method of the HTTPRequest.


By the way, I'm employing the model view controller design pattern.

Thanx in advance.

Jerson
0
Comment
Question by:jerch
9 Comments
 

Expert Comment

by:cutewang
ID: 2575672
I am not sure if you implement the interface java.io.serializable for your class(or object).
0
 
LVL 5

Expert Comment

by:fontaine
ID: 2575988
You should actually work with a Session. In the JSP generating the frameset, you will have:

// create a session
HttpSession session = request.getSession(true);

// store the object in the session
// here, a date, stored under the "date"
// key
session.putValue("date", new Date());

To collect the Date object from the other JSPs, you write:

// get the session
HttpSession session = request.getSession();

// get the date
Date date = (Date)session.getValue("date");

Tell me if this is an answer.
0
 
LVL 7

Expert Comment

by:vladi21
ID: 2576011
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 4

Author Comment

by:jerch
ID: 2576118
I have considered using session but the data I'm want to pass is only within the scope of a request. For example, the data I'm passing is a list of results from a query.  What if the user has multiple windows.  If I use session, the data will be mixed up, which means the other window will the result of the other query instead of its own. Actually, the session solution is what we used in our previous project but we found out that there's this limitation for multiple windows.  
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 2579076
browser send sends one HTTP request for main page and one HTTP request for each Frame (which is just anothe HTML document). so you can't use setAttribute (different requests) - the only possible solution is to use session. (or you can redesign your UI with tables - Frames sucks :)
0
 
LVL 4

Author Comment

by:jerch
ID: 2579410
heyhey...
do you know any design alternative without changing the ui?  I'm planning to use a unique id to identify which object to get in the session.

<frame name="wmailmenu" src="http://site.com/jsp/myjsp.jsp?id=<generated for a specific piece of data>>

Do you think this is a good solution?  By the way, what should be the method type of the jsp (post or get?)

thanx in advance....

0
 
LVL 16

Accepted Solution

by:
heyhey_ earned 100 total points
ID: 2579846
this is the only alternative (in fact it works almost the same was as web sessions with 'URL rewriting') - and yes - it's good solution.
the request type is GET.

0
 
LVL 4

Author Comment

by:jerch
ID: 2580083
thanx heyhey
0
 
LVL 16

Expert Comment

by:heyhey_
ID: 2580508
Thank you :)
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Suggested Solutions

Title # Comments Views Activity
expectj telnet failing 5 45
tomcat administrtor 12 61
Java basic valueOf question 1 29
Need Help! Getting a syntax error and don't understand why 3 31
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

860 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