2 q15914507783 q15914507783 于 2015.06.08 10:29 提问

Java Struts2 框架页面传参问题就

jsp页面 这是动态生成 拼接的代码

if($(v).attr("checked")){
var shufeidiv=$("#shoufei_"+id).html();
if(shufeidiv==null||shufeidiv==""){
var shoufieDetails=$("#shoufieDetails");
var div0=shoufieDetails.html();
div0+="

";
div0+=""+name+"";
div0+="";
div0+="";
div0+="";
div0+="";
div0+="";
div0+="";
div0+="";
div0+="
"+name+"率:";
div0+='';
div0+="";
div0+="
费率计算天数:";
div0+="";
div0+="请选择...";
div0+="";
div0+="
";
div0+="
";
alert(div0);
shoufieDetails.html(div0);
make_select_data(6,'tianshu'+id);
index++;
}
action 代码 :

@Controller("addFundInvestAction")
@Scope("prototype")
public class AddFundInvestAction extends BaseSupportAction {
/**
*
*/
private static final long serialVersionUID = 1L;
@Autowired
FundInvestService fundInvestService;
@Autowired
private FundProjectService fundProjectService;
FundInvest fundInvest;//基金对象
List fAccount=new ArrayList(); //这是页面传来的集合
@Override
public String _execute() throws Exception {
    //投资所属产品
    FundProject fundProject = fundProjectService.findFundProjectById(Long.valueOf(23713));
    FundUtil.setNullWhenDataValueIdIsNull(fundInvest);
    FundUtil.setNullWhenDataValueIdIsNull(fundProject);
    fundInvest.setFundInvestAccounts(new HashSet<FundInvestAccount>(fAccount));
    fundInvest.setFundProject(fundProject);
    DataValue tzzt = new DataValue();
    tzzt.setDataValueId(Long.valueOf(7306));
    fundInvest.setTzzt(tzzt);
    fundInvestService.addFundInvest(fundInvest);
    return Action.SUCCESS;
}

提交表单的时候报错:
2015-06-08 10:28:18,948 [http-8080-1] WARN [com.opensymphony.xwork2.ognl.OgnlValueStack] - Error setting expression 'fAccount[0].costtypepart.costTypePartID' with value '[Ljava.lang.String;@189e397'
ognl.OgnlException: source is null for getProperty(null, "0")

2015-06-08 10:28:18,958 [http-8080-1] WARN [com.opensymphony.xwork2.ognl.OgnlValueStack] - Error setting expression 'fAccount[0].feilv' with value '[Ljava.lang.String;@671e1'
ognl.OgnlException: source is null for getProperty(null, "0")

2015-06-08 10:28:18,961 [http-8080-1] WARN [com.opensymphony.xwork2.ognl.OgnlValueStack] - Error setting expression 'fAccount[0].jsts.dataValueId' with value '[Ljava.lang.String;@1ccc63'
ognl.OgnlException: source is null for getProperty(null, "0")

2个回答

qq_16168871
qq_16168871   2015.06.08 10:37

你一步一步调试一下嘛,看看在哪儿出错了。

baidu_25310663
baidu_25310663   2015.06.08 13:29

字符串拼的有问题,你调试一下

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!