You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Mallik <ma...@yahoo.com> on 2006/10/18 12:29:46 UTC
problem?
Hi friends
i have a problem with <bean:write...>, i am not getting where i am going
worng
this is my code ...........
this is action class
--------------------------------------------------------------
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) throws Exception
{
BlocksForm 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 BlocksForm();
block.setBlockId(rs.getString("BLOCKID"));
block.setCollegeId(rs.getString("COLLEGEID"));
block.setLocation(rs.getString("ADDRESS"));
block.setShortDesc(rs.getString("SHORTDESCRIPTION"));
block.setPhoneNo(rs.getString("PHONE"));
block.setCreatedBy(rs.getString("CREATEDBY"));
block.setCreatedDate(rs.getString("CREATEDDATE"));
blocksDetails.add(block);
}
}catch(SQLException e)
{
e.printStackTrace();
}
request.setAttribute("blocksDetails",blocksDetails);
return mapping.findForward("continue");
}
----------------------------------------------------
this is by jsp
----------------------------------------------------
<logic:iterate name="blocksDetails" id="blocks" >
<tr>
<td class="tdborder2"><bean:write name="blocks"
property="blockId"/></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>
<td class="tdborder2">--</td>
</tr>
</logic:iterate>
-----------------------------------------------
this is my form bean
-------------------------------------------------
public class BlocksForm extends DynaValidatorForm
{
private String blockId;
private String collegeId;
private String location;
private String shortDesc;
private String phoneNo;
private String createdBy;
private String createdDate;
public void setBlockId(String blockId){this.blockId = blockId;}
public void setCollegeId(String collegeId){this.collegeId = collegeId;}
public void setLocation(String location){this.location = location;}
public void setShortDesc(String shortDesc){this.shortDesc = shortDesc;}
public void setPhoneNo(String phoneNo){this.phoneNo = phoneNo;}
public void setCreatedBy(String createdBy){this.createdBy = createdBy;}
public void setCreatedDate(String createdDate){this.createdDate =
createdDate;}
public String getBlockId(){ return this.blockId;}
public String getCollegeId(){ return this.collegeId;}
public String getLocation(){ return this.location;}
public String getShortDesc(){ return this.shortDesc;}
public String getPhoneNo(){ return this.phoneNo;}
public String getcreatedBy(){ return this.createdBy;}
public String getCreatedDate(){ return this.createdDate;}
}
-------------------------------------------------------
let me know where i went worng
ur's
Mallik
--
View this message in context: http://www.nabble.com/%3Cbean%3Awrite%3E-problem--tf2465683.html#a6873390
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org