sshe源码分析——全局架构

 

Web.xml

 <!-- 需要拦截的JSP -->

    <filter>

        <filter-name>sessionFilter</filter-name>

        <filter-class>sy.util.base.SessionFilter</filter-class>

        <init-param>

            <param-name>include</param-name>

            <!-- 在securityJsp这个文件夹下面的所有JSP页面,都需要有session才能访问,可以配置多个,用英文半角逗号分割 -->

            <param-value>securityJsp</param-value>

        </init-param>

    </filter>

    <filter-mapping>

        <filter-name>sessionFilter</filter-name>

        <url-pattern>*.jsp</url-pattern>

    </filter-mapping>

sessionFilter监听的网址中如果包含Include里的部分,则需要session才能访问

效果:

wpsCEE5.tmp 

 

wpsCEE6.tmp 

 

 

  <!-- 用户上下线监听器 -->

    <listener>

        <listener-class>sy.util.base.OnlineListener</listener-class>

    </listener>

OnlineListener监听在线用户上线下线

效果:

wpsCEE7.tmp 

 

wpsCEE8.tmp 

 

在struts.xml中

<!-- session拦截器 -->

<interceptor name="sessionInterceptor" class="sy.interceptor.base.SessionInterceptor" />

<interceptor-stack name="sessionStack">

<interceptor-ref name="encodingStack"></interceptor-ref>

<interceptor-ref name="sessionInterceptor">

<!-- doNotNeedSessionAndSecurity_ 开头的和doNotNeedSession_ 开头的方法不拦截 -->

<param name="excludeMethods">doNotNeedSession_*,doNotNeedSessionAndSecurity_*</param>

</interceptor-ref>

</interceptor-stack>

sessionInterceptor拦截非jsp后缀的

效果:

wpsCEE9.tmp 

 

wpsCEF9.tmp 

 

<!-- 权限拦截器 -->

<interceptor name="securityInterceptor" class="sy.interceptor.base.SecurityInterceptor" />

<interceptor-stack name="securityStack">

<interceptor-ref name="sessionStack"></interceptor-ref>

<interceptor-ref name="securityInterceptor">

<!-- doNotNeedSessionAndSecurity_ 开头的和doNotNeedSecurity_ 开头的方法不拦截 -->

<param name="excludeMethods">doNotNeedSecurity_*,doNotNeedSessionAndSecurity_*</param>

</interceptor-ref>

</interceptor-stack>

</interceptors>

securityInterceptor检测权限

效果:

wpsCEFA.tmp 

 

wpsCEFB.tmp 

 

wpsCEFC.tmp 

 

<global-results>

<!-- 没有session -->

<result name="noSession">/error/noSession.jsp</result>

<!-- 没有权限 -->

<result name="noSecurity">/error/noSecurity.jsp</result>

<!-- struts抛异常 -->

<result name="strutsException">/error/strutsException.jsp</result>

</global-results>

 

<global-exception-mappings>

<exception-mapping result="strutsException" exception="java.lang.Exception"></exception-mapping>

</global-exception-mappings>

 

Action结构:

wpsCF0D.tmp 

其他Action通过继承BaseAction并传递相应Service来获得共有功能

包括统一命名的字段,以及基础的CUID,json处理等

 

Service结构:

wpsCF0E.tmp 

其他Service通过继承BaseService来获得基础CUID

 

ServiceImpl结构:

wpsCF0F.tmp 

BaseServiceImpl中注入了BaseDao

 

另外还有个InitServiceImpl,用来初始化

通过读取配置文件中的initDataBase.xml来写入数据库

SAX方式读取,并使用了XPath

 

页面部分,一个公共加载页,inc.jsp,包含公用功能及js库

 

登陆后的main页面是一个easyUI的layout

上面为账户相关

wpsCF1F.tmp 

 

左边为导航菜单

wpsCF20.tmp 

中间为easyUI-tab,每个tab都是一个iframe

wpsCF21.tmp 

 

还有model部分:

wpsCF22.tmp 

easyui需要的格式进行了对象封装

 

http://www.cnblogs.com/gcg0036/p/4390381.html

posted @ 2015-04-03 16:25  gcg0036  阅读(1005)  评论(0编辑  收藏  举报