You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Brian Lalor <bl...@bravo5.org> on 2005/07/15 18:10:46 UTC

passing param as part of URL path

I'm working on a product catalog display application that uses the  
same logic and code, but takes a common parameter for *every  
request*, specifying the specific catalog to use.  The application is  
a web service of sorts, and has no state stored between requests.

I would like to use URLs of this schema and embed the catalog param  
in the path:
     http://host/root/CATALOG1/action.do
     http://host/root/CATALOG2/action.do

I prefer this idea to specifying a request parameter (?catalog=1) for  
every action.

I was thinking that I would somehow capture CATALOG1 and CATALOG2 and  
stick them into the request, but I'm not sure how to go about it.  It  
this functionality that Struts already has, do I need to implement a  
filter, or should I subclass the main ActionServlet?

Thanks in advance,
B

--
    __   ____
   / /  / __/ Brian Lalor           "If you still have gas, you're  
not lost."
  / _ \/__ \  blalor@bravo5.org             -- Jacques Strappe
/_.__/____/  http://bravo5.org/



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: passing param as part of URL path

Posted by Laurie Harper <la...@holoweb.net>.
You can do this using wildcard action mapping paths:

http://struts.apache.org/userGuide/building_controller.html#action_mapping_wildcards

L.

Brian Lalor wrote:

> I'm working on a product catalog display application that uses the  same 
> logic and code, but takes a common parameter for *every  request*, 
> specifying the specific catalog to use.  The application is  a web 
> service of sorts, and has no state stored between requests.
> 
> I would like to use URLs of this schema and embed the catalog param  in 
> the path:
>     http://host/root/CATALOG1/action.do
>     http://host/root/CATALOG2/action.do
> 
> I prefer this idea to specifying a request parameter (?catalog=1) for  
> every action.
> 
> I was thinking that I would somehow capture CATALOG1 and CATALOG2 and  
> stick them into the request, but I'm not sure how to go about it.  It  
> this functionality that Struts already has, do I need to implement a  
> filter, or should I subclass the main ActionServlet?
> 
> Thanks in advance,
> B
> 
> -- 
>    __   ____
>   / /  / __/ Brian Lalor           "If you still have gas, you're  not 
> lost."
>  / _ \/__ \  blalor@bravo5.org             -- Jacques Strappe
> /_.__/____/  http://bravo5.org/


-- 
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/~laurie/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org