aspose file tools*
The moose likes JSP and the fly likes Jsp - servlet design Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Jsp - servlet design " Watch "Jsp - servlet design " New topic
Author

Jsp - servlet design

Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
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 ]

Thanks & regards, Srini
MCP, SCJP-1.4, NCFM (Financial Markets), Oracle 9i - SQL ( 1Z0-007 ), ITIL Certified
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61761
    
  67

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 ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Srinivasa Raghavan
Ranch Hand

Joined: Sep 28, 2004
Posts: 1228
Yes i ment "Submitting".
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
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

Joined: Sep 28, 2004
Posts: 1228
Yes got it adeel.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Jsp - servlet design