jsp location when using modules

2005-04-14 Thread Andreas Toom
Hello, We are currently refactoring our Web applications into one 
application using Struts modules so that we can share common resources 
more easily between the different modules.

Now to the problem, we are currently placing all our jsps in 
/WEB-INF/pages/ but when introducing modules I get 404 for this action:

action path=/test forward=/WEB-INF/pages/test/error.jsp /
Tomcat searches /test/WEB-INF/pages/test/error.jsp
I've read that this behaviour can be overwritten with:
controller 
processorClass=org.apache.struts.tiles.TilesRequestProcessor 
pagePattern=/WEB-INF/pages/$M$P /

But no result.
How can this be solved? do I have to place content for each module in 
/modulename/...

and what does this do to content that we wish to share, for example tile 
 definitions that are now in /WEB-INF/tiles/ ?

/Andreas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: jsp location when using modules

2005-04-14 Thread Hubert Rabago
I haven't done this before, but try this:

1. Use the forwardPattern attribute of controller and give it the
same value you're giving pagePattern now.

2. Set up a custom ForwardAction.  The existing ForwardAction sets
contextRelative which skips the use of forwardPattern.  For your
custom version, copy the code in the existing ForwardAction except
don't set contextRelative to true.

3. Change your mappings to:
action path=/test type=your.ForwardAction parameter=error.jsp/
It should resolve to /WEB-INF/pages/test/error.jsp where
forwardPattern=/WEB-INF/pages/$M$P and the module name is test.

Looking at TilesRequestProcessor.processTilesDefinition(), it doesn't
look like it prefixes the uri with module names, nor does it use
controller.forwardPattern, so if I read it right, it will use the uri
you set in your tile definitions.

hth,
Hubert

On 4/14/05, Andreas Toom [EMAIL PROTECTED] wrote:
 Hello, We are currently refactoring our Web applications into one
 application using Struts modules so that we can share common resources
 more easily between the different modules.
 
 Now to the problem, we are currently placing all our jsps in
 /WEB-INF/pages/ but when introducing modules I get 404 for this action:
 
 action path=/test forward=/WEB-INF/pages/test/error.jsp /
 
 Tomcat searches /test/WEB-INF/pages/test/error.jsp
 
 I've read that this behaviour can be overwritten with:
 controller
 processorClass=org.apache.struts.tiles.TilesRequestProcessor
 pagePattern=/WEB-INF/pages/$M$P /
 
 But no result.
 
 How can this be solved? do I have to place content for each module in
 /modulename/...
 
 and what does this do to content that we wish to share, for example tile
   definitions that are now in /WEB-INF/tiles/ ?
 
 /Andreas


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: jsp location when using modules

2005-04-14 Thread Andreas Toom
Hello again,
The main reason I wanted to use WEB-INF at first was to protect jsp/xml 
but this would lead to module contents i two places, static content 
(images etc) in /modulename and pages in WEB-INF/pages/modulename.

After trying some things I have decided, for now, to place each module 
with all it contents in /modulename and use a filter to protect jsp, 
xml:s etc from direct access. It feels good to place all resources for a 
module in one place...

What do you guys think of this approach?
/Andreas

Hubert Rabago wrote:
I haven't done this before, but try this:
1. Use the forwardPattern attribute of controller and give it the
same value you're giving pagePattern now.
2. Set up a custom ForwardAction.  The existing ForwardAction sets
contextRelative which skips the use of forwardPattern.  For your
custom version, copy the code in the existing ForwardAction except
don't set contextRelative to true.
3. Change your mappings to:
action path=/test type=your.ForwardAction parameter=error.jsp/
It should resolve to /WEB-INF/pages/test/error.jsp where
forwardPattern=/WEB-INF/pages/$M$P and the module name is test.
Looking at TilesRequestProcessor.processTilesDefinition(), it doesn't
look like it prefixes the uri with module names, nor does it use
controller.forwardPattern, so if I read it right, it will use the uri
you set in your tile definitions.
hth,
Hubert
On 4/14/05, Andreas Toom [EMAIL PROTECTED] wrote:
Hello, We are currently refactoring our Web applications into one
application using Struts modules so that we can share common resources
more easily between the different modules.
Now to the problem, we are currently placing all our jsps in
/WEB-INF/pages/ but when introducing modules I get 404 for this action:
action path=/test forward=/WEB-INF/pages/test/error.jsp /
Tomcat searches /test/WEB-INF/pages/test/error.jsp
I've read that this behaviour can be overwritten with:
controller
processorClass=org.apache.struts.tiles.TilesRequestProcessor
pagePattern=/WEB-INF/pages/$M$P /
But no result.
How can this be solved? do I have to place content for each module in
/modulename/...
and what does this do to content that we wish to share, for example tile
 definitions that are now in /WEB-INF/tiles/ ?
/Andreas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]