struts2访问session,request,application
1.访问或添加request/session/application属性
public String scope() throws Exception{
ActionContextctx=ActionContext.getContext();
ctx.getApplication().put("app","应用范围");//往ServletContext里放入app
ctx.getSession().put("ses","session范围");//往session里放入ses
ctx.put("req","request范围");//往request里放入req
return"scope";
}JSP:
<body>
${applicationScope.app}<br>
${sessionScope.ses}<br>
${requestScope.req}<br>
</body>
相关推荐
歆萌 2020-08-03
houmenghu 2020-11-17
我心似明月 2020-11-09
oraclemch 2020-11-06
ltd00 2020-09-12
康慧欣 2020-09-10
waveclouds 2020-09-04
蓝色深海 2020-09-15
jincheng 2020-09-01
思君夜未眠 2020-08-25
取个好名字真难 2020-08-06
阳光之吻 2020-08-03
婷婷小屋 2020-07-28
solarspot 2020-07-28
MLXY 2020-07-26
dxbjfu0 2020-07-26
songbinxu 2020-07-19
83520298 2020-07-06