struts2.0.6 + tiles 使用配置过程

阅读更多
最近闲着无事,琢磨了一下struts2.06的tiles使用。以下是一些简单使用的步骤。
1.在WEB-INF/lib下加入所需的jar包
    commons-digester-1.6.jar,
    xwork-2.0.1.jar,
    tiles-core-2.0-20070207.130156-4.jar,
    tiles-api-2.0-20070207.130156-4.jar,
    struts2-tiles-plugin-2.0.6.jar,
    struts2-core-2.0.6.jar
2.修改web.xml  为以下内容
  
    xmlns="http://java.sun.com/xml/ns/j2ee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
    
        struts2
        org.apache.struts2.dispatcher.FilterDispatcher
   

   
        struts2
        /*
   

    
        org.apache.tiles.listener.TilesListener
   



3.在WEB-INF下添加tiles.xml文件

           "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN"
        "http://struts.apache.org/dtds/tiles-config_2_0.dtd">

   
       
       
       
   


4.struts.xml 为:

    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

   
   
   
   

5.struts-test.xml文件为:

        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">

   
   
       
            /user/login.jsp
       
 
   
          showcase.index
   

   


6.注意要在每个jsp文件中加入<%@ page contentType="text/html; charset=UTF-8"%>

你可能感兴趣的:(Struts,Apache,XML,JSP,Web)