日期:2014-05-17  浏览次数:20677 次

Tamcot与struts2的问题?
我在Tamcat文件conf/server.xml中配置: <Context   path   =   "/st "   docBase   =   "D:\Program   Files\struts2-blank "/>
我的D:\Program   Files\struts2-blank文件有三个目录文件,分别是:jsp,WEB-INF   ,还有一个study.html文件。里面的内容是:


study.html内容:
<%   page   contentType   =   "text/html "   pageEncoding=   "GBK "%>
<html>
<head>
        <title> aaaaaaaaaaaaaa </title>
</head>
<body>
<h1> 加油!!!!加油!!!!! </h1>
</body>
</html>

此时WEB-INF文件夹下的web.xml的配置如下:
<?xml   version= "1.0 "   encoding= "ISO-8859-1 "?>
      <welcome-file-list>
                <welcome-file> index.html </welcome-file>
        </welcome-file-list>
    <description>
          Welcome   to   Tomcat
    </description>

</web-app>


这个时候,我起动Tomcat,在浏览器中输入:http://localhost:8080/st/,就可以见到jsp文件夹和study.html文件。

我在WEB-INF文件夹下增加一个文件名字叫classes,在它下面放一个文件struts.xml;
struts.xm的配置如下:

<?xml   version= "1.0 "   encoding= "UTF-8 "   ?>
<!DOCTYPE   struts   PUBLIC
        "-//Apache   Software   Foundation//DTD   Struts   Configuration   2.0//EN "
        "http://struts.apache.org/dtds/struts-2.0.dtd ">

<struts>
<package   name= "default "   namespace= "/ "   extends= "struts-default ">
</package>
</struts>

然后我把Web.xml的配置也改了:
<?xml   version= "1.0 "   encoding= "ISO-8859-1 "?>
      <welcome-file-list>
                <welcome-file> index.html </welcome-file>
        </welcome-file-list>
    <description>
          Welcome   to   Tomcat
    </description>

[color=#FF0000] <display-name> Struts   Blank </display-name>

        <filter>
                <filter-name> struts2 </filter-name>
                <filter-class> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter </filter-class>
        </filter>

        <filter-mapping>
                <filter-name> struts2 </filter-name>
                <url-pattern> /* </url-pattern>
        </filter-mapping> [/color] </web-app>

我再起动Tomcat,在浏览器中输入:http://localhost:8080/st/,[color=#FF0000]却看不到jsp文件夹和study.html文件,这是为什么呢?[/color]
有哪位可以说明一下这个现象?


     

------解决方案--------------------
要代码变颜色,需要在你发帖时,点上方的“插入源代码”选择相应的语言就行了。
------解决方案--------------------<