| Author |
Actions don't work inside a dataTable column?
|
Robert Peterson
Greenhorn
Joined: Dec 16, 2004
Posts: 5
|
|
I have a List which contants titles of books. My goal in results.jsp is to iterate through the List and display the titles to the user. Once the user selects a title, it should navigate to bookDetails.jsp. The problem is it seems that the app server ignores the action="success" tag to route to the next page. When I click on a title, it just reloads the result.jsp page. Does the dataTable construct not support embedded forms? Here is the code for results.jsp: When I take out the dataTable tag (and replace the title getter binding with regular text), it does navigate to bookDetails.jsp. So this works: Here is the relevant contents of the faces-config.xml: [ June 28, 2005: Message edited by: Robert Peterson ] [ June 28, 2005: Message edited by: Robert Peterson ] [ June 28, 2005: Message edited by: Robert Peterson ] [ June 28, 2005: Message edited by: Robert Peterson ] [ July 01, 2005: Message edited by: Robert Peterson ]
|
 |
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
|
|
Here is the definiton of "action" attribute from JSF specs. Though your code is working in certain scenario, I would recommend you to make this change in your code. Use a method binding with your action attribute. [ June 28, 2005: Message edited by: Varun Khanna ]
|
- Varun
|
 |
Robert Peterson
Greenhorn
Joined: Dec 16, 2004
Posts: 5
|
|
I appreciate your help. It turns out that an action can be a String when you want to navigate to the next page immediately. If you need more functionality you can use a method in a backing bean. From the sun J2EE 1.4 tutorial:
The outcome can be defined by the action attribute of the UICommand component that submits the form, as it is in the guessNumber example: <h:commandButton id="submit" action="success" value="Submit" /> The outcome can also come from the return value of an action method in a backing bean.
Just to make sure, I tried the following and the result is the same: Using this method in the controller backing bean:
|
 |
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
|
|
|
So is your action method getting called at all or not?
|
 |
Robert Peterson
Greenhorn
Joined: Dec 16, 2004
Posts: 5
|
|
It never gets called. I tried the following and the print statement never shows up: [ June 29, 2005: Message edited by: Robert Peterson ]
|
 |
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
|
|
|
Backing bean scope request? if yes, try changing it to session.
|
 |
Robert Peterson
Greenhorn
Joined: Dec 16, 2004
Posts: 5
|
|
Changing the scope to session fixed it. Thanks! With the scope at session my original attempt with action="success" works too. Do you know why it doesn't work under request? I think I read somewhere that keeping everything at the request scope is better. [ July 01, 2005: Message edited by: Robert Peterson ] [ July 01, 2005: Message edited by: Robert Peterson ]
|
 |
Varun Khanna
Ranch Hand
Joined: May 30, 2002
Posts: 1400
|
|
Glad it's solved It's a bug. This has been discussed earlier in this forum.
|
 |
Alex Skor
Greenhorn
Joined: Aug 16, 2006
Posts: 2
|
|
damn! damn! damn! I spent 4 hours yesterday, trying back and forth without success, and your advice solved my problem completely! thanks a lot! if you ever visit Russia, mail me and we can get some beer  I see JSF developers are not in a hurry to fix this
|
 |
Joe Jose
Ranch Hand
Joined: Jan 14, 2004
Posts: 125
|
|
Hi, Just came to read this. I have the same problem. Doesn't give any error , displays the same page. I tried your case. But for its not working. I am trying an example from http://courses.coreservlets.com/Course-Materials/pdf/jsf/02-Page-Navigation.pdf Using tomcat5.5.17 and jsf1.1.3. Any idea about whats happening ? Thanks, Joe [ August 23, 2006: Message edited by: Joe Jose ]
|
 |
 |
|
|
subject: Actions don't work inside a dataTable column?
|
|
|