2013年10月31日星期四

Urgent ! ! ! ! How to pass parameters in struts.xml to another action

Click to jump to action follows Replies

articleListAction


How to pass the ID value articleListAction Lane ? How to write ? Consult experts to answer !


/ bbs / article.jsp

------ Solution ------------------------------- -------------
looks like you can add in the url $ {ID}, type to "redirect"
------ Solution ------ --------------------------------------

点击回帖跳转到的action如下
<action name="postArticleAction" class="com.bbs.showAction" method="postArticle">
<result name="success" type="chain">articleListAction</result>
</action>

如何把ID值传给articleListAction里?怎么写?请教高手解答!

<action name="articleListAction" class="com.bbs.showAction" method="articleList">
<result name="success">/bbs/article.jsp</result>
</action>

postArticleAction could write showAction class plus an id attribute to provide geter seter can write
<action name="postArticleAction" class="com.bbs.showAction" method="postArticle">
<result name="success" type="chain">articleListAction.action?id=${id}</result>
</action>



------ Solution ------------------------------------ --------

articleListAction.action? ID = $ {ID}


articleListAction declare an ID variable , and provides set / get methods
------ For reference only --------------------- ------------------
the result of the type attribute to redirect, redirect
------ For reference only ------ ---------------------------------
then how to pass parameters?
------ For reference only -------------------------------------- -
articleListAction & xxx = yyy
------ For reference only --- ------------------------------------
that how to get inside this parameter in the ACTION ?
------ For reference only -------------------------------------- -
inside struts.xml configuration parameter is not passed , but in the concrete inside the given url

example you from a web component , such as a jsp, servlet even other struts Action class inside, can provide this parameter:

to jsp example: In the js inside :
document.forms [0]. action = "postArticleAction.do? id =" + id value of your
then submit

in your
com.bbs.showAction class inside :
By String id = request.getParameter ("id"); take this parameter
------ For reference only ------------- --------------------------
chain types can be defined inside
------ For reference only ---------------------------------------





------ For reference only ----------------------------- ----------
action jump you can put request.setAttruct ("id", xx) , so in articleListAction directly get in the way ,
they request the same directly to the articleListAction is taken on it
------ For reference only ------------------- --------------------
type = "chain" can also be removed
------ For reference only - -------------------------------------
<

<action name="postArticleAction" class="com.bbs.showAction" method="postArticle">
<result name="success" type="chain">articleListAction.action?id=${id}</result>
</action>


------ For reference only ---------------------------------- -----
LZ is under what circumstances need to use this pass by value ah ? Experienced friends also talk about chanting ?
------ For reference only -------------------------------------- -
I would like to pass a collection of how to pass ?
can not be used ? Mass participation
collection of very long
------ For reference only ------------------------------- --------

$ {ID}, what is the ID variable is defined in the file ? Files on what position do ?

没有评论:

发表评论