如何实现点击jSP页面 调用ACTION 然后把ACTION返回的结果集拿到 然后把值给红色的部分。
知道的说下方法 谢谢
ACTION代码:
public String SelectOr(){
String hql="SELECT MAX(sb.sysOrder) FROM SystemBean AS sb";
systemBeanDao.SelectOrd(hql);
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("systemBean",systemBeanDao.SelectOrd(hql));
return SUCCESS;
}
JSP页面
<body oncontextmenu="window.event.returnValue=false">
<div id="addSysForm">
<form action="addItem.action" method="post" name="sysForm">
<table align="center" border="0" cellpadding="2" cellspacing="1" class="formTable">
<input type="hidden" name="whichTypeSub" value="sys"/>
<tr>
<th colspan="2">添加系统表单</th>
</tr>
<tr>
<td>
<s:textfield label="请输入系统顺序" name="systemBean.sysOrder" value="#{sysOrder}"></s:textfield>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="image" alt="" src="../images/login_b.gif" onclick="sub('sysForm')"/>
</td>
</tr>
</table>
</form>
</div>
</body>
知道的说下方法 谢谢
ACTION代码:
public String SelectOr(){
String hql="SELECT MAX(sb.sysOrder) FROM SystemBean AS sb";
systemBeanDao.SelectOrd(hql);
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("systemBean",systemBeanDao.SelectOrd(hql));
return SUCCESS;
}
JSP页面
<body oncontextmenu="window.event.returnValue=false">
<div id="addSysForm">
<form action="addItem.action" method="post" name="sysForm">
<table align="center" border="0" cellpadding="2" cellspacing="1" class="formTable">
<input type="hidden" name="whichTypeSub" value="sys"/>
<tr>
<th colspan="2">添加系统表单</th>
</tr>
<tr>
<td>
<s:textfield label="请输入系统顺序" name="systemBean.sysOrder" value="#{sysOrder}"></s:textfield>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<input type="image" alt="" src="../images/login_b.gif" onclick="sub('sysForm')"/>
</td>
</tr>
</table>
</form>
</div>
</body>
解决方案 »
- 诡异的xml转换异常,在网上找不到答案,希望这里有达人能帮忙解决
- Cannot get a connection,pool error Timeout waiting for idle object
- 收入
- Struts2 s:select标签 list listKey listValue Stream closed
- 用过lucene的请进来,谁有 lucen in action 书的示例代码,请发一个给我把
- 订单生成判断是否 付款
- 【ofbiz】从svn检出源码之后,怎么没有看到.sql文件? 创建表的数据库脚本文件在哪儿啊?ofbiz到底是怎么创建表和数据库的?
- tomcat5.0.14 中文的乱码的问题
- 有个问题,奇怪,关于下载j2ee sdk
- 请问如何保护JAVA源代码
- 大家都来看看!分不多! 拜托各位!
- 做过邮件开发的请进,谢谢。。。。。。。。。。。。。。。。。。。。。分不是问题!【标题要长】
private String sysOrder;
public viod setSysOrder(String str){
this.sysOrder=str;
}
public String getSysOrder(){
return this.sysOrder;
}
public String SelectOr(){
String hql="SELECT MAX(sb.sysOrder) FROM SystemBean AS sb";
sysOrder=systemBeanDao.SelectOrd(hql);
HttpServletRequest request = ServletActionContext.getRequest();
request.setAttribute("systemBean",sysOrder);
return SUCCESS;
}在struts.xml的配置文件中,addItem的action的success对应的视图还是该JSP。<s:textfield label="请输入系统顺序" name="systemBean.sysOrder" value="%{sysOrder}"></s:textfield>
把该jsp页面作为那个action的result结果返回集,把结果返回就可以了
private String sysOrder;
public viod setSysOrder(String str){
this.sysOrder=str;
}
public String getSysOrder(){
return this.sysOrder;
}
这个BEAN 也是存在的