0 0 0 0

Http://blog. Csdn. net/outsider_lcg/article/details/44967055.

For the shopping cart project, the project documentation requires that you read the data from the database when you open the first page, and you can use the <s.

<s: action name => ExecuteResult => = '> '

Attribute description: name, the name of the action in the struts. Xml. A ExecuteResult is whether the returned view is loaded into this page, namespace: Action corresponding namespace

Index. Jsp.

 <s:action name="goodsAction" executeResult="true" namespace="/action"> 

Struts. Xml.
<package name="ssh" extends="struts-default" namespace="/action"> 
<action name="goodsAction" class="orderAction" method="findAllGoods"> 
 <result name="success">/test.jsp</result> 

Test. Jsp.
 <table border=1 align="center"> 
 <s:iterator value="goods" var="good"> 
 <td><s:property value=""/></td> 
 <td><s:property value="#good.goods_name"/></td> 
 <td><s:property value="#good.count"/></td> 
 <td><s:property value="#good.price"/></td> 
 <td><s:a href="action/oneGoodAction?user_id=%{#parameters.user_id}&good_id=%{}">详情</s:a></td> 

Execute the process: after starting tomcat, enter localhost: 8080/XXX/, by default open index. Jsp, which will execute <s: action>, first jump to the corresponding.

After the data is completed, jump to the test. Jsp, and then the result of the test. Jsp is displayed in the div in the index. Jsp.

Copyright © 2011 Dowemo All rights reserved.    Creative Commons   AboutUs