• Post Reply Bookmark Topic Watch Topic
  • New Topic

moving from one page to the next using "Action Listener"?

 
Javoso Torso
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have following problem:

I am building a page which has a loop which displays some commandLink�s.

Since I need to know the name of the commandLink which fires the action, I use an ActionListener.
-> using ActionEvent.getComponent().getId()


But: How do I map to another page?
the ActionListener method is a void method. I need a String for the faces-config...

Or should I use a normal action method?
But then: How do I know which commandLink was the caller?
Is there a way of knowing the caller over the facesContext if I use a normal action and not over an actionListener?


There is sure something for this case....

Thanks
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This thread shows a way to set navigation and render a response from a listener. (The example allowed for skipping validation before the days of the immediate attribute.)
 
Javoso Torso
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Marc,

That worked:

...
NavigationHandler n = facesContext.getApplication().getNavigationHandler();

// Navigate to the page declared in faces-config (tag from-outcome)
n.handleNavigation(facesContext, null, "from-outcome");
facesContext.renderResponse();
}
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!