struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jae K" <invr...@gmail.com>
Subject Re: resume after login feature
Date Sun, 08 Apr 2007 21:02:19 GMT
Here is the correct OGNL expression:
<param name="location">${#parameters['origurl'] == null ? 'Welcome.do' :
#parameters['origurl']}</param>

Of course in Login.jsp you need...
<s:form action="Login.do" validate="true">
    <s:if test="${param.origurl ne null}">
        <s:hidden name="origurl" value="${param.origurl}"/>
    </s:if>
....

And finally, this has the side effect that all links on the login page
created with <s:url ...> will also have the origurl parameter. You can
override this behavior by setting includeParams="none" (i think), but it's
not strictly necessary because the <s:form ...> action does not inherit
those parameters.

 - Jae

On 4/8/07, Jae K <invrnrv@gmail.com> wrote:
>
> It turns out that ${ServletRequest.requestURI } is the correct OGNL
> expression. Of course you need to have a "getServletRequest" method in your
> action superclass, which means all of your actions for your application that
> requires a login will have to implement that method or subclass from a class
> that does.
>
> Dale, the "parse" param is set to true by default so I didn't have to set
> it.
>
> The second part requires redirecting to the origurl location after a
> successful login. This the OGNL expression I have so far, but it's not
> working yet. I'll post again once i fix it.
>
> <param name="location">${#ServletRequest.parameter["origurl"] == null ? "
> Welcome.do" : #ServletRequest.parameter["origurl"]}</param>
>
>
> On 4/8/07, Jae K <invrnrv@gmail.com> wrote:
> >
> > Right after posting this I realized that my AuthenticationInterceptor
> > was the first interceptor to be called, and that's why the ServletRequest
> > object wasn't set.
> >
> > AAAHHHHHhh. I've been burned by the config twice already (the first time
> > was when using the struts-default.xml config, ValidationInterceptor is
> > configured not to validate for certain methods), but I'm willing to admit
> > that it's my dumb oversight.
> >
> > Now I need to get the OGNL syntax right.
> >
> > On 4/8/07, Jae K <invrnrv@gmail.com> wrote:
> > >
> > > Sigh... I tried tackling the first half of this problem today. The
> > > first part is getting the original requested URL as a parameter to the
> > > RedirectActionResult.
> > >
> > >         </global-results>
> > >             <result name="login" type="redirect-action">
> > >                 <param name="actionName">Login</param>
> > >                 <param name="namespace">/</param>
> > >                 <param name="origurl">${ServletRequest.requestURI}</param>
  <-- not sure about the OGNL here.
> > >             </result>
> > >         </global-results>
> > >
> > > All of my actions extend MySupport, which implement
> > > ServletRequestAware. I fired my debugger to see whether the request object
> > > would even be set (with the setServletRequest method) in my action before
> > > the redirect-action is executed. NO! I don't think I can access the
> > > ServletRequest object from the redirect-action configuration!
> > >
> > > My only remaining option is to create my own redirect class that taps
> > > into the ServletRequest object via the invocation object. Rigth now S2 is
> > > looking very very unattractive as a web framework, because the OGNL features
> > > are not well documented (esp in relation to struts results), and because the
> > > given Result and Interceptor classes are not suitable for my basic needs
> > > such as resume after redirect.
> > >
> > >  - Jae
> > >
> > > On 4/6/07, Dave Newton < newton.dave@yahoo.com> wrote:
> > > >
> > > > --- meeboo <deepstar@gmail.com> wrote:
> > > > > One last question regarding this. As I beforehand
> > > > > don't know where to redirect the user after the
> > > > login
> > > > > action I will have to implement the
> > > > > ServletResponseAware interface and then use the
> > > > > HttpServletResponse for this. This seems like an
> > > > ugly
> > > > > way to redirect the user, are there other ways
> > > > maybe?
> > > >
> > > > As someone else mentioned if you are using an
> > > > interface to set the original URL (like void
> > > > setOriginalUrl(String) & String getOriginalUrl()) then
> > > > you can map a redirect in your action's config, more
> > > > or less like the following:
> > > >
> > > > <result type="redirect">${originalUrl}</result>
> > > >
> > > > That was a day or two ago; I don't have a reference to
> > > > it handy and I don't recall who the poster was.
> > > >
> > > > d.
> > > >
> > > >
> > > >
> > > >
> > > > ____________________________________________________________________________________
> > > >
> > > > It's here! Your new message!
> > > > Get new email alerts with the free Yahoo! Toolbar.
> > > > http://tools.search.yahoo.com/toolbar/features/mail/
> > > >
> > > >
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > > > For additional commands, e-mail: user-help@struts.apache.org
> > > >
> > > >
> > >
> >
>

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