Results 1 to 3 of 3

Thread: Which controller should I choose

  1. #1
    Join Date
    Sep 2008
    Posts
    2

    Default Which controller should I choose

    Hello,

    I'm implementing a survey form in spring mvc. The questions of the survey form are generated dynamically though DAO so I cannot use a static jsp view page for displaying the form. I dont if the simpleFormController class can allow me to send models to the formview in order to generate the form and them process the data inputed by using onsubmit() method. Will appreciate if anyone give me a clue. Thanks!

  2. #2
    Join Date
    Aug 2008
    Location
    St Louis, MO
    Posts
    51

    Default

    Yes, just override the formBackingObject method where you can retrieve probably a map of question vs answer, or some other custom object using your dao. Depending on the type of form backing object you could use a custom editor to bind your data.

  3. #3
    Join Date
    Sep 2008
    Posts
    2

    Default

    Hi maverickthinker,

    Thanks for replying. I think formBackingObject() is used to assemble the custom object from returning data. But before the user can input in the form I need to display the form, which require me to send a model called 'survey' to it. I would like to know how to do it?

    Here is what the survey view will look like:

    Code:
     <c:forEach items="${survey.questions}" var="question">
        	<li><c:out value="${question.questionDetail.questionContent}"></c:out></li>
        	<c:if test="${question.questionDetail.questionType eq '1'}">
        		<div class="feedback">
        		   	<input type="radio" name="${question.questionId}" value=1 />Excellent	
        		    <input type="radio" name="${question.questionId}" value=2 />Good
    	    		<input type="radio" name="${question.questionId}" value=3 />Average
    	       		<input type="radio" name="${question.questionId}" value=4 />Fair
    	   		    <input type="radio" name="${question.questionId}" value=5 />Poor
    	   		    <input type="radio" name="${question.questionId}" value=0 />N/A			
       		   	</div>
        	</c:if>
        	<c:if test="${question.questionDetail.questionType eq '2'}">
        		<div class="feedback">
        			<textarea rows="5" cols="60" name="${question.questionId}"></textarea>
        		</div>
        	</c:if>
        </c:forEach>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •