• Post Reply Bookmark Topic Watch Topic
  • New Topic

JSP Basic or MVC question  RSS feed

 
Murugan Patham
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks man, your directions would really help me to do my study on appropriate topic.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!