使用锚点而不是提交(发布)
我有一个问题,但在韩国网络社区中找不到我的问题的解决方案。
<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>
这段代码没有问题。
但是,我想使用“锚”而不是“提交”标签。我只想使用超链接和“发布”方式,而不是“获取”方式。我该怎么做?请帮助我〜:)
<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>
它不起作用。 :(
主要问题是如何
在 struts.xml 中获取“method:selectSale”,
<action name="products" class="sample.ProductsAction">
<result>abc.jsp</result>
<result name="selectSale">selectSale.jsp</result>
</action>
然后在 ProductsAction.java 中获取,
public String selectSale() throws Exception {
// ~~~
return "selectSale"
}
好的,现在我有一个问题.
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>
<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 have to put "selectSale" on code? ( using <s:a>
or <a:>
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
定义 a 并在锚点中使用它。
问候,
Define a and use it in your anchor.
Regards,