简体   繁体   English

怎么获得<s:button> Struts2 中的功能?</s:button>

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

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

Table桌子

sno text无文本


1 "hsdjhjjsh" 1“hsdjhjjsh”
2 "jsdjh hj kjskjdhj" 2“jsdjh hj kjskjdhj”


When submit the form it should insert a new row.提交表单时,它应该插入一个新行。 Action "XYZ" does that. Action "XYZ"就是这样做的。 But when i give existing sno lets say "1" and onclick GET TEXT button it should not submit form it but should call other action which will fill the textarea with hsdjhjjsh .但是,当我给现有的 sno 让我们说“1”和 onclick GET TEXT按钮时,它不应该提交表单,而是应该调用其他操作,用hsdjhjjsh填充 textarea。

Thanks谢谢

Can't you use plain HTML: input type button?你不能使用普通的 HTML:输入类型按钮吗?

If you don't want to submit, it probably does not need any struts functionality.如果您不想提交,它可能不需要任何 struts 功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM