Web tier: servlets, JSP, Web frameworks: Send request into src of a frame in a JSP.
I have the following question:
- Posted by: Di He
- Posted on: July 25 2001 16:47 EDT
There is a frame in a JSP, call it A.jsp. The src of the frame is another JSP, call it B.jsp. My servlet access the A.jsp and send request to it. But when I use the request inside B.jsp, it is a null. How can I pass the request to B.jsp?
Unfortunately, you can't. Once the HTML for A.jsp is written, it is set to the client. When the client (the browser) parses the HTML and sees that it contains a frame, it makes a subsequent request to the server. It is this request that is for B.jsp. Since it is a completely different request. There are a couple of solutions:
1. Place what ever stateful data you need in the session instead of the request.
2. Don't use frames. Instead, consider tables and JSP includes. For more on this, see the FAQ Why do Frames suck? on jGuru.
By using "include" in a JSP, how can I put the included JSP anywhere inside its caller?