参数传递问题
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>
<%}%>
<%
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>
<%}%>
相关文章推荐
- Struts2 URL传递中文参数乱码问题
- 解决get方法传递URL参数中文乱码问题
- Java http get/post 传递json参数问题 .
- 函数参数的传递方式及一些容易出现的问题
- 函数参数(指针的指针)传递问题
- js 函数传递参数类型问题(基本类型和引用类型)
- 参数传递中的编码问题(get和post方式)
- 奇怪问题:使用Request.QueryString传递一个中文参数,结果少了一个字!
- Java JNI调用c++ dll文件,传递参数乱码问题
- C# webconfig配置解决post 传递中文参数乱码问题
- pthread_create 参数传递指针问题(创建多线程时,循环变量的传递)
- 从内存分配看函数参数传递问题
- Extjs中store与分页传递参数问题
- 解决get方法传递URL参数中文乱码问题
- 结构体指针作为函数参数传递却无法传值的有关问题
- javascript自定义函数传递参数的常见问题
- 解决在JSP中传递中文参数的问题
- C#调用C++编写的DLL函数各种参数传递问题
- Java-String类型的参数传递问题
- JAVA_OA(十四):SSM练手项目bug-JSP页面传递参数的编码问题