Announcement Announcement Module
Collapse
No announcement yet.
Spring JSP form Issue Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring JSP form Issue

    Hello folks

    I have an example from vaannila.com which I am using as a study example.I am trying to fetch data from multiple table and display on the UI.

    This is the JSP form
    Code:
    <title>Registration Page</title>
    </head>
    <body>
    
    <form:form action="add.htm" commandName="user">
    	<table>
    		<tr>
    			<td>User Name :</td>
    			<td><form:input path="name" /></td>
    		</tr>
    		 <tr>
    			<td>Password :</td>
    			<td><form:password path="password" /></td>
    		</tr>
    		
                   <tr>
    			<td>Email :</td>
    			<td><form:input path="email" /></td>
    		</tr>
    							
    		<tr>
    			<td>Gender :</td>
    			<td><form:radiobutton path="gender" value="M" label="M" /> <form:radiobutton
    				path="gender" value="F" label="F" /></td>
    		</tr>
    		
    	</table>
    </form:form>
    This is the POJO class
    Code:
    package com.vaannila.domain;
    
    import javax.persistence.Column;
    import javax.persistence.Entity;
    import javax.persistence.GeneratedValue;
    import javax.persistence.Id;
    import javax.persistence.OneToOne;
    import javax.persistence.CascadeType;
    import javax.persistence.Table;
    
    @Entity
    @Table(name="USER")
    public class User {
    
    	private Long id;
    	private String name;
    	private String password;
    	private String email;
    	private String phone;
    	private String gender;
    	private String country;
    	private String aboutYou;
    	private String[] community;
    	private Boolean mailingList;
    	private UserDetails detail;
    	
    	@Id
    	@GeneratedValue
    	@Column(name="USER_ID")
    	public Long getId() {
    		return id;
    	}
    	
    	public void setId(Long id) {
    		this.id = id;
    	}
    	
    	
    
    	@Column(name="USER_NAME")
    	public String getName() {
    		return name;
    	}
    	public void setName(String name) {
    		this.name = name;
    	}
    	
    	@Column(name="USER_PASSWORD")
    	public String getPassword() {
    		return password;
    	}
    	public void setPassword(String password) {
    		this.password = password;
    	}
    	
    	@Column(name="USER_EMAIL")
    	public String getEmail() {
    		return this.email;
    	}
    	public void setEmail(String email) {
    		this.email = email;
    	}
    	
    	@Column(name="USER_PHONE")
    	public String getPhone() {
    		return phone;
    	}
    	public void setPhone(String phone) {
    		this.phone = phone;
    	}
    	
    	@Column(name="USER_GENDER")
    	public String getGender() {
    		return gender;
    	}
    	public void setGender(String gender) {
    		this.gender = gender;
    	}
    	
    	@Column(name="USER_COUNTRY")
    	public String getCountry() {
    		return country;
    	}
    	public void setCountry(String country) {
    		this.country = country;
    	}
    	
    
    	
    	
    
    }
    But I get an exception when I try to execute the program for the email input property in the form.
    Stacktrace
    Code:
    Feb 2, 2012 11:42:14 AM org.apache.catalina.core.ApplicationDispatcher invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.springframework.beans.NotReadablePropertyException: Invalid property 'email' of bean class [com.vaannila.domain.User]: Bean property 'email' is not readable or has an invalid getter method: Does the return type of the getter match the parameter type of the setter?
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:725)
    	at org.springframework.beans.BeanWrapperImpl.getPropertyValue(BeanWrapperImpl.java:717)
    	at org.springframework.web.servlet.support.BindStatus.<init>(BindStatus.java:147)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getBindStatus(AbstractDataBoundFormElementTag.java:178)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getPropertyPath(AbstractDataBoundFormElementTag.java:198)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.getName(AbstractDataBoundFormElementTag.java:164)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.autogenerateId(AbstractDataBoundFormElementTag.java:151)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.resolveId(AbstractDataBoundFormElementTag.java:142)
    	at org.springframework.web.servlet.tags.form.AbstractDataBoundFormElementTag.writeDefaultAttributes(AbstractDataBoundFormElementTag.java:126)
    	at org.springframework.web.servlet.tags.form.AbstractHtmlElementTag.writeDefaultAttributes(AbstractHtmlElementTag.java:421)
    	at org.springframework.web.servlet.tags.form.InputTag.writeTagContent(InputTag.java:142)
    	at org.springframework.web.servlet.tags.form.AbstractFormTag.doStartTagInternal(AbstractFormTag.java:102)
    	at org.springframework.web.servlet.tags.RequestContextAwareTag.doStartTag(RequestContextAwareTag.java:79)
    	at org.apache.jsp.WEB_002dINF.jsp.userForm_jsp._jspx_meth_form_005finput_005f1(userForm_jsp.java:420)
    	at org.apache.jsp.WEB_002dINF.jsp.userForm_jsp._jspService(userForm_jsp.java:142)
    	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
    	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
    	at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
    	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
    	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
    	at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238)
    	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262)
    	at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1157)
    	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:927)
    	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:827)
    	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:874)
    	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:779)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
    	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
    	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
    	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
    	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
    	at java.lang.Thread.run(Unknown Source)
    I am not sure why i am getting this error
    Please help me over it.

    Regards
    Sachin
Working...
X