Thanks a lot, thats what I need. I know the stripes:url tag but I have
to admit that I didn't know the trick with the variable. This solves a
lot of my problems... :-)

2009/2/19 Iwao AVE! <[email protected]>:
> Hi Richard,
>
> Have you checked the stripes:url tag ?
>
> <stripes:url
>  var="redirectUrl"
>  beanclass="de.dser.dwh.fe.controller.impl.app.SomeActionBean"
>  prependContext="false" />
> <c:redirect url="${redirectUrl}" />
>
> Regards,
> Iwao
>
> on 09.2.19 7:26 PM Richard Hauswald said the following:
>> Hello,
>> i want to send a redirect to a stripes action bean inside a jsp page
>> referencing the bean by its class name, not the url. I looked up the
>> source code of stripes and created Class with a static function in it,
>> doing the translation:
>>
>> public static String buildUrl(ServletRequest request, ServletResponse
>> response, String nameOrClass) throws StripesJspException {
>>               return buildUrl(request, response, nameOrClass, null);
>> }
>> public static String buildUrl(ServletRequest request, ServletResponse
>> response, String nameOrClass, String event)
>>                       throws StripesJspException {
>>               // Add all the parameters and reset the href attribute; pass 
>> to false
>>               // here because
>>               // the HtmlTagSupport will HtmlEncode the ampersands for us
>>               String base = getUrlBinding(nameOrClass);
>>               if (base == null || base.length() < 1)
>>                       return MessageFormat.format("class {0} not found", 
>> nameOrClass);
>>               UrlBuilder builder = new UrlBuilder(
>>                               request.getLocale(),
>>                               base,
>>                               false);
>>               if (event != null) {
>>                       builder.setEvent(event);
>>               }
>>
>>               // Prepend the context path, but only if the user didn't 
>> already
>>               String url = builder.toString();
>>               String contextPath = ((HttpServletRequest) 
>> request).getContextPath();
>>               if (contextPath.length() > 1 && !url.startsWith(contextPath + 
>> '/'))
>>                       url = contextPath + url;
>>
>>               return ((HttpServletResponse) response).encodeURL(url);
>> }
>> Now I can do the folowing in my jsp:
>> <%
>>       response.sendRedirect(StripesLinkHelper.buildUrl(request, response,
>>                       "de.dser.dwh.fe.controller.impl.app."));
>> %>
>>
>> I know that this is ugly and dirty, thatswhy I'm interested in a more
>> beautiful solution.
>> Thanks in advance,
>> Richard
>>
>> ------------------------------------------------------------------------------
>> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
>> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
>> -Strategies to boost innovation and cut costs with open source participation
>> -Receive a $600 discount off the registration fee with the source code: SFAD
>> http://p.sf.net/sfu/XcvMzF8H
>> _______________________________________________
>> Stripes-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
>
> ------------------------------------------------------------------------------
> Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
> -OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
> -Strategies to boost innovation and cut costs with open source participation
> -Receive a $600 discount off the registration fee with the source code: SFAD
> http://p.sf.net/sfu/XcvMzF8H
> _______________________________________________
> Stripes-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to