• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

please help with jsp design

Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I did this with a servlet and now I'm trying to figure out how to do this with a jsp.

I have a screen that displays data
If there is no data you get a message saying no data

So I think that would be 2 jsps.

If you hit the edit or save button you get a new screen that allows you to input data. If you hit save or cancel you go back to the 'display data' screen. I also need the ability to do next and previous on the display data screen.

I have this done in servlets, I am having trouble figuring out how to design this for servlets. I am figure the following.

1. jsp for display data screen
2. jsp for the display data screen with no data
3. jsp for the add/cancel screen

Ok that is the html part. How do I manage the logic? can I do an 'action=''> and pass this to a javabean? then have the java bean act as a dispatcher with all my logic in it? I can't figure out how I write a class to manage all my logic for the jsps. How do I call the dispatcher class? how do i have the dispatcher class then call a jsp page?
author & internet detective
Posts: 40793
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are on the right track with trying to keep the logic out of the JSP. It is standard to call a servlet which does the logic part (or delegates that responsibility to beans) and stores the result in the HttpRequest. The JSP gets the data from the request and displays it with the HTML.
Ranch Hand
Posts: 582
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Bobbie,
I think JSP should not contain the business logic.
It is pure for presentation.

My understanding to solve your case like this:
* We will have 2 screen to handle that. There are 'Search' screen and 'Add' screen. The landing page for this application is 'Search' screen, so when user clicks the link either from menu or from another screen, the 'Search' screen will be showed.
* 'Search' screen has two parts. First is Search criteria where user can input the constraint when system do searching process. Second is list of result from searching. If there is no result, this part will show no data.
* 'Search' screen has a link to 'Add' screen so that user can add new data.
* 'Add' screen has 'Save' button to save that new data. In this screen has 'Back' link so that user can back to 'Search' screen.
* We have a servlet to handle all requests from those screen and dispatch to a proper screen.
* Every request will be forwarded to a class which contains bussiness logic. In this class, those requests will be processed whether saving process or searching process.

Correct me if I am wrong
Hope this helps

You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic