struts.xml
view code
<student* "*"號表示匹配任何字元 標識第乙個"*"號package
name
="actions"
extends
="struts-default"
namespace
="/actions"
>
<
action
name
="student*"
class
="com.bjsxt.struts2.action.studentaction"
method
="">
<
result
>/student_success.jsp
result
>
action
>
<
action
name
="*_*"
class
="com.bjsxt.struts2.action.action"
method
="">
<
result
>/__success.jsp
result
>
action
>
package
>
不用(student!add) "!"號不能匹配 /student_success.jsp
用萬用字元更方便。
但是專案中的 方法名及jsp的命名等都需要 專案組成熟的約定。
struts2知識點備忘
struts2標籤寫的form表單 1.只有fielderror級別錯誤才會自動顯示出來,不再需要使用類似這樣的標籤 2.驗證出錯的話,如果跳到form表單頁面,那麼會自動保留上次填入的表單資訊 3.fielderror級別錯誤資訊都會在每個filed的上面顯示 4.actionerror級別的錯誤...
struts2小知識點
color red 1 預設的命名空間 namespace 根命名空間 namespace color 如果未指定命名空間,則命名空間預設為 namespace 預設命名空間裡的action可以處理任何命名空間下的action請求。例如,如果存在url為 barspace bar.action的請求...
細小知識點之Struts2
1.struts2基本簡要流程如下 1 客戶端瀏覽器發出http請求。2 根據web.xml配置,該請求被filterdispatcher接收。3 根據struts.xml配置,找到需要呼叫的action類和方法,並通過ioc方式,將值注入給aciton。4 action呼叫業務邏輯元件處理業務邏輯...