• 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 ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JSP Basic or MVC question

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Folks I tried to Google before posting this topic. Bear with me if it is a basic questio. Please point me to the right place for more info.

My objective is show a JSP with some Control Numbers, when they click on a control number, I want to call a servlet with this control number, the Servlet will talk to the DB thru Tuxedo Service and get back results, then give back the results to the JSP, then JSP should update the info in other portion of the page and store the object in an array.

Can I show the details in the same JSP or the Servlet should call a different JSP.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Either way. The page can check if the result data is presnet (JSTL <c:if> tag useful here) and display the result data if there, or skip it if not. That way, the page can be shown with or without the result data.

Or, if it makes more sense to show the results on a new page, that's ok too.

One thing. You wote:

then JSP should update the info in other portion of the page and store the object in an array.



What array? Bear in mind that as soon as the JSP executes and sends its results to the browser, the page goes out of scope and any local storage is reclaimed.
 
Murugan Patham
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply. I'm kind off exploring into this JSP arena. Let me read more about this.

Also after posting here, I got a chance to click one of the links by Ben Souther and he had an example of SimpleMVC, thanks to him.
 
Murugan Patham
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Then how can I store the info that I rerieved from the servlet. The reason I want to hold is, if the user wants to go back to the previous info that they looked into, I don't want to go back to the DB to get that info.

Let me also try to red some more on JSP, meanwhile somebody could point me to right direction.
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ben's examples are a great resource. I'm glad that you are availing yourself of them.

With regards to storing the DB data to minimize future DB access, that's a classic caching pattern. You may want to research that concept (been discussed a few times here as well).

If the data is user-specific, you probably want to cache it in the session. If the data is common to all users, application scope is a better place for it.

And the JSP is not the place to manage this cache. That's part of the servlet's job -- the JSP should be concerned only with arranging the data for viewing; keep any data processing in the servlet.
 
Murugan Patham
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks man, your directions would really help me to do my study on appropriate topic.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic