Announcement Announcement Module
Collapse
No announcement yet.
Controller for each JSP page Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Controller for each JSP page

    Hi, I approached Spring recently.

    I have two JSP and I want everyone to create a control, is it possible? It 's the best way?

    My springapp-servlet.xml is thus formed:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:p="http://www.springframework.org/schema/p"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
    
        <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
        
        <!--
        Most controllers will use the ControllerClassNameHandlerMapping above, but
        for the index controller we are using ParameterizableViewController, so we must
        define an explicit mapping for it.
        -->
        <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
    
        <bean name="hello.htm" class="springapp.web.HelloController"/>
    
        <bean name="/gioacchino.htm" class="springapp.web.HelloController2"/>
    
    </beans>
    In hello.jsp there is a link to gioacchino.htm but when I get an error like this:

    HTTP Status 404

    and the server reports:

    and the server reports

    Can anyone help me? Thanks!
    Last edited by joaquin; Jan 11th, 2011, 02:58 PM.

  • #2
    I have resolved, my file springapp-servlet.xml now is this formed:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:p="http://www.springframework.org/schema/p"
           xmlns:aop="http://www.springframework.org/schema/aop"
           xmlns:tx="http://www.springframework.org/schema/tx"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
           http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
           http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
    
        <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
        
        <!--
        Most controllers will use the ControllerClassNameHandlerMapping above, but
        for the index controller we are using ParameterizableViewController, so we must
        define an explicit mapping for it.
        -->
        <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
    
        <bean name="hello.htm" class="springapp.web.HelloController"/>
    
        <bean name="gioacchino" class="springapp.web.HelloController2"/>
    
        <bean id="urlMapping"
    		class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
    
    		<property name="mappings">
    			<props>
    				<prop key="/gioacchino.htm">gioacchino</prop>
    			</props>
    		</property>
    
    	</bean>
    
    
    </beans>

    Comment

    Working...
    X