Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jsp - servlet design

 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is regarding Kerry Wilson's y'days post ..

Does Calling a servlet from a jsp is a wrong design ?

Think abt this scenerio :
1. Developer needs to collect some input from the end user.
2. Some values will be calculated Depending upon the users input.
3. And a Ejb is called depending upon the calculated values, for updating the database.
4. A summary page is displayed.

1. For this i use a jsp to collect the input.
2. A servlet is invoked to process the users input from the jsp and also it decides the EJB to be invoked.
3. jsp is called to display the summary

Am i following a wrong way ?

Thanks Srini
[ October 04, 2004: Message edited by: srini vasan ]
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does Calling a servlet from a jsp is a wrong design ?


"Calling" is a poor verb to use in this context since it is ambiguous.

It sounds like you are talking about submitting to a servlet from a JSP. If that is the case, then that is the preferred design for web apps. Servlet controllers are submitted to in order to perform any processing necessary for the request, and to prepare data for presentation on a JSP page, which is forwarded to from the servlet to render the view.
[ October 04, 2004: Message edited by: Bear Bibeault ]
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes i ment "Submitting".
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by srini vasan:
This is regarding Kerry Wilson's y'days post ..

Does Calling a servlet from a jsp is a wrong design ?


Srini,

Kerry doesn't really mean this. It is about not setting the attribute in your request in your jsp page. like,

request.setAttribute("any","any");

Because when you submit it to servlet that previous request, in which you have set the attribute, becomes invalid. and you will get null while trying request.getAttribute("any") inside your servlet or elsewhere in some regular java class.

got it???
 
Srinivasa Raghavan
Ranch Hand
Posts: 1228
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes got it adeel.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic