File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSP and the fly likes Controlling the display of JSP pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Controlling the display of JSP pages" Watch "Controlling the display of JSP pages" New topic

Controlling the display of JSP pages

Donald Nunn
Ranch Hand

Joined: Nov 11, 2000
Posts: 200
I have a situation where I need to first display a jsp that allows the user to select records. That works great. However, once the desired row is selected, I need to display the results in the second half of the page. The selection process is a jsp and the result process is a jsp as well. I've tried using a frame, but, I'm having a problem controlling the jsp that produces the results. What's actually happening is both jsp's are displaying at the same time and the jsp that populates the bottom half of the page is producing an error because it's expecting a set of parameters. Any suggestions would be greatly appreciated.

<b>Donald Nunn</b><br />Sun Certified Programmer for the Java 2 Platform
Jessica Sant

Joined: Oct 17, 2001
Posts: 4313

so... what if you wrap the entire bottom half of the page in an if statement that checks for the presence of the parameter?

- Jess
Blog:KnitClimbJava | Twitter: jsant | Ravelry: wingedsheep
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

He'll end up having to resend the entire page. Frames are better for this - that way only the part of the page that's changed needs to be redone.
Basic idea is that initially you send a frameset that references 2 jsp's - one in each frame. The bottom jsp initially will have a blank output (there are several ways to do this, including just using an empty HTML page). Now in the top frame, the master JSP does hyperlinks with target= options directing the output to the lower frame.
If the top part is a form, frames may not be better, since a form requires its own frame to be refreshed - though you should be able to fake it with enough JavaScript.

An IDE is no substitute for an Intelligent Developer.
Donald Nunn
Ranch Hand

Joined: Nov 11, 2000
Posts: 200
Hello, Jessica. Thanks, for your suggestion, however, I've tried that and it doesn't work. I understand why, however, I haven't developed a solution yet. Again, thanks for your suggestion.
Donald Nunn
Ranch Hand

Joined: Nov 11, 2000
Posts: 200
Hello, Tim. If it's not to much trouble could you illustrate this in an example. I would really appreciate it.
Donald Nunn
Ranch Hand

Joined: Nov 11, 2000
Posts: 200
Hello, Tim. This is the way I have it set up and the problem is when I execute the jsp from the top frame that's labeled "LIST_SELECT_JSP" the rsulting JSP won't display the results in the target labeled "RESULT_JSP". I did take your advise and I created a blank HTML which eliminated the error, however, as I mentioned the target isn't working. It's displaying the results in the top frame labeled "LIST_SELECT_JSP". Any advise would be greatly appreciated. Thanks

<TITLE>Report Selection Interface</TITLE>
<H2 ALIGN="center">Oops!, This browser doesn't Support Frames, Eh?</H2>
<P>So you don't like frames. We'll too bad for you!
<DIV ALIGN="right">
<EM>Call Technical Support</EM>
I agree. Here's the link:
subject: Controlling the display of JSP pages
It's not a secret anymore!