如何获得<s: 按钮>Struts2中的功能

How to get <s:button> functionality in Struts2?

本文关键字:Struts2 功能 gt 何获得 lt 按钮      更新时间:2023-09-26
<s:form action="XYZ" method="post">
    <s:textfield name="sno" />
    <s:textarea name="t" rows="2" cols="4" />
    <!-- Here i want a button lets say -->
    <s:button value="GET TEXT" />
    <!--
        which executes other action (not "XYZ" ) and fill the textarea based on the serial no value(sno). 
    -->
    <s:submit  value="submit" />
</s:form> 

表格

sno 文本


 1 nbsp;"hsdjhjjsh">
 2 nbsp;"jsdjh hj kjskjdhj">


提交表单时,应插入新行。Action "XYZ"就是这样做的。但当我给现有的sno说"1"并点击GET TEXT按钮时,它不应该提交表单,而是应该调用其他操作,用hsdjhjjsh填充文本区域。

感谢

您不能使用纯HTML:input-type按钮吗?

如果您不想提交,它可能不需要任何struts功能。