我对Struts框架不熟悉。我试图了解动作映射的工作原理。假设我有一个发送AJAX请求的JavaScript文件:
$("button").click(function(){
$.ajax({url: "myTestUrl.do", success: function(result){
//do something with result
});
});
Run Code Online (Sandbox Code Playgroud)
我的struts-config.xml文件如下所示:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
<struts-config>
<form-beans>
<form-bean name="testForm" type="com.test.TestForm"/>
</form-beans>
<!-- Global Forwards -->
<global-forwards>
</global-forwards>
<!-- Action Mappings -->
<action-mappings>
<action path="/myTestUrl"
type="com.test.TestAction"
name="testForm"
scope="request" />
</action-mappings>
<controller locale="true"/>
</struts-config>
Run Code Online (Sandbox Code Playgroud)
我不明白之间的关系action和form-bean。我的请求会由处理TestAction吗?如果是这样,那么表单bean type属性的目的是什么?
更新:
对于需要全面了解Struts MCV框架的任何人,请查看以下链接:http : //www.javaranch.com/journal/2002/03/newslettermar2002.jsp#struts