Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem: Struts+Modules+jsps under WEB-INF  RSS feed

Maciej Kolodziej
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I started developing an application with Jakarta Struts 1.1. I decided to build it using multiple modules (sub-apps) and also hide all jsps under WEB-INF. Thus my application structure looks like this:
Now I create an action in stuts-config-common.xml and define it like this:
<action forward="/WEB-INF/jsp/common/mainScreen.jsp" path="/test"
scope="request" unknown="false" validate="false"/>
When I want to fire this action I have to type for ex.:
But then I get a message:
type Status report
message /common/WEB-INF/jsp/common/mainScreen.jsp
description The requested resource (/common/WEB-INF/jsp/common/mainScreen.jsp) is not available.
So the module name is used as context(?) and put also before WEB-INF. Why? I don't need this. The module name should be put after jsp, as it is.
If I create another action and put in in default module this doesn't happen.
[ December 03, 2002: Message edited by: Maciej Kolodziej ]
Ted Husted
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Personally, I don't favor placing JSPs under WEB-INF. Some containers do not support this, and if you are linking to Actions rather than JSPs, they are already "hidden".
The module feature works by prepending the module name (or context) between the application context and the rest of URI. In the normal course, you should never embed the module name in URI, since Struts puts it there for you.
By default, all the JSPs and other resources should be placed under a directory named for your module context. If you want to place your resources under subdirectory, including WEB-INF, you can change the default configuration through the pagePattern property of the controller element in the struts-config.
In your case, I believe this would be
<controller pagePattern="/WEB-INF$M$P" />
which tells the Struts tags to insert "/WEB-INF" before the usual /commons/page.jsp
HTH, Ted.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!