这是struts中的公共页面jsp访问控制action,其基本思路就是通过使用通配符的方式控制拦截jsp。它是struts的核心之一:其中用到了几个struts默认的值:1.action默认是继承ActionSupport的,2.默认的访问方法是execution(),3.默认的返回值是success。详细看源码:struts.xml中配置:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd">
    <struts>
    <!-- 开发模式,如果为true会报错 -->
    <constant name="struts.devMode" value="true" />
    <!-- 1.2标签主题,简单风格 -->
    <constant name="struts.ui.theme" value="simple"></constant>    
<!-- 2.1配置公共UI访问 -->
    <package name="common" namespace="/" extends="struts-default">
        <action name="uiAction_*_*">
            <result>/WEB-INF/pages/{1}/{2}.jsp</result>
        </action>
    </package>    
View Code

页面使用:

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CRM系统</title>
</head>
<frameset rows="90,*" framespacing="0px" frameborder="no">
    <frame src="${pageContext.request.contextPath}/uiAction_frame_top" scrolling="no"/>
    <frameset id="main" cols="170,9,*" framespacing="0px" frameborder="no" >
        <frameset rows="30,*,40" framespacing="0px" frameborder="no" >
            <frame src="${pageContext.request.contextPath}/uiAction_frame_left1" scrolling="no"/>
            <frame src="${pageContext.request.contextPath}/uiAction_frame_left" scrolling="no"/>
            <frame src="${pageContext.request.contextPath}/uiAction_frame_left2" scrolling="no"/>
        </frameset>
        <frame src="${pageContext.request.contextPath}/uiAction_frame_control" scrolling="no"/>
        <frame src="${pageContext.request.contextPath}/uiAction_frame_right" name="right" scrolling="yes"/>
    </frameset>
</frameset>
</html>

学习记录笔记,方便以后查看。

 

posted on 2017-03-18 14:35  昨天的你,现在的未来  阅读(442)  评论(0编辑  收藏  举报