您的位置:首页 > 其它

参数传递问题

2007-08-21 10:08 134 查看
发送参数的页面部分代码:

<%
String assettypeid=null;
Collection cle=(Collection)request.getAttribute("assettypeeditsearch");
Iterator it=(Iterator)cle.iterator();
while(it.hasNext()){
AssettypeForm assettypeform=(AssettypeForm)it.next();
assettypeid=String.valueOf(assettypeform.getId());//把从表里面的获得的int 型变成字符型

%>

<tr><td><%=assettypeform.getAssettypename() %></td>

<td><%=assettypeform.getDescription() %></td><td><a href="assettypeedit.jsp?assettypeId=<%=assettypeid%>">编辑</a><td></tr>
<%} %>

接收参数的页面部分代码:

<%

Databasecon db= new Databasecon();
int assettypeId=-1;
if(!" ".equals(request.getParameter("assettypeId"))||((request.getParameter("assettypeId")!=null))){
try{

assettypeId=Integer.parseInt(request.getParameter("assettypeId"));//把转变成String型的int型数据再变成 int型;

}catch(Exception e){
e.printStackTrace();
}

AssettypeForm assettypeform=(AssettypeForm)db.editAssettype(assettypeId);//传递的参数为int型
%>

<tr><td>资产类型名称</td><td><html:text property="assettypename" value="<%=assettypeform.getAssettypename() %>"/></td></tr>
<tr>
<td >资产类型描述</td><td><html:text property="description" value="<%=assettypeform.getDescription()%>"/></td>
</tr>
<%}%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: