• Post Reply Bookmark Topic Watch Topic
  • New Topic

war file contents during runtime  RSS feed

 
Jim Atharris
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm writing code in my index.jsp file which is in MyCoolWarFile.war deployed on a Glassfish v2 app server running in Windows XP Pro. Contained in this .war file are directories called

my_dir_1/my_subdir_1
my_dir_1/my_subdir_2
my_dir_1/my_subdir_3
.... etc

I'm not going to know what directories/files exist under my_dir_1/my_subdir_X but I do know that I need to get the specific ones under "my_dir_1/my_subdir_X" (meaning the parameter passed into this .jsp will have this value (so its dynamic). The concept that index.jsp knows it is inside MyCoolWarFile.war is known to index.jsp.

My question is: what code can I put in index.jsp to get the directories and their file listings under "my_dir_1/my_subdir_X"?

Thanks,
Jim
 
Albareto McKenzie
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jim,

That logic should not go in a JSP but in a Servlet or a Bean and you can return the folder and/or list of files to the JSP and display them there, so the code is the normal way you would do it in a Java class.
 
Jim Atharris
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Albareto,

I believe you miss understood the question. I'm not concerned w/ where I'm implementing the logic. And I know how to read file/dirs/etc from the local filesystem.

Maybe I wasn't clear with my question: how does one get the directory hierarchy from a .war file? For example, reading an image from the local file system is easy; but, when you need to get that image from the .jar/.war file there is intermediate step with respect to (using) the Classloader. The fact that the index.jsp comes from the .war that contains the directory/files/etc hierarchy is what I'm after.

Thanks,
Jim
 
Albareto McKenzie
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jim,

certainly I missunderstood you xDD

I am not too much into this but if you have your index.jsp inside the .war file and the other folders and files also inside the war file you cannot access them normally? I am sorry I cannot help you with this, hope someone who knows came here to advise you. Good luck!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!