hi all. i am new to
JSF. i got a first page in which the user enters the id and clicks search , it forwards to page2(search_res) page ,
retireves the data from the database and displays in the datatable. Now when the user clicks any of the row it has to forward to the page3 (persondetails.jsp page)
(persondetails.jsp page)
how to click the row and forward to the third page,. i am getting SQL error when i tried to click the row parameters in the search_result page.
JSP search_res page:
search_res.JSP
<h:dataTable
border="0" cellpadding="2" cellspacing="0"
columnClasses="columnClass1" headerClass="headerClass"
footerClass="footerClass" rowClasses="rowClass1, rowClass2"
styleClass="dataTable" id="table1" width="90%" rows="20"
value="#{pc_search_res.person_idall}" var="varperson_idall">
<hx:columnEx id="columnEx1">
<f:facet name="header">
<h:outputText styleClass="outputText, staticField"
value="#{person}" id="text2"></h:outputText>
</f:facet>
<hx:commandExRowAction id="rowSelect" action="#{pc_search_res.doRowSelectAction}">
</hx:commandExRowAction>
<h:outputText id="textperson1" value="#{varperson_idall.personIDNum}"
styleClass="outputText, tableData">
</h:outputText>
</hx:columnEx>
search_res.java
public List getperson_idall(){
try {
registerDriver();
Connection conn = getConnection();
try {
Statement stmt = conn.createStatement();
String sql = "SELECT * FROM PERSON WHERE PERSON_ID = "+requestScope.get("personID"); // person ID = the user enters the value in the first page
ResultSet rs1 = stmt.executeQuery(sql);
while(rs1.next()){
int person_IDval = rs1.getInt("PERSON_ID");
PersonInfo personInfo1 = new PersonInfo(person_IDval);
personInfo1.setpersonIDNum(person_IDval);
personinfoall.add(personInfo1);
}
}
catch (SQLException ex) {
System.out.println("SQL exception not executed: " );
ex.printStackTrace();
}
releaseConnection(conn);
}
catch (Exception ex) {
ex.printStackTrace();
}
return person_idall;
}
public String doRowSelectAction()
{
// wht do i need to write hear to forward to the third page.
return "persondetails";
}