• Post Reply Bookmark Topic Watch Topic
  • New Topic

Accessing a JSP inside a war file

 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,


I want to access a JSP that is inside a war file(musicStore.war).I want to call this JSP from another JSP that is outside the war.Please help me with the code.

TIA
 
Rob Spoor
Sheriff
Posts: 20821
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A WAR file is little more than a glorified JAR file which in turn is little more than a glorified ZIP file. You can use the classes in packages java.util.zip and java.util.jar for reading ZIP, JAR and WAR files.

I'm not completely sure that this is something you want to do. What is your plan, including the file? Literally executing it? Then unzipping it is not going to work. You can use JSP tags or RequestDispatcher to include other JSP files / servlets but to include pages from another web context may need quite a bit of web container configuration; Tomcat for one does not allow it out-of-the-box.
 
Ankit Chandrawat
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just want to call the JSP inside the war file from my JSP(external to the war file).Is this feasible anyhow?

TIA.
 
Rob Spoor
Sheriff
Posts: 20821
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to our JSP forum.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65530
108
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I understand. If it's in the same war file as the app, just reference it as usual. If it's in the war file for another app, then no. If that's the case, you should be solving this at build time, not run time.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!