笑春风 发表于 2017-10-10 17:54:51

自定义页面和Controller类,获取页面组件值报错问题

自定义了一个页面和Controller类,在后台Controller类使用request.getParameter("")获取页面组件值时页面报错。
请问,这种情况如何不用实体类,直接获取页面组件的值?

自定义页面主要代码:
<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<t:base type="jquery,easyui,tools,DatePicker,autocomplete"></t:base>
<script type="text/javascript">
function cancelLib(){
document.ff.action = "djxqAdjustController.do?doCancel";
document.getElementById("ff").submit();
}
function saveLib(){
document.ff.action = "djxqAdjustController.do?doSave";
document.getElementById("ff").submit();
}
</script>
    <div title="抽签内容指定" style="height:350px;" name="editPanel" id="editPanel" fit="true" class="easyui-panel">   
<t:formvalid formid="ff" dialog="true" layout="table" tiptype="4" action="djxqAdjustController.do?doSave">
   <table style="width: 600px;" cellpadding="0" cellspacing="1" class="formtable">
    <thead>
   <tr><th>库类型</th><th>指定企业编号</th></tr>
    </thead>
    <tbody>
   <tr>
      <td class="value" align="center">      
      造价咨询库
      </td>
      <td class="value">
       <inputid="djxq_cost_lib" name="djxq_cost_lib"placeholder="点击选择企业" type="text" style="cursor: pointer;" class="inputxt" value="">      
      </td>
   </tr>   <tr>
      <td class="value" align="center">      
       <button type="button" id="but_cancel" class="width-35">
                            <span class="bigger-110" >取消</span>
                         </button>
      </td>
      <td class="value">
       <button type="button" id="but_save" class="width-35">
                            <span class="bigger-110" >保存</span>
                         </button>      
      </td>
   </tr>
    </tbody>
   </table>
</t:formvalid>

    </div>

file:///
Controller类主要代码:
package com.jeecg.adjust.controller;
@Controller
@RequestMapping("/djxqAdjustController")
public class DjxqAdjustController extends BaseController {
private static final Logger logger = Logger.getLogger(JeecgFormDemoController.class);

@Autowired
private SystemService systemService;
@Autowired
private DjxqCostLibServiceI djxqCostLibService;

@RequestMapping(params = "djxqAdjustAdd")
public ModelAndView djxqAdjustAdd(HttpServletRequest request) {
logger.info("djxqAdjustAdd");
//return new ModelAndView("com/jeecg/demo/form_popupMultiValue");
return new ModelAndView("com/jeecg/adjust/djxqAdjust-add");
}

@RequestMapping(params = "doSave")
@ResponseBody
public AjaxJson doSave(HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "保存指定企业信息成功";
try{
   String djxq_cost_lib = request.getParameter("djxq_cost_lib");//造价咨询库
   System.out.println("djxq_cost_lib = "+ djxq_cost_lib);   
}catch(Exception e){
   e.printStackTrace();
   message = "保存指定企业信息失败";
   throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}

@RequestMapping(params = "doCancel")
@ResponseBody
public AjaxJson doCancel(HttpServletRequest request) {
String message = null;
AjaxJson j = new AjaxJson();
message = "取消指定企业信息成功";
try{
}catch(Exception e){
   e.printStackTrace();
   message = "取消指定企业信息失败";
   throw new BusinessException(e.getMessage());
}
j.setMsg(message);
return j;
}
}

错误信息:
Parameter conditions "djxqAdjustAdd" not met for actual request parameters: doSave={}, djxq_cost_lib={3, 3}, djxq_est_lib={1, 1}, djxq_acc_lib={1, 1}, djxq_cap_lib={}, djxq_land_lib={}
错误信息:
org.springframework.web.bind.UnsatisfiedServletRequestParameterException: Parameter conditions "djxqAdjustAdd" not met for actual request parameters: doSave={}, djxq_cost_lib={3, 3}, djxq_est_lib={1, 1}, djxq_acc_lib={1, 1}, djxq_cap_lib={}, djxq_land_lib={}

笑春风 发表于 2017-10-10 19:28:28

jeecg版本为3.7.1
 <t:formvalid>跟Controller类如何能不通过实体类,通过简单的方式传递页面组件的值?
自己顶顶,希望大神帮忙给解答一下,或给个参考的例子,谢谢!

笑春风 发表于 2017-10-11 11:00:25

自己顶顶,希望大神帮忙给解答一下,或给个参考的例子,谢谢!

笑春风 发表于 2017-10-11 13:43:49

自己顶顶,希望大神帮忙给解答一下,或给个参考的例子,谢谢!

admin 发表于 2017-10-11 15:31:32

jeecg默认的表单功能都是现成的,你为什么要自己实现提交?

笑春风 发表于 2017-10-11 16:34:45

我要实现的这个功能不需要对应的实体类,值的修改不存储在数据库中。数据结构想用多个字符串或Map,不是实体类。

admin 发表于 2017-10-12 19:20:05

那就别用<t:formvalid 标签,自己实现form
页: [1]
查看完整版本: 自定义页面和Controller类,获取页面组件值报错问题