jsp页面初始化的问题,进入不去,大神指点一下!

零单 2015-08-31 05:27:16
就是user==null,return "list";。进不去userDao.selcetall方法。我估计是在JSP里面出问题,但是看了半天不懂怎么解决,大神帮忙解决一下

ACTION
public String list(){
if(this.getPage()==null){
this.setPage(new Page());
}

List<Gjt_User>list=new ArrayList<Gjt_User>();

if (user!=null) {
System.out.println("...................进入到useraction");
Map<String, Object> param=new HashMap<String, Object>();
param.put("username", user.getUsername());
param.put("userphone", user.getUserphone());
list=userDao.selcetall(param);

this.page.setTotalRows(userDao.count(param));
param.put("page", this.page);
list=userDao.selcetall(param);

request.setAttribute("list", list);
}

return "list";

JSP
<body>
<form name="fom" id="fom" method="post" action="${pageContext.request.contextPath }/user_list.do">
<table width="100%" border="0" cellspacing="0" cellpadding="0">

<tr>
<td height="30">

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="62" background="../images/nav04.gif">

<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="21"></td>
<td width="300">按用户名查询:
<input name="" type="text" size="12" />
<s:submit cssClass="right-button02" value="查询"></s:submit>
</td>
</table></td>
</tr>
<tr>
<td><table id="subtree1" style="DISPLAY: " width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">

<tr>
<td height="40" class="font42"><table width="100%" border="0" cellpadding="4" cellspacing="1" bgcolor="#464646" class="newfont03">


<tr>
<td width="10%" height="20" align="center" bgcolor="#EEEEEE">用户名</td>
<td width="10%" align="center" bgcolor="#EEEEEE">所属部门</td><!--
<td width="10%" align="center" bgcolor="#EEEEEE">对应权限</td>
--><td width="9%" align="center" bgcolor="#EEEEEE">姓名</td>
<td width="5%" align="center" bgcolor="#EEEEEE">性别</td>
<td width="6%" align="center" bgcolor="#EEEEEE">年龄</td>
<td width="10%" align="center" bgcolor="#EEEEEE">电话</td>
<td width="15%" align="center" bgcolor="#EEEEEE">邮箱</td></tr>
<s:iterator value="#request.list" var="user" status="states">
<tr>
<td height="20" bgcolor="#FFFFFF"><div align="center"> <s:property value="#user.id"/></div></td>
<td height="20" bgcolor="#FFFFFF"><div align="center"> <s:property value="#user.username"/></div></
</tr>
</s:iterator>
</table></td>
</tr>
</table></td>
</tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="6"><img src="../images/spacer.gif" width="1" height="1" /></td>
<s:include value="/common/pager.jsp"></s:include>
</tr>
<tr>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>

</form>
</body>
...全文
256 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
零单 2015-09-01
  • 打赏
  • 举报
回复
引用 1 楼 sessionsong 的回复:
传参的问题 没有给action传参 将 <input name="" type="text" size="12" /> name的值 设为 user.userName 而且 你还哟保证你的action 类中 有 user 的get/set 方法
十分感谢,搞定了
sessinsong 2015-08-31
  • 打赏
  • 举报
回复
传参的问题 没有给action传参 将 <input name="" type="text" size="12" /> name的值 设为 user.userName 而且 你还哟保证你的action 类中 有 user 的get/set 方法

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧