Using anchor instead of submit (post)
I have a question, but I could not find a solution for my problem in the Korean web community.
<s:form name="form1" method="post" action="products" theme="simple">
<s:hidden name="code" value="%{code}"/>
<s:submit type="button" name="method:selectSale" value="goPage"/>
</s:form>
This code has no problem.
But I want to use "anchor" instead of the "submit" tag. I just want to use a hyperlink and "post", not "get". How can i do this? Help me please ~ :)
<s:form name="form1" method="post" action="products" theme="simple">
<s:hidden name="code" value="%{code}"/>
<a href="#" onclick="javascript:document.form1.submit()">goPage</a>
</s:form>
This does not work.: (
The main problem is how to get the "method: selectSale".
in struts.xml ,
<action name="products" class="sample.ProductsAction">
<result>abc.jsp</result>
<result name="selectSale">selectSale.jsp</result>
</action>
and then in ProductsAction.java ,
public String selectSale() throws Exception {
// ~~~
return "selectSale"
}
Ok, now I have a question.
Where do I need to put "selectSale" on the code? (using <s:a>
or <a:>
)
+2
source to share