Get your CodeRanch badge!*
The moose likes JSF and the fly likes DataTable Connection porblem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "DataTable Connection porblem" Watch "DataTable Connection porblem" New topic
Author

DataTable Connection porblem

Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi all,
In my application i am dynamically generating tables by using h:datable along with that fields i am generating one view commandbutton for each and every row, if i click on that button it is not going to next page,here i am pasting my code please help me,

//jsp page

<h:column>
<f:facet name="header">
<%-- <hutputText value="#{msgs['header.message']}" /> --%>
</f:facet>
<h:commandButton value="View" actionListener="#{AllotmentBooking.viewAllotmentBooking}" />
</h:column>

</h:dataTable>

//java class

public String viewAllotmentBooking(ActionListener actionListener){
return "viewAllotmentBooking";
}

//faces-config.xml code

<navigation-rule>
<from-view-id>/AllotmentBooking.jsp</from-view-id>
<navigation-case>
<from-outcome>viewAllotmentBooking</from-outcome>
<to-view-id>/ViewAllotment.jsp</to-view-id>
</navigation-case>
</navigation-rule>

here AllotmentBooking.jsp is my main page from here i am moving to ViewAllotment.jsp.

Please help me to slove this problem

Regards,
Vardhan
Jerwin Louise Uy
Ranch Hand

Joined: Oct 27, 2007
Posts: 75
If I understand it correctly, you want your command button to navigate to the second page. If not then ignore the message below.

If so, the actionListener does not in any way affect navigation. Change the actionListener attribute in the commandButton to action.

Modifications -



Regards.


Uy Jerwin Louise Vergara
Junior Developer / Research and Development at Incuventure Partners Corporation
email: jerwin.uy@incuventure.net
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
Hi Jerwin,

I tried by changing my code what ever you said but it is giving but it is not working

public String viewAllotmentBooking(){
return "viewAllotmentBooking";
}

<h:commandButton value="View" action="#{AllotmentBooking.viewAllotmentBooking}" />

Thanks,
Vardhan
Jerwin Louise Uy
Ranch Hand

Joined: Oct 27, 2007
Posts: 75
If it is not working then I would appreciate if you could post a the log file of the exception when you clicked the method.

Usually, there will be a check when the command button fires an ActionSource

- If the method is found in the declared backing bean
- If the method signature is correct

Thanks.
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
It is not showing any error, when i click the control is not moving any page and page is getting refresh.

Regards,
Vardhan
Jerwin Louise Uy
Ranch Hand

Joined: Oct 27, 2007
Posts: 75
If that is true, then you either you are using an actionlistener or an action with a return null.

Regards.
Reshma Reddy
Ranch Hand

Joined: Dec 21, 2006
Posts: 197
first i tried with ActionListener after that i tried with Action parameter but in both conditions it is not working and not showing any error,

i think the control is not going to next page and i don't know where the problem is i tried my best and still working on that....please find where the porblem is ..

Regards,
Vardhan
Bauke Scholtz
Ranch Hand

Joined: Oct 08, 2006
Posts: 2458
A couple of causes:

1) A validation or conversion error is being thrown which skipped the invoke action phase. It might be uncaught by the page because of a lacking h:message or h:messages tag. If you were using JSF 1.2, those errors should be printed in the application server logs. If you are using JSF 1.1 or older, then add <h:messages /> to the page to take note of all validation and conversion errors.

2) The getter of the datatable value doesn't return the same datamodel during the apply request values phase of the next request. So JSF wouldn't be able to determine which row has invoked which action method. To do a quick test, try placing the bean in the session scope. If it solves the problem and you want to keep the bean request scoped, then you should review your data loading logic so that it returns exactly the same datamodel in the both requests of displaying the table and processing the submit.

3) The from-view-id of the navigation case doesn't match the actual view id. Verify it, it is case sensitive. The same applies to the to-view-id.

At least also verify if the action method is actually invoked by adding a simple debug statement to it so that you can read in the logs if it is actually invoked. E.g.
[ August 24, 2008: Message edited by: Bauke Scholtz ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: DataTable Connection porblem
 
Similar Threads
Links in dynamic form
errors's management
know about request scope in JSF(how to pass parameter from one page to other)
Providing anchor to columns in a datatable
commandButton in dataTable doesn't work -method not found