简体   繁体   English

在Struts 1中,如何指定输入页面URL,而不是JSP路径

[英]In Struts 1, how to specify input page URL and not path to JSP

I have a very annoying problem with Struts. 我对Struts有一个非常烦人的问题。 The input page is located under an URL similar to this: /news/send/. 输入页面位于类似于以下网址的URL:/ news / send /。 URLs of this type are required by the CMS we're using. 我们使用的CMS需要此类型的URL。 In struts-config.xml, as action input I can only specify the path to the JSP file, eg 在struts-config.xml中,作为操作输入,我只能指定JSP文件的路径,例如

<action path="/send" type="org.example.SendAction" name="sendForm" scope="request"
       input="/WEB-INF/jsp/send.jsp" validate="true" />

The part that bugs me is input="/WEB-INF/jsp/send.jsp". 困扰我的部分是input =“ / WEB-INF / jsp / send.jsp”。 I need it to be something like: input="/news/send/" but it just gives me a 404 when I try that. 我需要它像这样:input =“ / news / send /”,但是当我尝试它时,它只会给我一个404。 It seems to require a path to a JSP, and the JSP as such does not exist, it's generated by the CMS when the above URL is accessed. 它似乎需要一个JSP路径,而JSP本身并不存在,它是由CMS在访问上述URL时生成的。

Since this page is needed only if validation is enabled, I can disable the validation and validate manually in the action, but I'd much rather avoid that. 由于仅在启用验证后才需要此页面,因此我可以禁用验证并在操作中手动验证,但我宁愿避免这种情况。

Any ideas? 有任何想法吗?

Thanks for any insight. 感谢您的见解。

同时,我了解到Struts 无法转发到尚不存在的资源,因此在这种情况下,使用重定向是唯一的选择,并且由于验证错误始终会导致转发,因此无法在此处使用验证机制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM