Hi friends
my problem is :
how to use set method of DynaValidatorForm like get("<fieldname>");
i am using like this but it is not working.let me know where i did
mistake...
this is my execute method of BlocksSetup action
(i want to show all the blocks existed,and give text boxes to enter new)
----------------------------------------------------------------------
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception
{
DynaValidatorForm block = null;
try
{
ds = getDataSource(request);
conn = ds.getConnection();
stmt = conn.createStatement();
String query = "SELECT
BLOCKID,COLLEGEID,ADDRESS,SHORTDESCRIPTION,PHONE,CREATEDBY,CREATEDDATE FROM
BLOCKS ORDER BY BLOCKID";
rs = stmt.executeQuery(query);
while(rs.next())
{
block = new DynaValidatorForm();
block.set("blockNo",rs.getString("BLOCKID"));
block.set("location",rs.getString("ADDRESS"));
block.set("shortDesc",rs.getString("SHORTDESCRIPTION"));
block.set("phoneNo",rs.getString("PHONE"));
blocksDetails.add(block);
}
}catch(SQLException e)
{
e.printStackTrace();
}
request.setAttribute("BLOCKS",blocksDetails);
return mapping.findForward("continue");
}
------------------------------------------------------------------------------------------------
this is my jsp
----------------------------------------------------------------------------------------------------
<table id="blocksTable" border="1" class="tableborder" >
<tr>
<td colspan="5" class="heading">Block Details</td>
</tr>
<tr>
<td width="100"class="subheading">*Block No</td>
<td width="100"class="subheading">*Short Desc</td>
<td width="200"class="subheading">Location</td>
<td width="100"class="subheading">Phone No</td>
</tr>
<logic:iterate id="blocks" name="BLOCKS" >
<tr>
<td class="tdborder2"><bean:write name="blocks"
property="blockNo" /></td>
<td class="tdborder2"><bean:write name="blocks"
property="shortDesc" /></td>
<td class="tdborder2"><bean:write name="blocks"
property="location"/></td>
<td class="tdborder2"><bean:write name="blocks"
property="phoneNo"/></td>
</tr>
</logic:iterate>
<tr>
<td class="centersubheading1"><input type="text" name="blockNo"
class="formtextmid" maxlength="10" ></td>
<td class="centersubheading1"><input type="text" name="shortDesc"
class="formtext" maxlength="10"></td>
<td class="centersubheading1"><input type="text" name="location"
class="formtext" ></td>
<td class="centersubheading1"><input type="text" name="phoneNo"
class="formtext" maxlength="15" ></td>
</tr>
</table>
--------------------------------------------------------------------------------------------
this is struts-config.xml part
-------------------------------------------------------------------------------------------
<form-bean name="blocksForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="blockNo" type="java.lang.String"/>
<form-property name="location" type="java.lang.String"/>
<form-property name="shortDesc"
type="java.lang.String"/>
<form-property name="phoneNo" type="java.lang.String"/>
</form-bean>
---------------------------------------------------------------------------------------------
let me know the problem
ur's
Mallik
--
View this message in context:
http://www.nabble.com/how-to-use-SET-method-of-DynaValidatorForm--tf2506863.html#a6989684
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]