Question : No mapping found for HTTP request with URI [/MyWeb/help/webhelp.css] in DispatcherServlet with name 'help'

Hi,

I am new to spring/java and have picked up an existing web project in which i need to add a help page/s. A tech writer in the organization has created the help index using Author-IT which creates a tree-view like searchable help page.

The Author-IT pages consist of a large number of .htm, .css files in a root directory (/help) with .jpg and .js files in their own sub-directory(/help/images/ & /help/extjs/). I have placed this root folder in /WEB-INF/jsp/

I have modified the web.xml to include a new servlet and created the servlet and controller.

http://localhost:8080/MyWeb/help/help.form displays however none of the .css, images of js files seem to display/work.

As the help project is created by an external department within the organization and will be updated periodically I would like to be able to "dump" the content of the help project into the MyWeb project without editing it.

sample error:
2010-06-21 11:25:22,157 [@127.0.0.1] [http-8080-2] DEBUG au.com.enya.member.security.web.SecurityContextInitialiser - doFilter() - /MyWeb/help/stylesheet.css
2010-06-21 11:25:22,157 [@127.0.0.1] [http-8080-2] WARN  org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/MyWeb/help/stylesheet.css] in DispatcherServlet with name 'help'


My question:
Why am I receiving errors on all my images, css, js files and what needs to be done to avoid this so I can simply dump the help files into the MyWeb project?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
[web.xml] (part of):
	<servlet>
		<servlet-name>help</servlet-name>
		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
		<load-on-startup>4</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>help</servlet-name>
		<url-pattern>/help/*</url-pattern>
	</servlet-mapping>	





[help-servlet.xml]:
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">

<beans>
    <bean id="UrlResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass"><value>org.springframework.web.servlet.view.JstlView</value></property>
        <property name="prefix"><value>/WEB-INF/jsp/help/</value></property>
    </bean>

    <bean id="UrlSecureMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="interceptors">
            <list>
                <ref bean="ENYA.HibernateSessionInterceptor" />
                <ref bean="Member.SignonInterceptor" />
            </list>
        </property>
        <property name="mappings">
            <props>
                <prop key="/help.form">helpForm</prop>
            </props>
        </property>
    </bean>

	<bean id="helpForm" class="au.com.enya.help.web.HelpController">
 	</bean>   
    
</beans>




[HelpController.java]:
package au.com.enya.help.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

import au.com.enya.member.security.SecurityConstants;

public class HelpController implements Controller, SecurityConstants {

    public HelpController() {
    }

    public ModelAndView handleRequest(HttpServletRequest pRequest, HttpServletResponse pResponse)
            throws Exception {
        
        return new ModelAndView("index.jsp");
    }

}

Answer : No mapping found for HTTP request with URI [/MyWeb/help/webhelp.css] in DispatcherServlet with name 'help'

As the user is able to manually type in an address which allows login security to be bypassed i have move the folder back into the WEB-INF directory and done the following:

 - Changed help-servlet.xml:
From:   <prop key="/help.form">helpForm</prop>
To   <prop key="/*">helpForm</prop>

 - Changed web.xml back to how i orginally had it

 - Changed HelpController.java to be as per the attached code:

(Thanks for your assistance, points awarded to 'objects')
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
package au.com.enya.help.web;
 
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
 
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
 
import au.com.enya.member.security.SecurityConstants;
 
public class HelpController implements Controller, SecurityConstants {
 
    public HelpController() {
    }

    public ModelAndView handleRequest(HttpServletRequest pRequest, HttpServletResponse pResponse)
            throws Exception {

    		String uri = pRequest.getRequestURI();
 
            String token[] = uri.split("/");
            
        return new ModelAndView(token[token.length-1]);
    }

}
Random Solutions  
 
programming4us programming4us