Struts2中的redirect引數傳遞

2021-07-04 20:30:22 字數 959 閱讀 5673

在action之間傳遞引數:

redirect:

name="topic" type="redirect"> findtopics.action?topicid=$result>

redirect-action:

name="topic"

type="redirect-action">

name="actionname">findtopicsparam>

name="topicid">$param>

result>

如果是多個引數的話,繼續再加幾個就行了,對於(方法一)如果是多個引數的怎麼辦?

"topic"

type="redirect">findtopics.action?topicid=$&elementid=$

使用redirect重置鏈結需要字尾名,使用了redirect-action就不能使用了,就例如使用chain一樣,只需要寫action的配置名,如果加入字尾名.action,就會報出異常,action未配置正確。在這個配置檔案裡,多個引數的連線符使用了」& ;」(分號要挨著amp,此處由於轉義無法正常書寫故新增空格),這是由於xml的語法規範,應該使用」& ;」代替」&」,原理和html中的轉義相同。

chain 用於把相關的幾個action連線起來,共同完成乙個功能。

class="test.step1action">

name="success" type="chain">step2.actionresult>

name="step2"

class="test.step2action">

name="success">finish.jspresult>

處於chain中的action屬於同乙個http請求,共享乙個actioncontext。

Struts2中checkboxlist標籤的使用

selectedproducts name product.id list products listvalue name listkey id value 這裡分兩類,首先明確value的值應該是乙個list,用來顯示checkbox內那些需要先打勾 一類,當value的值是是乙個list bea...

Struts2字尾 深入Struts2

一 將action字尾變成html字尾 xmlversion 1.0 encoding utf 8 doctype struts public apache software foundation dtd struts configuration 2.1 en struts include file...

struts2中的 使用

迭代資料時 例如 var var屬性的值代表當前正在遍歷的物件 var存放在map棧 status int getcount 返回當前迭代的元素個數 int getindex 返回當前迭代的元素的索引 boolean iseven 返回當前迭代元素的索引是否是偶數 boolean isodd 返回當...