随笔分类 -  JAVA_02_Struts2

摘要:1 Shiro 常见抛出异常 2 Shiro 标签 3 Shiro 过滤器链中的几种内置过滤器 3 Realm 1 认证 (自定义 与数据库的交互,将正确的user 新返回) return new SimpleAuthenticationInfo(userBean.getLoginName(), u 阅读全文
posted @ 2016-07-20 10:06 roscee 阅读(636) 评论(0) 推荐(0)
摘要:在struts2 struts.xml 配置中<struts> <package name="caixuedong" extends="struts-default" namespace="/core"> <action name="greeting" class="com.tarena.strut 阅读全文
posted @ 2016-07-15 09:55 roscee 阅读(6966) 评论(1) 推荐(0)
摘要:后台代码:public String getFileName() { String fileName = this.getRequest().getParameter("fileName"); String downloadFileName = fileName; try { } catch... 阅读全文
posted @ 2014-08-06 17:47 roscee 阅读(153) 评论(0) 推荐(0)
摘要:一、Struts1中的表示字符串的原样输出,同。如果所要输出的字符串中含有html标签的话,标签内容将原样输出(不解析)。如果要解析html中的内容,只要将filter属性值设为"false"就可以了。二、Struts2中对应的Struts1中的filter属性为escape,只需将escape的值... 阅读全文
posted @ 2013-10-28 22:25 roscee 阅读(223) 评论(0) 推荐(0)
摘要:Ognl --看做一个容器,里面有一个根对象 root(可以认为是个Map吧) root 可以添加对象数据访问root中的数据可以直接{对象} ,访问非root 中的对象 需要{#对象}======================================================Struts2 :将ActionContext 作为Ognl 的容器来看 ActionContext 类中有许多静态常量(PARAMETERS、VALUESTACK、SESSION、APPLICATION),注意没有request、repones要想获得request 和 repones 需要从Serve 阅读全文
posted @ 2013-10-16 14:18 roscee 阅读(230) 评论(0) 推荐(0)
摘要:构架基类 action 继承基类public class BaseAction implements ServletRequestAware,ServletResponseAware,SessionAware,ServletContextAware { protected Map session; protected transient HttpServletRequest request; protected transient HttpServletResponse response; protected transient ServletContext context; pub... 阅读全文
posted @ 2013-09-28 00:26 roscee 阅读(180) 评论(0) 推荐(0)
摘要:Action 下的某一个bean 类 同路径下的 [ClassName-conversion.properties] 文件类型转换器需继承的类DefaultTypeConverterpackage my.converters;import java.text.SimpleDateFormat;import java.util.Date;import java.util.Map;import ognl.DefaultTypeConverter;public class DateConverter extends DefaultTypeConverter { @Override public Ob 阅读全文
posted @ 2013-05-02 11:58 roscee 阅读(217) 评论(0) 推荐(0)
摘要:在拦截器中可以三种实现一:继承 AbstractInterceptor 类二:继承MethodFilterInterceptor类三:实现Interceptor 接口在实现Interceptor接口时,会多出init() 和 destroy() 方法拦截器的主体方法是:public String intercept(ActionInvocation arg0) throws Exception {// TODO Auto-generated method stubHttpServletRequest request = ServletActionContext.getRequest(); i. 阅读全文
posted @ 2013-03-01 17:28 roscee 阅读(396) 评论(0) 推荐(0)