struts 1.1 可以发布到相对路径吗 [英] Can struts 1.1 post to a relative path

查看:29
本文介绍了struts 1.1 可以发布到相对路径吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 Struts 应用程序,我是通过表单构建的

I have a Struts application and I build by form

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

将 html 呈现为

which renders the html as

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

有没有办法让帖子转到相对 URL?

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

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

推荐答案

Struts 1.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>

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.

这篇关于struts 1.1 可以发布到相对路径吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆