Can struts 1.1 post to a relative path

ぐ巨炮叔叔 提交于 2019-12-25 04:55:25

问题


I have a Struts application and I build by form

<html:form action="companyProvAdd"> ....</html:form>

which renders the html as

 <form name="companyProvAddForm" method="post" action="/ebig/companyProvAdd.do"> ...</form>

Is there a way to have the post go to a relative URL?

 <form name="companyProvAddForm" method="post" action="companyProvAdd.do"> ...</form>

回答1:


It looks like Struts 1.1 does not support this

https://issues.apache.org/jira/browse/STR-768

but I did find a workaround

<!-- <html:form action="companyProvAdd"> -->
<form name="companyProvAddForm" method="post" action="companyProvAdd.do">
....
</html:form>

The html:form tag is necessary because items in the form depend on its presence. Commenting it out keeps the browser from reading it and leaves room for the desired form line to be hard coded in.

It is an ugly hack, but it works.



来源:https://stackoverflow.com/questions/3103213/can-struts-1-1-post-to-a-relative-path

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!