• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Relocating JSPs

 
Alec Lee
Ranch Hand
Posts: 569
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
vishwanath nadimpally
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Pie
Posts: 65216
95
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:


good point!
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have them set up as servlet init params.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic