我是Struts框架的noob。我正在嘗試瞭解動作映射如何正確工作。假設我有一個發送AJAX請求的JavaScript文件:Struts struts-config.xml動作映射解釋
$("button").click(function(){
$.ajax({url: "myTestUrl.do", success: function(result){
//do something with result
});
});
和我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>
我不明白的動作和形式豆之間的關係。我的請求是否會由TestAction
處理?如果是這樣,表單bean type
屬性的目的是什麼?
UPDATE: 的人誰需要支柱MCV框架的一個很好的概述看看這個鏈接:http://www.javaranch.com/journal/2002/03/newslettermar2002.jsp#struts
這是S1 - > * struts-config_1_1.dtd *。 –
謝謝。我已經更新了這個問題。 – tommyO