Hello, my first post and please be gentle as I'm new to
java.
I am building a
JSP page which is displaying records from a database. I have saved the resultSet records to a javabean which then saved to a vector. I have a
servlet which extracts each record/bean and forwards and displays the record details.
By pressing a next or previous button I can skip through the vector getting each record. While each record is displayed in the JSP I want to be able to update the record details and save to the vector.
I have been trying to do this by using usebean and the getProperty and setProperty in the same value field within the JSP page shown below.
<%@page import = "records.recordBean"%>
<html>
<head><title>Client Details</title></head>
<body>
<jsp:useBean id = "bean" class = "records.recordBean" scope="application" />
<FORM METHOD="POST" ACTION="/servlet/recordSkip">
<TABLE WIDTH=1000 BORDER="1">
<TR>
<TD WIDTH=250 ALIGN="RIGHT">Client ID</TD>
<TD WIDTH=250 ALIGN="LEFT">
<INPUT TYPE="TEXT" NAME="clientID" value = "<jsp:getProperty name="bean" property="clientID"/>" >
</TD>
<td WIDTH=250 ALIGN="RIGHT">Company:</td>
<TD WIDTH=250 ALIGN="LEFT">
<INPUT TYPE="TEXT" NAME="compName" value = "<jsp:getProperty name="bean" property="compName"/><jsp:setProperty name="bean" property="compName"/>" >
</TD>
</TR>
<TR>
</TABLE>
<P><INPUT TYPE="SUBMIT" VALUE="submit" NAME="submit"><INPUT TYPE="SUBMIT" VALUE="Previous" NAME="previous">
<INPUT TYPE="SUBMIT" VALUE="Next" NAME="next">
</FORM>
</table>
</body>
</html>
Is this a correct method to have a getProperty and setProperty in the same value field to get it to update the bean
value = "<jsp:getProperty name="bean" property="compName"/><jsp:setProperty name="bean" property="compName"/>"
Help and advise would be much appreciated