課程
/后端開發(fā)
/Java
/Struts2入門
不是說用代碼操作實現(xiàn)三種訪問Servlet API的方法嗎,怎么沒講?
2016-02-29
源自:Struts2入門 4-3
正在回答
我這有個例子
public class BaseAction extends ActionSupport{?? ?/**?? ? * @Fields serialVersionUID?? ? */?? ?private static final long serialVersionUID = 1L;?? ?/**?? ? * ?? ? * @Description: 獲取Session對象?? ? * @param 參數(shù)說明?? ? * @return Map<String,Object> 返回類型?? ? * @throws 異常說明?? ? */?? ?protected Map<String, Object> getSession() {?? ??? ?ActionContext ctx = ActionContext.getContext();?? ??? ?return ctx.getSession();?? ?}?? ?/**?? ? * ?? ? * @Description: 獲取HttpServletRequest對象?? ? * @param 參數(shù)說明?? ? * @return HttpServletRequest 返回類型?? ? * @throws 異常說明?? ? */?? ?protected HttpServletRequest getRequest() {?? ??? ?return ServletActionContext.getRequest();?? ?}?? ?/**?? ? * ?? ? * @Description: 獲取HttpServletResponse對象?? ? * @param 參數(shù)說明?? ? * @return HttpServletResponse 返回類型?? ? * @throws 異常說明?? ? */?? ?protected HttpServletResponse getResponse() {?? ??? ?return ServletActionContext.getResponse();?? ?}}
weibo_暖暖大太陽qi_0 提問者
說句不該說的,,,你知道什么是serlvet-api嗎。。。0 0
變成蝴蝶飛走了·· ·······
我也感覺好奇怪,突然到順序了
就是通過那三個對象來訪問啊,ActiionContxt,HttpServletContext,還有一個***Mware的那個!
舉報
本教程帶你踏上Struts2學(xué)習(xí)之旅,對Struts2進(jìn)行更深入講解
2 回答Servlet Api 訪問Servlet!?
1 回答4-2的訪問servlet API 是不是少了一節(jié)課程
2 回答訪問servlet API這段消失了嗎
4 回答缺少一節(jié)struts2訪問servlet代碼具體操作
1 回答Servlet API是什么啊?
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2016-09-23
我這有個例子
public class BaseAction extends ActionSupport{
?? ?/**
?? ? * @Fields serialVersionUID
?? ? */
?? ?private static final long serialVersionUID = 1L;
?? ?/**
?? ? *
?? ? * @Description: 獲取Session對象
?? ? * @param 參數(shù)說明
?? ? * @return Map<String,Object> 返回類型
?? ? * @throws 異常說明
?? ? */
?? ?protected Map<String, Object> getSession() {
?? ??? ?ActionContext ctx = ActionContext.getContext();
?? ??? ?return ctx.getSession();
?? ?}
?? ?/**
?? ? *
?? ? * @Description: 獲取HttpServletRequest對象
?? ? * @param 參數(shù)說明
?? ? * @return HttpServletRequest 返回類型
?? ? * @throws 異常說明
?? ? */
?? ?protected HttpServletRequest getRequest() {
?? ??? ?return ServletActionContext.getRequest();
?? ?}
?? ?/**
?? ? *
?? ? * @Description: 獲取HttpServletResponse對象
?? ? * @param 參數(shù)說明
?? ? * @return HttpServletResponse 返回類型
?? ? * @throws 異常說明
?? ? */
?? ?protected HttpServletResponse getResponse() {
?? ??? ?return ServletActionContext.getResponse();
?? ?}
}
2016-12-21
說句不該說的,,,你知道什么是serlvet-api嗎。。。0 0
2016-07-14
變成蝴蝶飛走了·· ·······
2016-03-12
我也感覺好奇怪,突然到順序了
2016-03-01
就是通過那三個對象來訪問啊,ActiionContxt,HttpServletContext,還有一個***Mware的那個!