日期:2014-05-20  浏览次数:20700 次

请教,我的actionform怎么拿不到属性字段里的值。拿的全是空值null
//我的actionform
package com.struts.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;

import com.crm.hibernate.SalChance;

/** 
 * MyEclipse Struts
 * Creation date: 07-08-2008
 * 
 * XDoclet definition:
 * @struts.form name="saleInfoForm"
 */
public class SaleInfoForm extends ActionForm {
/*
* Generated fields
*/

/** chc_linkman property */


/*
* Generated Methods
*/
private SalChance salechance = new SalChance();/*实例化了个SalChance 类*/
public SalChance getSalechance() {
return salechance;
}

public void setSalechance(SalChance salechance) {
this.salechance = salechance;
}

/** 
* Method validate
* @param mapping
* @param request
* @return ActionErrors
*/
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
// TODO Auto-generated method stub
return null;
}

/** 
* Method reset
* @param mapping
* @param request
*/
public void reset(ActionMapping mapping, HttpServletRequest request) {
// TODO Auto-generated method stub
}

/** 
* Returns the chc_linkman.
* @return String
*/

}

/-----------------------
/*查询方法,次方法能让我获得对象并传到页面,页面属性值也能显示*/
public ActionForward doselect(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response) {
// TODO Auto-generated method stub
SaleInfoForm saleForm = (SaleInfoForm) form;
String chc_id = request.getParameter("id");
SalChance sce = service.findbyid(Long.parseLong(chc_id));
saleForm.setSalechance(sce);
request.setAttribute("saleForm", saleForm);
  return mapping.findForward("upsale");
}



/*jsp页面,此页面的property都能从上面的doselect方法中获得值*/
<html:form action="/saleInfo.do?op=dosave" >
<table class="query_form_table">
<tr>
<th>
编号
</th>
<td>
<html:text property="salechance.chcId" />
</td>
<th>
机会来源
</th>
<td>
<html:text property="salechance.chcSource" />
</td>
</tr>
<tr>
<th>
客户名称
</th>
<td>
<html:text property="salechance.chcCustName" />
<span class="red_star">*</span>
</td>
<th>
成功机率(%)
</th>
<td>
<html:text property="salechance.chcRate" />
<span class="red_star">*</span>
</td>
</tr>
<tr>
<th>
概要
</th>
<td colspan="3">
<html:text property="salechance.chcTitle" />
<span class="red_star">*</span>
</td>
</tr>
<tr>
<th>
联系人
</th>
<td>
<html:text property="salechance.chcLinkman" />
</td>
<th>
联系人电话
</th>
<td>
<html:text property="salechance.chcTel" />
</td>
</tr>
<tr>
<th>
机会描述