struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jba...@aiusa.org
Subject Re: Mutil URL access to a struts application
Date Wed, 04 Jun 2003 15:08:06 GMT
One approach is to create separate action mappings for
/init
/foo/init
/foo/init2

all of which forward to the same action class, and then decode the mapping 
in the action to determine what to do. E.g.,

String path = mapping.getPath();
if (path.equals("/init.do") {
} else { ....

Joe Baker
Director of Internet Communications
Amnesty International USA
http://amnestyusa.org
jbaker@aiusa.org




"Laurent Garcia" <laurent.garcia@integro-networks.com>
06/04/03 11:03 AM
Please respond to "Struts Users Mailing List"

 
        To:     <struts-user@jakarta.apache.org>
        cc: 
        Subject:        Mutil URL access to a struts application


Hi all,

I just finished my struts 1.0 application, and now I would like to access 
to my application through several URL :

My root context is APP and I want to access to my application with, 
for example :

http://localhost:9080/APP/init.do
http://localhost:9080/APP/foo/init.do
http://localhost:9080/APP/foo2/init.do

and depend on the url context I want to have a different behaviour in my 
application

But I don't want to change anything in my struts-config.xml file (perhaps 
in the jsp).

I have something like that :

<servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
</servlet-mapping>
in my web.xml, I try  to add <url-pattern>/foo/*.do</url-pattern> with no 
success.

Thanks,


Laurent







Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message