aspose file tools*
The moose likes Servlets and the fly likes Relocating JSPs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Relocating JSPs" Watch "Relocating JSPs" New topic
Author

Relocating JSPs

Alec Lee
Ranch Hand

Joined: Jan 28, 2004
Posts: 569
I put my JSPs under appliContext. Now I want to reorganize a little bit and create a few subdirectories for the JSPs. But it seems that I must change all my controller servlets to change the path referenced. Is there a quicker way to relocate the JSPs.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

Lesson learned. Hard-coding paths in your controllers is a poor idea for this very reason. You should abstract the paths out.

I generally accomplish this by defining a name for each page and use a properties file to associate paths to the names. That way, if a path changes, all I need to do is to change the properties file.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
vishwanath nadimpally
Ranch Hand

Joined: Jan 25, 2005
Posts: 116

I generally accomplish this by defining a name for each page and use a properties file to associate paths to the names. That way, if a path changes, all I need to do is to change the properties file


I do the same, with my jsp's defined as public static final String inside an interface and have my controllers implement the interface.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60082
    
  65

Originally posted by vishwanath nadimpally:

with my jsp's defined as public static final String inside an interface.


While that does provide a level of abstraction that defines the paths in only one place, it forces a recompile upon changes. One distinct advatnage of the properties file approach is that the properties can be updated on the fly without the need for a recompile or redeploy.
vishwanath nadimpally
Ranch Hand

Joined: Jan 25, 2005
Posts: 116
Originally posted by Bear Bibeault:


good point!
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

I have them set up as servlet init params.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Relocating JSPs
 
Similar Threads
location of jsp compiled classes
WebLogic out of memory?
Eclipse + Weblogic Hot Deployment
Changes in JSP after jsp precompilation
COMPARISON OF RESIN VS. APACHE TOMCAT