Announcement Announcement Module
Collapse
No announcement yet.
Some of input data is not set Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Some of input data is not set

    Some of my input data fields of a form are not set. The following is the form controller code snip:
    Code:
    @Controller
    @RequestMapping("/activity/event/post.htm")
    public class PostEventFormController extends AbstractEventFormController {
    
    	@RequestMapping(method = RequestMethod.GET)
    	public String setupForm(HttpServletRequest request, Model model)
    			throws Exception {
    ...
            }
    
    	@RequestMapping(method = RequestMethod.POST)
    	public String processSubmit(
    			@ModelAttribute("eventForm") EventForm eventForm,
    			BindingResult result, SessionStatus status) {
    ...	
    }
    
    @SessionAttributes(types = EventForm.class)
    abstract public class AbstractEventFormController {
    ...
    }
    and the JSP file:
    Code:
    <form:form modelAttribute="eventForm" cssClass="cssform" name="eventForm">
    	<fieldset>
    	<legend>Event Form</legend> 
    	<p class="first">
    	       	<form:label path="event.name"><fmt:message key="label.name"/>:</form:label>           
            	<form:input path="event.name" />
            	<form:errors path="event.name" cssClass="error" />	
        	</p>
    ...
     	<p>   	
        	    	<input type="submit" value="Submit" name="<fmt:message key="label.submit"/>" />
        	</p>    	        									    	
    	</fieldset>        
    </form:form>
    After inserting loging, I find the setters are not called at all. The getters are called since all initial value are presented correctly in the form. I can't see anything I didn't do right at this point. Any possible causes?
    Last edited by vw729; Aug 24th, 2009, 01:02 PM.

  • #2
    Can someone see a problem here?

    Comment


    • #3
      I've never had any luck using a POST method returning anything. I have almost always had to declare it as void.

      Thus,

      Code:
      public String processSubmit(...) { ... }
      Looks like,

      Code:
      public void processSubmit(..., HttpServletResponse response) {
       ...
       response.sendRedirect("/whatever");
      }

      Comment


      • #4
        Originally posted by jpreston View Post
        I've never had any luck using a POST method returning anything. ...
        I don't have a such problem.

        Comment

        Working...
        X