简体   繁体   中英

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"
2 "jsdjh hj kjskjdhj"


When submit the form it should insert a new row. Action "XYZ" does that. 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 .

Thanks

Can't you use plain HTML: input type button?

If you don't want to submit, it probably does not need any struts functionality.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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