jsp<%@ page language="java" import="java.util.*" contentType="text/html; charset=utf-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%><%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'show.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<html:form action="sqlAction.do" method="post">
<tr>
<td>
员工编号:
</td>
<td>
<html:text property="postid" name="Formbeen1"/>
</td>
<td>
员工名:
</td>
<td>
<html:text property="postname" name="Formbeen1"/>
</td>
</tr>
<logic:iterate id="u" property="list" name="Formbeen1">
<tr>
<td>
<bean:write name="u" property="id"/>
</td>
<td>
<bean:write name="u" property="name"/>
</td>
<td>
<a href="sqlAction.do?">删除</a>
</td>
<td>
<a href="upData.do?">修改</a>
</td>
</tr>
</logic:iterate>
<html:submit value="查询" />
</html:form>
</body>
</html>formbeanpublic class sqlAction extends Action { @Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Formbeen1 formbeen1 = (Formbeen1) form;
String postid = formbeen1.getId();
String postname = formbeen1.getName();
System.out.println(formbeen1.getId());
List<Formbeen1> list = new ArrayList();
SelectAction dao1 = new SelectAction();
list = dao1.select(postid, postname);
formbeen1.setList(list);
// list.get(0).getId();
// System.out.println(dao1.getFlag() +"11111" );
//
// System.out.println(clist );
// System.out.println(dlist );
// TODO Auto-generated method stub
// System.out.println( list.get(0).getId() +"1111111111");
return mapping.findForward("ok");
formbean
import org.apache.struts.action.ActionForm;import java.util.List;
import java.util.ArrayList;public class Formbeen1 extends ActionForm {
private String postid;
private String postname;
private List<Formbeen1> list ;
private String id;
private String name;
public String getPostid() {
return postid;
}
public void setPostid(String postid) {
this.postid = postid;
}
public String getPostname() {
return postname;
}
public void setPostname(String postname) {
this.postname = postname;
}
public List<Formbeen1> getList() {
return list;
}
public void setList(List<Formbeen1> list) {
this.list = list;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Formbeen1() {
super();
}
}
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%><%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"> <title>My JSP 'show.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
--> </head> <body>
<html:form action="sqlAction.do" method="post">
<tr>
<td>
员工编号:
</td>
<td>
<html:text property="postid" name="Formbeen1"/>
</td>
<td>
员工名:
</td>
<td>
<html:text property="postname" name="Formbeen1"/>
</td>
</tr>
<logic:iterate id="u" property="list" name="Formbeen1">
<tr>
<td>
<bean:write name="u" property="id"/>
</td>
<td>
<bean:write name="u" property="name"/>
</td>
<td>
<a href="sqlAction.do?">删除</a>
</td>
<td>
<a href="upData.do?">修改</a>
</td>
</tr>
</logic:iterate>
<html:submit value="查询" />
</html:form>
</body>
</html>formbeanpublic class sqlAction extends Action { @Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
Formbeen1 formbeen1 = (Formbeen1) form;
String postid = formbeen1.getId();
String postname = formbeen1.getName();
System.out.println(formbeen1.getId());
List<Formbeen1> list = new ArrayList();
SelectAction dao1 = new SelectAction();
list = dao1.select(postid, postname);
formbeen1.setList(list);
// list.get(0).getId();
// System.out.println(dao1.getFlag() +"11111" );
//
// System.out.println(clist );
// System.out.println(dlist );
// TODO Auto-generated method stub
// System.out.println( list.get(0).getId() +"1111111111");
return mapping.findForward("ok");
formbean
import org.apache.struts.action.ActionForm;import java.util.List;
import java.util.ArrayList;public class Formbeen1 extends ActionForm {
private String postid;
private String postname;
private List<Formbeen1> list ;
private String id;
private String name;
public String getPostid() {
return postid;
}
public void setPostid(String postid) {
this.postid = postid;
}
public String getPostname() {
return postname;
}
public void setPostname(String postname) {
this.postname = postname;
}
public List<Formbeen1> getList() {
return list;
}
public void setList(List<Formbeen1> list) {
this.list = list;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Formbeen1() {
super();
}
}
解决方案 »
- 关于Hibernate支持LDAP的问题?
- 一个很急的问题,DBlink的使用
- Tuscany SCA 错误
- weblogic...sqlexception错误 tomcat正常
- JAVA的发展方向 ?迷茫中 ! 请有工作经验的大侠开导
- 引用外部DTD文件报错
- 数组类型的类,怎么能组成一个ActionForm,提交呢???急,在线!!!!
- 在jbuilder+weblogic,struts下,关于cmp和和struts中Action相互调用的问题
- 有什么方法,可以把字符串的特殊字符替换成别的字符?谢谢
- 请求建议:大家对在bs结构下利用j2ee开发大型的文字处理软件有什么建议。
- 把数据库的信息以jsp展现出来
- * cannot be resolved to a type
版本 strucs1.2
你jsp里名称为:postid
把private String id;
改为private String postid;
同理
那个得不到的也是