Java – Spring MVC – Form Mapping

javaspringspring-mvc

Probably missing something completely obvious here, but here goes. I'm starting out with Spring MVC. I have a form controller to process inbound requests to /share/edit.html. When I hit this url from my browser, I get the following error:

 The requested resource (/inbox/share/share/edit) is not available.

Here is my applicationContext-mvc.xml:

 <bean id="publicUrlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" >
        <property name="mappings" >
            <value>
                /share/edit.html=shareFormController
                /share/list.html=shareController
                /share/view.html=shareController
                /folders.json=foldersController
                /studies.json=studiesController
            </value>
        </property>
    </bean>


<bean id="internalPathMethodNameResolver" class="org.springframework.web.servlet.mvc.multiaction.InternalPathMethodNameResolver" />

<bean id="shareFormController" class="com.lifeimage.lila.controller.ShareFormController" />
<bean id="shareController" class="com.lifeimage.lila.controller.ShareController" >
    <property name="methodNameResolver" ref="internalPathMethodNameResolver" />
</bean>

and my form Controller:

public class ShareFormController extends SimpleFormController {

    public ShareFormController() {
        setCommandClass( Share.class );
    }

    @Override
    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors)
            throws Exception {

        //controller impl...

    }



}

Best Solution

You should look at your view resolver. Make sure that it is resolving the logical name in your controller as you think it should. Looks like the name it is resolving it to does not exist currently