----- Original Message -----
From: "Struts Newsgroup" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, April 11, 2002 7:55 PM
Subject: Re: Configuring sub-applications


> Subject: Re: Configuring sub-applications
> From: Bill Wohler <[EMAIL PROTECTED]>
>  ===
> [EMAIL PROTECTED] writes:
> >      <init-param>
> >        <param-name>config/subapp1</param-name>
> >        <param-value>/docroot/subapp1/struts-config.xml</param-value>
> >      </init-param>
> >      <init-param>
> >        <param-name>config/subapp2</param-name>
> >        <param-value>/docroot/subapp2/struts-config.xml</param-value>
> >      </init-param>
>
>   Cool.
>
>   N.B. I found Tomcat would complain until I defined a
>   <param-name>config</param-name> parameter.

Can you tell me the nature of the complaint?

>
> >    <servlet-mapping>
> >      <servlet-name>action</servlet-name>
> >      <url-pattern>*.do</url-pattern>
> >    </servlet-mapping>
> >
> > This configuration will map a URL like this:
> >
> >    http://yourhost/yourapp/subapp1/youraction.do
>
>   I was hoping for:
>
>     http://yourhost/yourapp/subapp1/youraction
>
>   I find that makes for a much cleaner URL. Possible?

Unfortunately, path mapping isn't currently supported for sub-apps, only
extension mapping. By the way, a good reference for the multi-app stuff is
Craig's follow-up to his original checkin message:

http://www.mail-archive.com/[email protected]/msg04354.html

>
> > By the way, I left out the Tiles configuration, since I'm not
> > sufficiently familiar with it, especially in a multi-app environment.
>
>   Fortunately, I added subapp prefixes to my tiles definitions, so I
>   found I could do this:
>
>     <web-app>
>       <servlet>
>       ...
>         <init-param>
>           <param-name>definitions-config</param-name>
>           <param-value>
>             /docroot/subapp1/tile-defs.xml,
>             /docroot/subapp2/tile-defs.xml
>           </param-value>
>         </init-param>
>
>   As you'll note, we would like to put the subapps at the leaves of
>   the tree, rather than at the root. For example, myaction forwards
>   to:
>
>     /docroot/subapp1/myaction/page.jsp
>
>   However, with the configuration above, this gets mapped to the
>   nonexistent file:
>
>     /myapp/subapp1/docroot/subapp1/myaction/page.jsp

You probably want to set your forwards to be context relative. The default
is for them to be prefixed with the sub-app name. To do that, add the
'contextRelative' attribute to your forwards like this:

  <forward ... contextRelative="true" ... />

As an aside, you may want to consider putting your JSP files underneath
WEB-INF. Files under this directory cannot be served up to the client by the
container (per the servlet spec), so doing this prevents the user from
directly accessing a JSP page by typing in the corresponding URL. As a
result, you don't have to worry about checking for logged in users or
appropriate prior setup for the page in the JSP page itself.

--
Martin Cooper


>
>
> --
> Bill Wohler <[EMAIL PROTECTED]>  http://www.newt.com/wohler/  GnuPG
ID:610BD9AD
> Maintainer of comp.mail.mh FAQ and mh-e. Vote Libertarian!
> If you're passed on the right, you're in the wrong lane.
>
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
>


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

Reply via email to