views:

1546

answers:

3

Hello, I'm from South Korea :)

I have a question, but I couldn't find a solution for my problem in 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 "submit" tag. I just want to use hyperlink and 'post' way, 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>

It doesn't work. :(

The main problem is how to get "method:selectSale".

in struts.xml,

<action name="products" class="sample.ProductsAction">
  <result>abc.jsp</result>
</action>

and then, in ProductsAction.java,

public String selectSale() throws Exception {
  // ~~~
  return "selectSale"
}

Ok, now, I have a question.

where do i have to put "selectSale" on code? ( using <s:a> or <a:> )

A: 

The easy way is to set an ID property on your form, and in the onclick of the anchor use document.getElementById(formID).submit().

Summers Pittman
but, main problem is : how to get "method:selectSale".in struts.xml,<action name="products" class="sample.ProductsAction"> <result>abc.jsp</result></action>and then, in ProductsAction.java,public String selectSale() throws Exception { ~~~ return "selectSale"}ok, now, i have a question.where do i have to put "selectSale" on code?
Davis
A: 
action="products?method:selectSale"
Dusty Pearce
A: 

Hi, You can try goPage

Neeraj Kumar Singh