Improve company productivity with a Business Account.Sign Up

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 357
  • Last Modified:

Regarding JSP controller

Hi Friends,

what are the draw backs if i use JSP as a controller for handling the requests and responses(i.e Model 1) and using java code,scriptlets,declarations and expressions in jsp?
3 Solutions
Architecturally, some people like the request controller model.  In my experience, it means that users can't bookmark your pages.  It's also harder to send urls in emails for the controller situation (more parameters to help pass the user to the right place).  So for normal web apps, I prefer separate urls over the single controller model.

From a performance standpoint, there's no difference between the JSP model and the controller to bean model.  Tomcat and most other servlet engines have seriously optmized the server compilation from JSP to servlet, so you get servlet performance in both cases.

The general model of JSP for display and beans and other classes for the app is still a good one however.  It might improve performance but it will definitely improve your ability to enhance and maintain your web app.

>what are the draw backs   

>using java code,scriptlets,declarations and expressions in jsp?  
These can easily kept to a minimum through the use of "Tag files"  and custom EL functions. 
see bottom of the page at
Sathish David Kumar NArchitectCommented:
The main draw back is people can see your source code . right click on browser and see the view sources then they can find the values and all logic of controller program of your page .
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

PrakashVarmaAuthor Commented:
Hi Friends,
thanks for giving reply..,

rrz@871311,i saw your links but in first link i not understanding one point please clarify that(Bold one) i.e
It becomes very hard to change the structure of such Web applications because the pages are tightly coupled. They have to be aware of each other. What if you decide that, after updating the quantities in a shopping cart, you want to redirect the user back to the catalog? This could require moving code from the shopping cart page to the catalog page.
dravidnsr: I think you must be thinking of Javascript.  JSP code does not get sent to the browser and the user cannot see it.

PrakashVarma: JSP pages do not have to be badly written any more than any other code.  The quote you have about development problems are based on bad writing, not using JSP.  The writer of that page does not make it sufficiently clear what the difference is.
I agree with mrcoffee. It comes down to writing style. As he suggested in his first post, the use of javabeans is recommended.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now