简体   繁体   English

Bean属性“ cmpcode”不可读或具有无效的getter方法:getter的返回类型是否与setter的参数类型匹配?

[英]Bean property 'cmpcode' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?

I am getting following error in my 'cmpmstaddedit.jsp': 我的'cmpmstaddedit.jsp'中出现以下错误:

org.springframework.beans.NotReadablePropertyException: Invalid property 'cmpcode' of bean class [java.util.ArrayList]: Bean property 'cmpcode' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? org.springframework.beans.NotReadablePropertyException:Bean类[java.util.ArrayList]的无效属性'cmpcode':Bean属性'cmpcode'不可读或具有无效的getter方法:getter的返回类型是否与参数类型匹配二传手? org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:725) org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:716) org.springframework.web.servlet.support.BindStatus.(BindStatus.java:149) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:141) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:132) org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBound org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:725)org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:716)org.springframework.web.servlet.support.BindStatus。(BindStatus.java:149 )org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:168)org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:188)org.springframework.web .servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:154)org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:141)org.springframework.web.servlet.tags.form .AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:132)org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBound FormElementTag.java:116) org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:422) org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142) org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84) org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80) org.apache.jsp.WEB_002dINF.views.admin.cmpmstmgmt_jsp._jspx_meth_form_005finput_005f0(cmpmstmgmt_jsp.java:330) org.apache.jsp.WEB_002dINF.views.admin.cmpmstmgmt_jsp._jspx_meth_form_005fform_005f0(cmpmstmgmt_jsp.java:269) org.apache.jsp.WEB_002dINF.views.admin.cmpmstmgmt_jsp._jspService(cmpmstmgmt_jsp.java:123) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432) org.apache.jasper.servlet.JspServlet.servic FormElementTag.java:116)org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:422)org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142) org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:84)org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:80)org.apache.jsp.WEB_002dINF。 views.admin.cmpmstmgmt_jsp._jspx_meth_form_005finput_005f0(cmpmstmgmt_jsp.java:330)org.apache.jsp.WEB_002dINF.views.admin.cmpmstmgmt_jsp._jspx_meth_form_005fform_005f0(cmpmstmgmt.js.admin.p.ap.ache.ache。 _jspService(cmpmstmgmt_jsp.java:123)org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)javax.servlet.http.HttpServlet.service(HttpServlet.java:725)org.apache.jasper.servlet。 JspServletWrapper.service(JspServletWrapper.java:432)org.apache.jasper.servlet.JspServlet.servic eJspFile(JspServlet.java:403) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:267) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:952) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) javax.servlet.http.HttpServlet.service(Htt eJspFile(JspServlet.java:403)org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)javax.servlet.http.HttpServlet.service(HttpServlet.java:725)org.apache.tomcat.websocket。 server.WsFilter.doFilter(WsFilter.java:52)org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209)org.springframework.web.servlet.view.AbstractView.render(AbstractView.java: 267)org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1217)org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1005)org.springframework.web.servlet.DispatcherServlet.doDispatch( DispatcherServlet.java:952)org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)org.springframework.web.servlet。 FrameworkServlet.doGet(FrameworkServlet.java:852)javax.servlet.http.HttpServlet.service(Htt pServlet.java:618) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) javax.servlet.http.HttpServlet.service(HttpServlet.java:725) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118) org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter. pServlet.java:618)org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)javax.servlet.http.HttpServlet.service(HttpServlet.java:725)org.apache.tomcat.websocket.server。 WsFilter.doFilter(WsFilter.java:52)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:330)org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java: 118)org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security。 web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter。 java:103) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199) org.springframework.security.web.FilterChai java:103)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)org.springframework.security。 web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy。 java:342)org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security。 web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)org.springframework.security.web.FilterChai nProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:85) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87) org.springframework.secu nProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy。 java:342)org.springframework.security.web.csrf.CsrfFilter.doFilterInternal(CsrfFilter.java:85)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)org.springframework.security.web。 FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)org.springframework.secu rity.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342) org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192) org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261) rity.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)org.springframework.web.filter.OncePerRequestFilter。 doFilter(OncePerRequestFilter.java:108)org.springframework.security.web.FilterChainProxy $ VirtualFilterChain.doFilter(FilterChainProxy.java:342)org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)org.springframework。 security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

The file 'cmpmstaddedit.jsp' is as below: 文件“ cmpmstaddedit.jsp”如下:

<%-- 
    Document   : cmpmstaddedit
    Created on : Aug 3, 2014, 1:18:10 PM
--%>

<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:url var="actionUrl" value="save" />

<form:form id="cmpmstForm" commandName="cmpmsts" method="post" action="${actionUrl}" class="pure-form pure-form-aligned">
    <fieldset>
        <legend></legend>
        <div class="pure-control-group">
            <label for="cmpcode">Code</label>
            <form:input path="cmpcode" placeholder="Company Code" maxlength="15" />
        </div>
        <div class="pure-control-group">
            <label for="cmpdescr">Price</label>
            <form:input path="cmpdescr" placeholder="Company Description" maxlength="30" />
        </div>
        <div class="pure-control-group">
            <label for="cmpfybegin">Price</label>
            <form:input path="cmpfybegin" placeholder="F.Y. Begin Date" maxlength="15" />
        </div>
        <div class="pure-control-group">
            <label for="cmpfyend">Price</label>
            <form:input path="cmpfyend" placeholder="F.Y. End Date" maxlength="15" />
        </div>
    </fieldset>
</form:form>

My model file 'CmpMst.java' is as below: 我的模型文件'CmpMst.java'如下:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.nej.cmpmst.model;

/**
 *
 */
import java.util.Date;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name="cmpmst", catalog = "nioerpj")
public class CmpMst {

    @Id
    private Byte cmpcode;
    private String cmpdescr;
    private Date cmpfybegin;
    private Date cmpfyend;

    public Byte getCmpcode() {
        return cmpcode;
    }
    public void setCmpcode(Byte cmpcode) {
        this.cmpcode = cmpcode;
    }

    public String getCmpdescr() {
        return cmpdescr;
    }
    public void setCmpdescr(String cmpdescr) {
        this.cmpdescr = cmpdescr;
    }

    public Date getCmpfybegin() {
        return cmpfybegin;
    }
    public void setCmpfybegin(Date cmpfybegin) {
        this.cmpfybegin = cmpfybegin;
    }

    public Date getCmpfyend() {
        return cmpfyend;
    }
    public void setCmpfyend(Date cmpfyend) {
        this.cmpfyend = cmpfyend;
    }

}

I have searched the internet and found many similar cases, however, even after applying the given solution doesn't resolved my issue. 我搜索了互联网,发现了许多类似的案例,但是即使使用了给定的解决方案也无法解决我的问题。 Can somebody help solving an issue? 有人可以帮助解决问题吗? Do I need to upload any other file to arrive at a conclusion? 我是否需要上传其他文件才能得出结论?

EDIT: 编辑:

My Controller File CmpMstController.java is as below: 我的控制器文件CmpMstController.java如下所示:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.nej.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.nej.cmpmst.model.CmpMst;
import com.nej.cmpmst.service.CmpMstService;

/**
 *
 */
@Controller
@RequestMapping(value={"/admin/cmpmstmgmt"})
public class CmpMstController {

    @Autowired
    private CmpMstService cmpmstService;

    @RequestMapping(value="/add", method=RequestMethod.GET)
    public ModelAndView addCmpMstPage() {
        ModelAndView modelAndView = new ModelAndView("CmpMst-add");
        modelAndView.addObject("cmpmstmgmt", new CmpMst());
        return modelAndView;
    }

    @RequestMapping(value="/add", method=RequestMethod.POST)
    public ModelAndView addingCmpMst(@ModelAttribute CmpMst cmpmst) {
        ModelAndView modelAndView = new ModelAndView("cmpmstmgmt");
        cmpmstService.addCmpMst(cmpmst);
        String message = "CmpMst was successfully added.";
        modelAndView.addObject("message", message);
        return modelAndView;
    }

    @RequestMapping(value={"/list","/"})
    public ModelAndView listOfCmpMsts() {
        ModelAndView modelAndView = new ModelAndView("/admin/cmpmstmgmt");
        List<CmpMst> cmpmsts = cmpmstService.getCmpMsts();
        modelAndView.addObject("cmpmsts", cmpmsts);
        return modelAndView;
    }

    @RequestMapping(value="/edit/{cmpcode}", method=RequestMethod.GET)
    public ModelAndView editCmpMstPage(@PathVariable Byte cmpcode) {
        ModelAndView modelAndView = new ModelAndView("cmpmstmgmt");
        CmpMst cmpmst = cmpmstService.getCmpMst(cmpcode);
        modelAndView.addObject("cmpmst",cmpmst);
        return modelAndView;
    }

    @RequestMapping(value="/edit/{cmpcode}", method=RequestMethod.POST)
    public ModelAndView editingCmpMst(@ModelAttribute CmpMst cmpmst, @PathVariable Byte cmpcode) {
        ModelAndView modelAndView = new ModelAndView("cmpmstmgmt");
        cmpmstService.updateCmpMst(cmpmst);
        String message = "CmpMst was successfully edited.";
        modelAndView.addObject("message", message);
        return modelAndView;
    }

    @RequestMapping(value="/delete/{cmpcode}", method=RequestMethod.GET)
    public ModelAndView deleteCmpMst(@PathVariable Byte cmpcode) {
        ModelAndView modelAndView = new ModelAndView("cmpmstmgmt");
        cmpmstService.deleteCmpMst(cmpcode);
        String message = "CmpMst was successfully deleted.";
        modelAndView.addObject("message", message);
        return modelAndView;
    }
}

My cmpmstmgmt.jsp is as below: 我的cmpmstmgmt.jsp如下:

<%-- 
    Document   : cmpmstmgmt
    Created on : Jul 26, 2014, 6:00:28 PM
    Author     : Tushar
--%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<tiles:insertDefinition name="defaultTemplate">
    <tiles:putAttribute name="body"> 

    <link rel="stylesheet" href='<c:url value="../../../resources/mytheme/styles/pure-0.4.2.css"/>'>
    <link rel="stylesheet" href='<c:url value="../../../resources/mytheme/styles/jquery-ui.css"/>'>
    <style type="text/css">
    th {
        text-align: left
    }
    </style>

    <div class="body">

    <div style="width: 95%; margin: 0 auto;">
    <div id="bookDialog" style="display: none;">
        <%@ include file="cmpmstaddedit.jsp"%>
    </div>
    <h1>List Of Company Master</h1>
    <button class="pure-button pure-button-primary" onclick="addCmpMst()">
        <i class="fa fa-plus"></i> Add Company Master
    </button>
    <br>
        <table class="pure-table pure-table-bordered pure-tablestriped">
            <thead>
                <tr>
                    <th width="4%">Sr.No.</th>
                    <th width="12%">Code</th>
                    <th width="12%">Company Description</th>
                    <th width="12%">F.Y. Begin Date</th>
                    <th width="12%">F.Y. End Date</th>
                    <th width="12%"></th>
                </tr>
            </thead>
            <tbody>
                <c:forEach items="${cmpmst}" var="user" varStatus="loopCounter">
                    <tr>
                        <td><c:out value="${loopCounter.count}" /></td>
                        <td><c:out value="${cmpmst.cmpcode}" /></td>
                        <td><c:out value="${cmpmst.cmpdescr}" /></td>
                        <td><c:out value="${cmpmst.cmpfybegin}" /></td>
                        <td><c:out value="${cmpmst.cmpfyend}" /></td>
                        <td>
                            <nobr>
                                <button onclick="editCmpMst(${cmpmst.cmpcode});"
                                    class="pure-button pure-buttonprimary">
                                    <i class="fa fa-pencil"></i> Edit
                                </button>
                                <a href="delete/${cmpmst.cmpcode}" class="pure-button pure-button-primary" onclick="return confirm('Are you sure you want to delete this CmpMst?');">
                                    <i class="fa fa-times"></i>Delete
                                </a>
                                </nobr>
                        </td>
                    </tr>
                </c:forEach>
            </tbody>
        </table>
    </div>
<!-- It is advised to put the <script> tags at the end of the document body so that they don't block rendering of the page -->
    <script type="text/javascript" src='<c:url value="../../../resources/mytheme/script/jquery.js" />'></script>
    <script type="text/javascript" src='<c:url value="../../../resources/mytheme/script/jquery-ui.js" />'></script>
    <script type="text/javascript" src='<c:url value="../../../resources/mytheme/script/js-for-listuser.js"/>'></script>
    </div>

    </tiles:putAttribute>
</tiles:insertDefinition>

I have uploaded controller file - CmpMstController.java and cmpmstmgmt.jsp file as above. 我已经上传了控制器文件-CmpMstController.java和cmpmstmgmt.jsp文件,如上所述。 Please suggest correction. 请提出更正建议。

type Exception report

message An exception occurred processing JSP page /WEB-INF/views/admin/cmpmstaddedit.jsp at line 16

description The server encountered an internal error that prevented it from fulfilling this request.

exception
org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/views/admin/cmpmstaddedit.jsp at line 16

13:         <legend></legend>
14:         <div class="pure-control-group">
15:             <label for="cmpcode">Code</label>
16:             <form:input path="cmpcode" placeholder="Company Code" maxlength="15" />
17:         </div>
18:         <div class="pure-control-group">
19:             <label for="cmpdescr">Company Description</label>

EDIT: File - js-for-listcmpmst.js 编辑:文件-js-for-listcmpmst.js

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

function addCmpMst() {
$('#cmpmstDialog').dialog("option", "title", 'Add Company');
$('#cmpmstDialog').dialog('open');
}
function editCmpMst(cmpcode) {
$.get("get/" + cmpcode, function(result) {
$("#cmpmstDialog").html(result);
$('#cmpmstDialog').dialog("option", "title", 'Edit Company');
$("#cmpmstDialog").dialog('open');
initializeDatePicker();
});
}
function initializeDatePicker() {
$(".datepicker").datepicker({
dateFormat : "dd/mm/yyyy",
changeMonth : true,
changeYear : true,
showButtonPanel : true
});
}
function resetDialog(form) {
form.find("input").val("");
}
$(document).ready(function() {
$('#cmpmstDialog').dialog({
autoOpen : false,
position : 'center',
modal : true,
resizable : false,
width : 440,
buttons : {
"Save" : function() {
    $('#cmpmstForm').submit();
    },
"Cancel" : function() {
    $(this).dialog('close');
    }
},
close : function() {
    resetDialog($('#cmpmstForm'));
    $(this).dialog('close');
    }
});
initializeDatePicker();
});

Edited Controller file: 编辑的控制器文件:

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.nej.controller;

import com.nej.cmpmst.model.CmpMst;
import com.nej.cmpmst.service.CmpMstService;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 *
 * @author Tushar
 */
@Controller
@RequestMapping(value={"/admin/cmpmstmgmt"})
public class CmpMstController {

    @Autowired
    private CmpMstService cmpmstService;


    @RequestMapping(value={"/list","/"})
    public String listOfCmpMsts(Map<String, Object> map ) {
        map.put("cmpmst", new CmpMst());

        map.put("cmpmstList", cmpmstService.getCmpMsts());

        return "/admin/cmpmstmgmt";
    }

    @RequestMapping("get/{cmpcode}")
    public String getCmpMst(@PathVariable Byte cmpcode, Map<String, Object> map) {
        CmpMst cmpmst = cmpmstService.getCmpMst(cmpcode);

        map.put("cmpmst", cmpmst);

        return "admin/cmpmstaddedit";
    }

    @RequestMapping(value="/save", method = RequestMethod.POST)
    public String saveCmpMst(@ModelAttribute("cmpmst") CmpMst cmpmst, BindingResult result) {
        cmpmstService.saveCmpMst(cmpmst);

        return "redirect:list";
    }

    @RequestMapping("/delete/{cmpcode}")
    public String deleteCmpMst(@PathVariable("cmpcode") Byte cmpcode) {
        cmpmstService.deleteCmpMst(cmpcode);

        return "redirect:/admin/cmpmstmgmt/";
    }


}

cmpmstaddedit.jsp cmpmstaddedit.jsp

<%-- 
    Document   : cmpmstaddedit
    Created on : Aug 3, 2014, 1:18:10 PM
    Author     : Tushar
--%>

<%@ taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<c:url var="actionUrl" value="save" />

<form:form id="cmpmstaddedit" commandName="cmpmst" method="post" action="${actionUrl}" class="pure-form pure-form-aligned">
    <fieldset>
        <legend></legend>
        <div class="pure-control-group">
            <label for="cmpcode">Code</label>
            <form:input path="cmpcode" placeholder="Company Code" maxlength="15" />
        </div>
        <div class="pure-control-group">
            <label for="cmpdescr">Company Description</label>
            <form:input path="cmpdescr" placeholder="Company Description" maxlength="30" />
        </div>
        <div class="pure-control-group">
            <label for="cmpfybegin">F.Y. Begin Date</label>
            <form:input path="cmpfybegin" placeholder="DD/MM/YYYY" class="datepicker" />
        </div>
        <div class="pure-control-group">
            <label for="cmpfyend">F.Y. End Date</label>
            <form:input path="cmpfyend" placeholder="DD/MM/YYYY" class="datepicker" />
        </div>
    </fieldset>
</form:form>

In the JSP file you have : 在JSP文件中,您可以:

<c:forEach items="${cmpmst}" var="user" varStatus="loopCounter">
    <tr>
        <td><c:out value="${loopCounter.count}" /></td>
        <td><c:out value="${cmpmst.cmpcode}" /></td>

while ${cmpmst} is an array . ${cmpmst}是一个数组 You should write instead : 您应该改写:

<c:forEach items="${cmpmst}" var="user" varStatus="loopCounter">
    <tr>
        <td><c:out value="${loopCounter.count}" /></td>
        <td><c:out value="${user.cmpcode}" /></td>

and same for following fields 和以下字段相同

I could not see how and where you forward to cmpmstaddedit.jsp in shown controller, but I assume that cmpmsts is also a list. 我看不到如何在显示的控制器中转发到cmpmstaddedit.jsp方式和位置,但我认为cmpmsts也是一个列表。 You must ensure that you put a single object as request attribute before forwarding to that view. 您必须确保在转发到该视图之前将单个对象作为请求属性。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Bean属性&#39;xxxx不可读或具有无效的getter方法:getter的返回类型是否与setter的参数类型匹配 - Bean property 'xxxx is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter Bean 属性 &#39;xxx&#39; 不可读或具有无效的 getter 方法:getter 的返回类型是否与 setter 的参数类型匹配? - Bean property 'xxx' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? Spring MVC:Bean属性不可读或具有无效的getter方法getter的返回类型是否与setter的参数类型匹配 - Spring MVC: Bean property is not readable or has an invalid getter method Does the return type of the getter match the parameter type of the setter Bean属性不可读或具有无效的getter方法:getter的返回类型是否与setter的参数类型匹配? 春季批 - Bean property is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter? Spring Batch Bean属性“ trustStore”不可写或具有无效的setter方法。 setter的参数类型是否与getter的返回类型匹配? - Bean property 'trustStore' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? Bean 属性 'sakilaDao' 不可写或具有无效的 setter 方法。 setter 的参数类型是否与 getter 的返回类型匹配? - Bean property 'sakilaDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter? Bean类的无效属性&#39;id&#39;:Bean属性&#39;id&#39;不可读或具有无效的getter方法:getter的返回类型是否匹配 - Invalid property 'id' of bean class: Bean property 'id' is not readable or has an invalid getter method: Does the return type of the getter match 在 Thymeleaf 模板中使用 @ManyToOne 值 - 属性 '' 不可读或具有无效的 getter 方法 - Using @ManyToOne value in Thymeleaf template - property '' is not readable or has an invalid getter method Does the return type of the getter Bean属性不可读或具有无效的getter方法 - Bean property is not readable or has an invalid getter method setter的参数类型是否与getter的返回类型匹配? - Does the parameter type of the setter match the return type of the getter?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM