开发者

Input not firing in jsp page

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


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")

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜