你把actionForm中的reset方法去掉应该就可以
解决方案 »
- 空对象?
- 学软件刚出来的孩子,有点迷茫
- 急·在jsp提交servlet处理后不能跳回发出请求的jsp页面
- 在tomcat+axis2下,new一个socket速度十分慢
- 请教关于Java实现多重继承的面试题?我硬是没有答上来,汗!
- 【急问】如何通过在浏览器中输入wsdl中描述服务的地址调用已经成功发布的webservice方法?
- 删除文件问题,怎么删除网上的文件?
- 来者有分,关于Struts的Filter里面进行数据操作的简单问题!
- java解析xml起步,弱弱的问题,
- Exception in thread "main" java.lang.IllegalArgumentException: input == null!
- 一个一直没人回答出来的问题?
- 问题:hibernate+mysql innodb 数据没有保存到数据库中!!!!
我的form中的reset方法为空,未写。回 xiaopeipei2004(小裴) :
我也这么想,我尝试过在action中form.setDeptid("2"),不成功
/**
* 编辑数据
* @param servletRequest HttpServletRequest
*/
private void edit(HttpServletRequest servletRequest) {
try {
classtypeID = servletRequest.getParameter("classtypeID");
employeesSchema=remote.GetEmployeesByEmployid(classtypeID);
form.setDuty(employeesSchema.getDuty());
form.setSex(employeesSchema.getSex());
form.setState(employeesSchema.getState());
form.setEdudegree(employeesSchema.getEdudegree());
form.setDeptid(employeesSchema.getDeptid());// ××××在这里赋值×××××××
if ("null".equals(employeesSchema.getPhoto()) || null==employeesSchema.getPhoto()) {
employeesSchema.setPhoto("null");
}
servletRequest.setAttribute("action", "edit");
servletRequest.setAttribute("list", employeesSchema);
}
catch (RemoteException ex2) {
}
}form是一个jbuilder生成的,reset和vallidate方法还是空的。STRUTS-CONFIG也是生成的,程序运行正常,应该没问题。大家有这种下拉框的代码发给我看看啊。
public ActionForward addItem(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception { ActionErrors errors = new ActionErrors();
ActionForward forward = new ActionForward();
...................
Rfq_MaterialQueryForm rfq_MaterialQueryForm=new Rfq_MaterialQueryForm();
rfq_MaterialQueryForm.setPriceunit("0");
session.setAttribute("rfq_MaterialQueryForm",rfq_MaterialQueryForm);
这里的”rfq_MaterialQueryForm“一定要和下面Struts-config中的name属性相同
..............
forward=mapping.findForward("toQtyArea");////////////////////////////////////////////////
Struts-config中
<action name="rfq_MaterialQueryForm" path="/rfq_AddItem" type=".....Rfq_AddItemAction" parameter="actionforward">
..........
<forward name="toqtyArea" path="/RFQMA/RFQ_ITEM_Add_QUA.jsp"></forward>
</action>
///////////////////////////////////////
jsp中:
<html:select property="priceunit">
<html:option value="0">1</html:option>
<html:option value="1">100</html:option>
<html:option value="2">1000</html:option>
<html:option value="3">10000</html:option>
</html:select>
多了个value="deptid" 。。 onray(39度) :
就是rfq_MaterialQueryForm.setPriceunit("0");就可以了,不用set form的