Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reusing JSPs across applications

 
John Eric Hamacher
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all:

I have been thinking about how I can reuse the same JSPs in different applications . . . if there could be some sort of abstraction or project that my applications could inherit from. Any thoughts on this are welcome.

Thanks
Eric
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To what end?
Are you trying to save on disk space?
Disk space is pretty cheap and usually not worth the expense you'll put into managing this.

If it's just for code re-use, most people, these days manage this with build tools like ANT or MAVEN.
With tools like these, you can pull resources from where ever you like at build time.
 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John Eric Hamacher wrote:Hello all:

I have been thinking about how I can reuse the same JSPs in different applications . . . if there could be some sort of abstraction or project that my applications could inherit from. Any thoughts on this are welcome.

Thanks
Eric

To be sure: are you writing raw Java code in JSP files instead of in Java classes? That would explain this odd question a bit more. If this is indeed the case, then the solution is simple: you should be writing Java code in Java classes, you should never be using scriptlets. This isnĀ“t 1998 anymore.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64708
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I usually avoid and dislike "me too" posts, but this one is important enough for me to add my voice to the already wise advice given here:
  • Write scriptless JSPs
  • Perform any resource sharing at the build and source control level, not at run-time

  •  
    John Eric Hamacher
    Ranch Hand
    Posts: 230
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Thanks for the responses.

    I have scriptless JSP fragments I want to maintain centrally and use in multiple applications. I didn't literally mean the JSP would be inheriting other JSPs, more like the application projects would be inheriting other projects which have the JSPs to be reused.
     
    Bear Bibeault
    Author and ninkuma
    Marshal
    Pie
    Posts: 64708
    86
    IntelliJ IDE Java jQuery Mac Mac OS X
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    See Ben's post and my second point.
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic