我正在Apache服务器上使用Tomcat 6,并且在webapps中有一个名为support的应用程序,该应用程序可以正常工作。在调用页面中使用两个URL,分别称为register和Activate。它们都可以通过www.oururl.com/support/activate访问,并且可以通过相同的方案进行注册。我们希望拥有注册网址,可访问www.oururl.com/staticphppage.php上的静态页面。在过去的4天中,我尝试了各种选择,但无法正常工作。我是Java的新手,所以这是一个巨大的学习曲线。任何帮助将不胜感激。
我试图在web.xml中映射另一个servlet,但是它永远无法通过工作,并且始终会出现404错误。
即使在查看了许多示例代码并尝试将其变形为我们所需的代码之后,我也确信我仍能做到这一点。我们真正想要的只是将所有内容保留在网上,直到可以通过url访问,并将支持/注册重定向到静态页面。我也尝试通过使用重定向来编辑服务器文件,从而无法在Tomcat中做到这一点。感谢您提供的所有帮助。
这是我当前的web.xml,其中添加了名为page的新servlet
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
id="WebApp_ID" version="2.5">
<security-constraint>
<web-resource-collection>
<web-resource-name>
Software Registration System
</web-resource-name>
<url-pattern>/activate</url-pattern>
<url-pattern>/register</url-pattern>
<url-pattern>/admin</url-pattern>
<url-pattern>/admin/</url-pattern>
<url-pattern>/admin/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
<!-- Reads request input using UTF-8 encoding -->
<filter>
<filter-name>characterEncodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter>
<filter-name>osivFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>characterEncodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>osivFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.springframework.security.web.session.HttpSessionEventPublisher</listener-class>
</listener>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:/application-context.xml
classpath:/repository-context.xml
classpath:/security-context.xml
</param-value>
</context-param>
<servlet>
<servlet-name>Software Support System</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/support-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<session-config>
<session-timeout>8</session-timeout>
</session-config>
<servlet-mapping>
<servlet-name>Software Support System</servlet-name>
<url-pattern>/activate</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>page</servlet-name>
<jsp-file>/staticphppage.php</jsp-file>
</servlet>
<servlet-mapping>
<servlet-name>page</servlet-name>
<url-pattern>/register</url-pattern>
</servlet-mapping>
</web-app>