views:

22

answers:

1

Hi,

i have been using the spring mvc frameworks lately for a university project. Could you tell me why this work

 <FORM METHOD=POST ACTION="SaveName.jsp">
     <input type="image" class="floatR marginTMinus10" 
             src="images/delete.png" name="image" 
             value="${rssItem.id}" alt="Delete"/>
 </FORM>

while this not

<input type="image" class="floatR marginTMinus10"
        src="images/delete.png" name="image" value="${rssItem.id}" alt="Delete"/>

does it mean a button has to be in a form to work?

Can i use a button? if yes how do i handle the event in the controller?

thanks

+1  A: 

type="image" defines the button as a submit button. And a submit button needs a form to submit.

As of how to use buttons to trigger spring actions - I've done it like that: document.location='someController.do?action=save&otherparam=other';.

As a side-note - be consistent in your HTML - either use uppercase or lowercase for tags. Always add quotations around attributes (METHOD="POST")

Bozho