没有人???我是在tomcat下做的!

解决方案 »

  1.   

    因为你指的PATH是 index.jsp 的上一级目录下,所以默认就会找此路径的INDEX。JSP了。
      

  2.   

    url-pattern和你的目录没有直接关系,是根据你的url来判断要不要认证的。
    可能你的url里面直接就可以从http://localhost:80/index.jsp forward到test目录下的index.jsp,但你在url-pattern里面就不能写test/*.*,因为你的url里面里面并没有test,所以主要还是看url
      

  3.   

    <error-page>
            <exception-type>java.sql.SQLException</exception-type>
            <location>/errorSQLException.jsp</location>
        </error-page>
        <error-page>
            <error-code>404</error-code>
            <location>/errorNotFound.jsp</location>
        </error-page>
        <error-page>
            <error-code>java.lang.Exception</error-code>
            <location>/errorException.jsp</location>
        </error-page>
      

  4.   

    原文为精华区的 nc201(Bricklayer)
    例如你要控制对ROOT目录下文件的访问:
    首先更改$TOMCAT_HOME/ROOT/WEB-INF/web.xml
    1。在<web-app>和</web-app>之间加入
      <security-constraint>
        <web-resource-collection>
          <web-resource-name>Entire Application</web-resource-name>
          <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
           <!-- NOTE:  This role is not present in the default users file -->
           <role-name>user</role-name>
        </auth-constraint>
      </security-constraint>  <!-- Define the Login Configuration for this Application -->
      <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>TEST ACCESS CONTROL</realm-name>
      </login-config>2。然后在$TOMCAT_HOME/conf/tomcat-users.xml中加入
       <user name="user" password="password" roles="user"/> 
       roles的名字和web.xml中的相对应