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

JSP Help

Rupali Desai
Ranch Hand

Joined: May 29, 2001
Posts: 42
I am new to jsp.So please guide me on this design problem.I have a form which has 5 parts to it.At each part accepts a set of inputs.At the end of each part the user clicks on a button to get data for the next part.
To understand the application I had intially designed the GUI using swing.Updating the data in next part based on the data entered in the first part was easy swing.
But i am having difficulties doing it using JSP and servlets.Is there any way ,when the user clicks a button on a jsp page.I can just add dynamically add new html to that page without having to write the whole page.OR JSP is not the right choice.
Asher Tarnopolski
Ranch Hand

Joined: Jul 28, 2001
Posts: 260
you can make 5 different jsp pages/servlets. every one will get the info from the form, do something with it and according to
the results it will design the next jsp page.
if you need to store the results from each request you can do it with session object for example.
if you want to use an applet with listeners which will lead to the different results according the info which is should choose a scenario.

Asher Tarnopolski
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63865

This really doesn't have as much to do with JSP as with the whole response/request cycle and DHTML.
Within a browser you are much more limited in what you can do, and when you can do it, than in a Swing application (modeling a web-app in Swing probably isn't the best way to set expectations).
With regards to dynamic loading on the client side, there are a number of ways to do this without having to go back to the server as long as you limit yourself to "modern" browsers (read: no Netscape 4) that support W3C standards.
Two that come off the top of my head:
1) Create the various portions of your form in hidden blocks (div's with the style 'display:none') that you can show and hide at will by changing the display style ('display:block' to make it visible).
2) Use DOM manipulation to dynamically create new HTML elements. This is trickier, but with it you can do almost anything you want on the client side. Alteratively, the 'innerHTML' mechanism can be used, but isn't quite as flexible.

[Asking smart questions] [About Bear] [Books by Bear]
I agree. Here's the link:
subject: JSP Help
It's not a secret anymore!