81,091
社区成员
发帖
与我相关
我的任务
分享
<html:form action="/a/b.html" method="post">
<action path="/a/b.html" type="xxx.MyAction" name="myform">
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>/a/b.html</url-pattern>
</servlet-mapping>
javax.servlet.ServletException: javax.servlet.jsp.JspException: Cannot retrieve mapping for action: "/a/b"
Cannot retrieve mapping for action: "/a/b"
<action path="/a/b.html"
</action>
org.apache.struts.chain.commands.InvalidPathException: No action config found for the specified url.
/**
* Return the form action converted into an action mapping path. The
* value of the <code>action</code> property is manipulated as follows in
* computing the name of the requested mapping:
* <ul>
* <li>Any filename extension is removed (on the theory that extension
* mapping is being used to select the controller servlet).</li>
* <li>If the resulting value does not start with a slash, then a
* slash is prepended.</li>
* </ul>
*/
public String getActionMappingName(String action) {
String value = action;
int question = action.indexOf("?");
if (question >= 0) {
value = value.substring(0, question);
}
int slash = value.lastIndexOf("/");
int period = value.lastIndexOf(".");
if ((period >= 0) && (period > slash)) {
value = value.substring(0, period);
}
return value.startsWith("/") ? value : ("/" + value);
}