Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get checked checkbox value from html page to spring mvc controller
    primarykey
    data
    text
    <p>im using spring mvc framework with thymeleaf template engine the problem is , i have 1 page with multiple check box iterated sing thymeleaf th:each iterator.When i clicked multiple check boxes i want to pass check box values to the controller method..</p> <p>html content</p> <pre><code>&lt;table&gt; &lt;tr th:each="q : ${questions}"&gt; &lt;h3 th:text="${q.questionPattern.questionPattern}"&gt;&lt;/h3&gt; &lt;div&gt; &lt;p &gt; &lt;input type="checkbox" class="ads_Checkbox" th:text="${q.questionName}" th:value="${q.id}" name="id"/&gt; &lt;/p&gt; &lt;/div&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>*<strong><em>Controller</em>*</strong></p> <pre><code> @RequestMapping(value = Array("/saveAssessment"), params = Array({ "save" })) def save(@RequestParam set: String, id:Long): String = { var userAccount: UserAccount = secService.getLoggedUserAccount println(userAccount) var questionSetQuestion:QuestionSetQuestion=new QuestionSetQuestion var questionSet: QuestionSet = new QuestionSet questionSet.setUser(userAccount) questionSet.setSetName(set) questionSet.setCreatedDate(new java.sql.Date(new java.util.Date().getTime)) questionSetService.addQuestionSet(questionSet) var list2: List[Question] = questionService.findAllQuestion var limit=list2.size var qustn:Question=null var a = 1; for( a &lt;- 1 to limit ){ println( a ); qustn= questionService.findQuestionById(a) questionSetQuestion.setQuestion(qustn) questionSetQuestion.setQuestionSet(questionSet) questionSetQuestion.setCreatedDate(new java.sql.Date(new java.util.Date().getTime)) questionSetQuestionService.addQuestionSetQuestion(questionSetQuestion) } "redirect:/teacher/Assessment.html" } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload