NutzCN Logo
问答 view返回数据问题
发布于 2831天前 作者 qq_152b6ff2 1858 次浏览 复制 上一个帖子 下一个帖子
标签:

通过创建companyInfo对象时判断nmSqbId是否为空 空值时创建序列 创建完插入数据库时是有nmSqbId 但是用view的话该如何再传到前台接受呢

/**
	 * 保存主体信息
	 * @param companyInfo
	 * @param session
	 * @return
	 */
	@At
	public View saveCompanyInfo(@Param("::companyInfo.")QfgCompanyInfo companyInfo,@Param("nmSqbId")Integer nmSqbId, HttpSession session) throws Exception{
		if(null == companyInfo.getNmCompanyId()){
			if(companyInfo.getNmSqbId()==null){
				Sql sql = Sqls.create("SELECT SEQ_QFG_PROJECT_INFO.nextval as nmSqbId FROM DUAL");
			    sql.setCallback(new SqlCallback() {
			        public Object invoke(Connection conn, ResultSet rs, Sql sql) throws SQLException {
			        	Integer sqbId = null;		            
			        	while (rs.next())
			        		sqbId = (rs.getInt("nmSqbId"));
			            return sqbId;
			        }
			    });
			    dao.execute(sql);
			    int sqbId = sql.getInt();
			    companyInfo.setNmSqbId(sqbId);
			}
		    try {
				wondersDao.insert(companyInfo, session);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}else{
			//修改保存
			QfgCompanyInfo companyInfoInDb = dao.fetch(QfgCompanyInfo.class, companyInfo.getNmCompanyId());
			BeanUtils.copyProperties(companyInfoInDb, companyInfo);
			wondersDao.update(companyInfoInDb,session);
		}
		return new ServerRedirectView("/designRequire/companyInfoList?nmSqbId=" + companyInfo.getNmSqbId());
	}
5 回复
$("#editCompanyInfoForm").Validform({
		btnSubmit:"#companyInfoSubmitButton",
		tiptype:1,
		datatype:{
			"sfzh":function(gets,obj,curform,regxp){
			/*参数gets是获取到的表单元素值,
		  	obj为当前表单元素,
		  	curform为当前验证的表单,
		  	regxp为内置的一些正则表达式的引用。*/
			var flag = checkIdCard(gets);
			return flag;
			}
		},
		submitFunction:function(form){
			$("#black_bg").hide();
	    	$(".black_bg_table").hide();
			return formSubmit("editCompanyInfoForm","companyInfoList");
		}
	});
<h5>申报主体信息
	<a href="javascript:void(0);" onclick="addCompanyInfo();">
		<img src="${ctx}/tiles/UI/images/icon_032.png" />新增
	</a>
</h5>
function addCompanyInfo(){
		$("#companyInfoForm #companyId").val("");
		formSubmit("companyInfoForm","companyInfo");
	}
<form id="companyInfoForm" method="post" action="${ctx}/designRequire/editCompanyInfo">
	<input type="hidden" name="nmSqbId" value="${obj.nmSqbId}"/>
	<input type="hidden" id="companyId" name="nmCompanyId">
</form>
<div id="companyInfo"></div>

ServerRedirectView是302, 哪还有前台接收的问题?? 都页面跳转了

跳转的页面是当前页面呀 就是增加了一个查询 但是之后要用nmSqbId进行修改操作的。

添加回复
请先登陆
回到顶部