Note that there are some explanatory texts on larger screens.

plurals
  1. POJSP forms with Spring mvc
    primarykey
    data
    text
    <p>I create the following JSP.This jsp creates two buttons. </p> <pre><code>&lt;form:form method="POST" action="${pageContext.request.contextPath}/link"&gt; &lt;div class="button-container" style="float:left;clear:right"&gt; &lt;table&gt; &lt;tr&gt; &lt;td&gt; &lt;input id="post" type="image" src="${pageContext.request.contextPath}/&lt;spring:theme code="image"/&gt;votup.png" &lt;/td&gt; &lt;/tr&gt; &lt;tr class="hidden"&gt; &lt;td class="hidden"&gt; &lt;input type="text" name="mark" value="up"/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;input id="post" type="image" src="${pageContext.request.contextPath}/&lt;spring:theme code="image"/&gt;votdown.png" &lt;/td&gt; &lt;/tr&gt; &lt;tr class="hidden"&gt; &lt;td class="hidden"&gt; &lt;input type="text" name="mark" value="down"/&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>In the controller class</p> <pre><code> @RequestMapping(value = "/link", method = RequestMethod.POST) public String sendMark(@RequestParam("mark") final String marking){ } </code></pre> <p>I notice that the value of the String marking= up,down.This happens no matter which of the 2 buttons i click. Instead of this i want to be only up or down according to the button that the user will click.(If click at the first button should be up, if click at the second button should be down). I understood that the reason i take this result is because i named both of the hidden values as mark, but i don't know how to make the seperation with another way. Actually is the first time i'm doing something with JSP.Could i use some tag libraries for this problem?Any comments or answers are much appreciated! Thank you</p>
    singulars
    1. This table or related slice is empty.
    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.
    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