aspose file tools*
The moose likes JSP and the fly likes JSP calls Servlet calls JSP 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 calls Servlet calls JSP" Watch "JSP calls Servlet calls JSP" New topic
Author

JSP calls Servlet calls JSP

Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

I had a thought in one of my other posts and wanted to start it's own thread. With the limited JSP/Servlet coding I have done, it seems that there are times when we request a JSP page and time when we request a Servlet. And then JSP pages calls Servlets and Servlets forward to JSP pages.
Well, what if you ALWAYS called a JSP page. So let's say you had
Page1.JSP
Page1.class
The first thing that Page1.JSP page does is call Page1.class. Page1.class does all the initial work that the JSP page might need to do. Like get info from a database, get values for form data, etc. Then it forwards back to the Page1.jsp.
Those familiar with ASP.NET will recognize this a bit. I am just wondering if there would be too much overhead with the extra calls to possibly empty servlets. Or if it would be moot.
Any comments?


GenRocket - Experts at Building Test Data
Mark Stein
Ranch Hand

Joined: May 20, 2002
Posts: 75
I'm pretty sure it's a moot point... remember, a compiled jsp page IS a servlet. For small things going from JSP to JSP works fine for me; but on more complex issues, I just find working with a servlet cleaner and neater.
Mark Stein
Vijay S. Rathore
Ranch Hand

Joined: Oct 29, 2001
Posts: 449
Hi Gregg,
The choice of a MVC/or any other design pattern is a matter of total choice. These design patterns are used to provide a template of solution for a specific problem. No one forces you to use any pattern.
Based on the type of project you are working on the design choice is totally yours provided you consider all possible future aspects of the under consideration project.
Means if you are simply writing code for some test or practice it's easy to call another JSP from one JSP, but should not do that for bigger projects.


SCJP, SCJD, SCWCD1.4, IBM486, IBM484, IBM 483, IBM 287, IBM141, IBM Certified Enterprise Developer - WebSphere Studio, V5.0
Author of IBM 287 Simulator Exam
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15300
    
    6

Do some people still use a JSP page with PURE scriplet code as a Controller or do most people use a Servlet for a controller. I saw an example for the JSP Controller method and thought it was strange.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSP calls Servlet calls JSP