aspose file tools
The moose likes JSP and the fly likes Seperate JSP versus common utility java class Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply Bookmark "Seperate JSP versus common utility java class" Watch "Seperate JSP versus common utility java class" New topic
Author

Seperate JSP versus common utility java class

Lakshmi Ramachandran
Greenhorn

Joined: Jun 26, 2001
Posts: 26
Hello friends,
I am working on Servlet/JSP project. There are large no. of jsp pages. A common set of methods get repeated in all the jsp pages. Now my concen is to separate out the methods in a file and then use it in jsp page.
I have taken out the methods and created a separate jsp page and have included it in all the required JSPs. The other approach which comes to my mind is to create a simple java class with the common utility and importing it in JSPs.
Kindly suggest me the right path to follow, taking into consideration that we take up the optimized solution.
Please reply ASAP since it is quite URGENT !
Thanks in advance.
Regards.
parag Chatterjee
Greenhorn

Joined: Aug 02, 2002
Posts: 28
You second approach of Java class is a more standard approach.you create taglib for the class and use as common tags in all jsp pages.
Lakshmi Ramachandran
Greenhorn

Joined: Jun 26, 2001
Posts: 26
Thanks for your reply.

Well, kindly comment on the performance on these approaches.
1. Using 'include jsp'
2. using 'taglib'
3. creating a seperate utility class with the required methods and 'import' it in the JSP pages.
Thanks again!
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 11862
Taglib and auxilliary class are functionally equivalent and should be faster than include due to include having to invoke another JSP. However I doubt your users could tell the difference, so you should go for a design that is easily maintained.
Bill
Lakshmi Ramachandran
Greenhorn

Joined: Jun 26, 2001
Posts: 26
Thanks for ur suggestions.
I have created tags and using it im my project.
Thanks again.
Simon Brown
sharp shooter, and author
Ranch Hand

Joined: May 10, 2000
Posts: 1860
Oh, and if you subscribe to the practices around writing your unit tests in code (e.g JUnit) then check out TagUnit for unit testing custom tags.
Simon
 
 
subject: Seperate JSP versus common utility java class
 
Threads others viewed
A simple JSP tag question
Portal Application
Passed SCEA II&III (Old)
Urgent : Having a doubt , please confirm
Where to define the common functionality methods for Struts Controller
developer file tools

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture