"Basel" wrote :
|
| Scenario 1 ? login:
| It is common for the user to login after viewing blogEntry.jsf?id=35. Now,
the user would expect blogEntry.jsf?id=35 to be displayed again after the
login. For this to work, loginAction.login has to know the view name from which
the user clicked on login and any request parameters that were present.
However, not knowing this information forces loginAction.login to return
?/home.jsf? so that the user is redirected to the home page.
|
You can easily know the view and the request params using the standard JSF EL
variables "view" and "facesContext":
@In
| private UIViewRoot view
|
| @In(value="#{facesContext.externalContext.requestParameterMap}")
| private Map reqParams;
With Seam's new action params feature you also have the option to forego the
instance variables and pass these values directly to your action:
>From JSP or Facelets:
<s:commandLink action="#{loginAction.login(view,
facesContext.externalContext.requestParameterMap)}" />
In Seam component:
| public String login(UIViewRoot view, Map reqParams) {
| // blah blah
| }
The action params feature is now in the nightly build.
"Basel" wrote :
| Scenario 2 - logout:
| The user is already logged in and is currently viewing
blogEntry.jsf?id=35. The user clicks on logout and as a result
loginAction.logout returns null so that the current page is redisplayed. At
this point the user is redirected to blogEntry.jsf instead of
blogEntry.jsf?id=35. As a result, the page action entryAction.setEntry returns
a new Entry object that has no properties set.
|
| I tried to access the HttpServletRequest in the second scenario but calling
getNames() method on it returned only one parameter which is the conversationId.
|
| I would appreciate any ideas or suggestions that would help in avoiding
these two scenarios.
I don't understand. Why do you have to return null from your action? Usually,
a logout action sends you to a standard "You've logged out" page.
Also, you should avoid using the HttpServletRequest directly if at all
possible. Use the ExternalContext instead.
Stan
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3964485#3964485
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3964485
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user