Unfortunately, the servlet is matches action paths without considering
whether they may contain "extra information" or not, so the
../param1/param2 scheme is not supported. 

There have been posts on this before that you might be able to followup
on. 

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg19204.html

http://www.mail-archive.com/struts-user@jakarta.apache.org/msg25251.html

This does come up, and it would be nice to have some solution. 

Mike's idea of a pre-processor servlet might be cleanest, since the
extra information wold become actual parameters, making something like 

/ex/myAction/param1/param2

the equivalent of 

/do/myAction?param1&param2

The idea being the servlet handling /ex/* knows where Action paths end
and the parameters being, and then forwards to the corresponding /do/*
URI, adding the extra path information as conventional parameters. This
is also something that could be dropped into any Struts application as
an extension servlet, and then perhaps worked in to the codebase later,
if it seems to help people.

-Ted.


"Struts Newsgroup (@Basebeans.com)" wrote:
> 
> Subject: best way to encode parameters into path?
> From: "Jeff S" <[EMAIL PROTECTED]>
>  ===
> I'm getting ready to re-do an application that was created outside of Struts
> to bring it into the Struts universe. The problem is that I can't do it all
> in one shot, so the Struts-ified components need to be able to work together
> with the non-Struts (but fortunately MVC) components for a few weeks.
> 
> The problem is that the existing app depends upon finding two parameters
> within the URL path, as in:
> 
> http://www.domain.com/webapp-name/servlet-name/param1/param2
> 
> As luck would have it, I CAN re-arrange the URLs a little if it would make
> integrating it with Struts easier, to make:
> 
> http://www.domain.com/webapp-name/param1/param2/action-name,
> 
> http://www.domain.com/webapp-name/param1/param2/action-name.do,
> 
> http://www.domain.com/webapp-name/action-name/param1/param2,
> 
> or
> 
> http://www.domain.com/webapp-name/action-name.do/param1/param2
> 
> However, there are quite a few possible values for both param1 and param2,
> so creating an action mapping or servlet mapping for every conceivable
> permutation of action-name, param1, and param2 is NOT feasible. One way or
> another, param1 and param2 need to qualify under the wildcard.
> 
> Up to now, I've used *.do for everything and only dealt with formvars, so
> this is my first encounter with Struts and path mapping. Can anyone
> recommend which URL scheme incorporating all the elements -- webapp-name
> (the name of the warfile and virtual directory under which Tomcat will
> deploy it), action-name, param1, and param2 -- that will make my life as
> easy as possible? And, if possible, show how I'd express that in the struts
> action mappings file and the servlet mappings in web.xml...
> 
> Thanks!
> 
> --
> 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