Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP Help

 
Rupali Desai
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
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.
Thanks
Rupali
 
Asher Tarnopolski
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey,
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 added.you should choose a scenario.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64716
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
hth,
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic