Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Seam: Where you from!?

 
Ryan Waggoner
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey guys,
I am having trouble trying to find out how to do something like:



Anyone know how to make my pseudo code come to life with Seam?

Thanks!
 
Vivek Murugesan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator




The return type is a string from an action.

In pages.xml , you can define the navigation as,



Let me know if this helps!!
 
Ryan Waggoner
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That looks like what I want Vivek...


But how do you get the strPage?

Or rather when I call the redirect method, where am I calling it from, and what do I pass in?
 
Vivek Murugesan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's your scenario? I thought you have an action method and based on it's logic you have to navigate to the corresponding page.

check this link for more info, http://shrubbery.mynetgear.net/wiki/Seam_pages.xml
 
Ryan Waggoner
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a userList page, which lists all of my users. You can click a user, then edit & save them.
I have an add/edit user page, which does just that. When you save the add/edit, you are forwarded to a confirmation page.

I am trying to figure out how:

When someone clicks the save
If they came from the userList page, send them back.
If they came from anywhere else, send them to the confirmation page.

The save button is linked to a method in my stateful bean, userEntryBean.

Maybe I can ask, how, in my code, can I see where the person navigated from.

Any ideas?

Thanks!
 
Vivek Murugesan
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A simple approach would be to set a boolean value in a bean and based on the value you can redirect, it can be set to 'true' when navigating from userList page.

or

You can refer the API,org.jboss.seam.faces.Redirect -> Redirect.instance().captureCurrentView();

and you'll have to make corresponding navigational entries in pages.xml.



 
Ryan Waggoner
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I will be going the boolean route.

Thanks a lot for the help!
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic