• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts 1.3.8 module unable to resolve jsp

 
Ranch Hand
Posts: 67
1
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I am trying to create a separate module named food for my struts application so that I can access urls in the form of localhost:8080/MyApp/food/list.do. However when trying to load the jsp with a url like that, it looks for the jsp relative to MyApp/food/, even though I am using the fully qualified path to the jsp in my action mapping like /WEB-INF/jsp/food/list.jsp

trying to access this url localhost:8080/MyApp/food/list.do results in the following error
----------------------------------------------------------------------------------------------
HTTP Status 404 - /MyApp/food/WEB-INF/jsp/food/list.jsp

type Status report

message /MyApp/food/WEB-INF/jsp/food/list.jsp

description The requested resource is not available.
Apache Tomcat/6.0.37

----------------------------------------------------------------------------------------------

web.xml


struts-config-food.xml

 
Zahro Alfelpha
Ranch Hand
Posts: 67
1
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
bump ^
 
Zahro Alfelpha
Ranch Hand
Posts: 67
1
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anybody? -__-
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This may or may not be the reason you're having problems.

In J2EE webapps, there are 2 types of paths that look a lot alike, but actually refer to very different things.

AURL path is what a client would enter to navigate to a specific URL processor - for example, the Struts Action.

A Resource path is the relative "file" location of a resource within a web application (WAR).

The confusion comes from 2 places. First, both types of paths like to look like filesystem directory paths with "/" to delineate "directory" names. Secondly, the default action in J2EE when presented with a URL path that cannot be resolved (via a web.xml URL-to-servlet mapping or as the location of a JSP) is to snip out the part of the URL that follows the host and context and use it as a resource path, copying the resource it finds at that location (or displaying "404 not found").

The web.xml file has a number of local URL paths in it - for example - the login and loginfail pages are URL paths. However, a lot of code uses resource paths. Worse, there are 2 different ways to include external content into a JSP, and one of the uses a URL path and another uses a resource path!

One thing is for certain. A URL path request for anything under WEB-INF will always fail. The WEB-INF directory is completely and unconditionally hidden from URL access mechanisms as are all its sub-components. This is a valuable way of keeping Bad People out the the classes and other critical internal resources of the webapp. Anything under WEB-INF must be requested as a resource, not via a URL.
 
Zahro Alfelpha
Ranch Hand
Posts: 67
1
Spring Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Pheew, that's a lot to digest. A bit over my head right now and I am busy working on other things at the moment, but I will digest this at a later time and try to figure it out. I'll post again when I get there! Thanks.
reply
    Bookmark Topic Watch Topic
  • New Topic