struts2頁面間傳值

<form action="orderAction!myOrder" method="post">
<h6 class="prtHeadTitle">確認訂單</h6>
<div class="margintop10"></div>
<p>
<strong>名稱:</strong>牛肉餛燉
</p>
<hr class="prtLine" />
<p>
<strong>餐廳:</strong>雅山
</p>
<hr class="prtLine" />
<p>
<strong>數量:</strong><input type="text" name="quantity">
</p>
<hr class="prtLine" />
<p>
<strong>價格:</strong>¥6
</p>
<hr class="prtLine" />
<p>下單後當即由雅山送餐。</p>
<%--<a target="_blank" href="orderAction!myOrder" class="featbtn2" onClick="">提交訂單
&rarr;</a>--%>
<input name="submit" type="submit" value="提交訂單"
class="btn btn-small btn-info"  />

</form> java


Action類 spring

package com.efinance.action;


import java.io.IOException;


import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;


import com.efinance.sms.FetionSend;
import com.opensymphony.xwork2.ActionSupport;
import com.utils.Util;
@Component("orderAction")
@Scope("prototype")
public class OrderAction extends ActionSupport{
private String quantity; 
public String myOrder(){
Util.number=quantity;
return "commit_success";
}

public String getQuantity() {
return quantity;
}
public void setQuantity(String quantity) {
this.quantity = quantity;
}


}
post

<form name="form1" method="post" action="shoppingAction!submit_Order"> <table width="950" border="0" cellspacing="0" cellpadding="0" align="center"> <tr> <td><font size="+2">個人購物車</font> </td> </tr> </table> <table width="963" border="1" cellspacing="0" cellpadding="0" align="center" bordercolor="#CCCCCC"> <tr> <td colspan="7">&nbsp;</td> </tr> <tr bgcolor="#CCCCCC"> <td height="22" colspan="2" align="center" background="" class="STYLE1" border="0" cellspacing="0" cellpadding="1"> 商品名稱</td> <td width="10%" class="STYLE1" align="center" height="22" background="">麥包價</td> <td width="9%" align="center" class="STYLE1" background="">活動價</td> <td width="9%" align="center" class="STYLE1" height="22" background="">優惠</td> <td width="9%" align="center" class="STYLE1" height="22" background="">數量</td> <td width="8%" align="center" class="STYLE1" height="22" background="">刪除</td> </tr> <tr> <td width="7%" height="22" align="center" background="" bgcolor="#FFFFFF" class="STYLE1" border="0" cellspacing="0" cellpadding="1"><img src="meishi/hundunaiguotie_5.png" width="62" height="61"> </td> <td width="48%" align="center" background="" bgcolor="#FFFFFF" class="STYLE1" border="0" cellspacing="0" cellpadding="1">[雅山]湯鮮味美的牛肉混沌<br />12313240<br /> </td> <td class="STYLE1" align="center" height="22" background="" bgcolor="#FFFFFF">¥8</td> <td align="center" class="STYLE1" background="" bgcolor="#FFFFFF">¥6</td> <td align="center" class="STYLE1" height="22" background="" bgcolor="#FFFFFF">¥2</td> <td align="center" class="STYLE1" height="22" background="" bgcolor="#FFFFFF"><s:property value="quantity"/></td> <td align="center" class="STYLE1" height="22" background="" bgcolor="#FFFFFF"><a>刪除</a> </td> </tr> <hr> <tr> <td height="22" colspan="7" align="center" background="" bgcolor="#FFFFFF" class="STYLE1" border="0" cellspacing="0" cellpadding="1">合計 : ¥ <s:property value="quantity*6"/> <div align="right"> <input type='hidden' name='price' value=6 id='price'/> <input type='hidden' name='GoodsNum' value=<s:property value="quantity"/> id='GoodsNum'/> <input type='hidden' name='amount' value= <s:property value="quantity*6"/> id='amount'/> <input name="submit2" type="submit" value="去結算" class="btn btn-small btn-info" /> </div> </td> </tr> </table> </form>
相關文章
相關標籤/搜索