Wu Yuxiong - natural born flyweight JAVA EE enterprise application development Struts2Sping4Hibernate integrated development study notes: Using Struts2 tag libraries (1)

<?xml version="1.0" encoding="GBK"?>
<project name="struts" basedir="." default="">
    <property name="dist" value="classes"/>
    <property name="src" value="src"/>
    
    <path id="classpath">
        <fileset dir="lib">
            <include name="*.jar"/>
        </fileset>
        <pathelement path="${dist}"/>
    </path>

    <target name="compile" description="Compile all source code">
        <delete dir="${dist}"/>
        <mkdir dir="${dist}"/>
        <copy todir="${dist}">
            <fileset dir="${src}">
                <exclude name="**/*.java"/>
            </fileset>        
        </copy>
        <javac destdir="classes" debug="true" includeantruntime="yes"
            deprecation="false" optimize="false" failonerror="true">
            <src path="${src}"/>
            <classpath refid="classpath"/>
        </javac>
    </target>

</project>
<?xml version="1.0" encoding="GBK"?>

<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
    http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
    <! - define the core of Filter Struts 2 ->
    <filter>
        <filter-name>struts2</filter-name>
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
    </filter>
    <! - let Struts core Filter 2 intercept all requests ->
    <filter-mapping>
        <filter-name>struts2</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>
</web-app>
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
    "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
    <constant name="struts.i18n.encoding" value="GBK"/>
    <! - setting allows access to static methods allow OGNL ->
    <constant name="struts.ognl.allowStaticMethodAccess"
        value="true"/>
    <package name="lee" extends="struts-default">
        <action name="*">
            <result>/WEB-INF/content/{1}.jsp</result>
        </action>
    </package>
</struts>
<% - 
Web site: <A href = "http://www.crazyit.org"> crazy league Java </a> 
author yeeku.H.lee kongyeeku @ 163 .com
which version of the   1.0 for 
Amsterdam Copyright (the C), 20012010 , yeekuHLee
This program is protected by copyright laws.
Program Name:
Date: 
--%>

<%@ page contentType="text/html; charset=GBK" language="java" errorPage="" %>
<%@taglib prefix="s" uri="/struts-tags"%>
<!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>
    <Title> tag access Struts 2 using both static and static methods </ title>
    <meta name="website" content="http://www.crazyit.org" />
</head>
<body> 
access system environment variables: <S: Property value =
    "@java.lang.System@getenv('JAVA_HOME')"/> <br />
圆周率的值:<s:property value="@java.lang.Math@PI"/>
</body>
</html>
<?xml version="1.0" encoding="GBK"?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.1//EN"
    "http://struts.apache.org/dtds/struts-2.1.dtd">
<struts>
    <constant name="struts.i18n.encoding" value="GBK"/>
    <! - setting allows access to static methods allow OGNL ->
    <constant name="struts.ognl.allowStaticMethodAccess"
        value="true"/>
    <package name="lee" extends="struts-default">
        <action name="*">
            <result>/WEB-INF/content/{1}.jsp</result>
        </action>
    </package>
</struts>

 

Guess you like

Origin www.cnblogs.com/tszr/p/12364658.html