On 6/13/05, Laurie Harper <[EMAIL PROTECTED]> wrote:
> I'd like to replace URLs like this:
> 
>   /Sections/Subsections/?section=Section1&subsection=SubSection1
> 
> with URLs like this:
> 
>   /Sections/Section1/Subsections/Subsection1
> 
> An action mapping like this will match that URL:
> 
>   <action path="/Sections/*/Subsections/*"
>           type="org.apache.struts.actions.ForwardAction"
>           parameter=".tiles.mytile"/>
> 
> The problem is, there's then no way to get what the wildcards matched in
> the view (JSP). For reasons discussed elsewhere I don't want to put a
> different action in front of each view, so I need a more general solution.

This seems so obvious to me that I'm probably missing something about
your requirements. Why can't you access the
HttpServleRequest.getRequestURI() method and then process the returned
URI string in your subclass of the Struts ForwardAction? The execute
method for an Action class gets the incoming request object as one of
the parameters. Your subclass can process the URI for the section and
subsection values and set them as request attributes. For that matter,
the request object is available to your JSP pages as well:

  http://tinyurl.com/9jn4d

Of course, you would have to write scriptlet logic or define a JSP
custom tag to encapsulate the logic to parse for the
section/subsection values in order to handle it directly in the JSPs.
All easily doable though. I'm just not seeing what the problem is
here.

-Van

-- 
- Mike "Van" Riper
  [EMAIL PROTECTED]

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

Reply via email to