Hi
I am very new to Spring MVC and trying to understand the flow. I have created an image menu that expands with sub menus. I can get the index page to load but when I click on a submenu, that page does not load. Can some one take a look at the following files and let me know what I am missing? I have been working on this for a week and can't figure out how to get to my next jsp.
DispatcherServlet
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 id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="index.htm">indexController</prop> <prop key="lienbystate.htm">lienByStateController</prop> </props> </property> </bean> <!-- The index controller. --> <bean name="indexController" class="org.springframework.web.servlet.mvc.ParameterizableViewController" p:viewName="index" /> <bean name="lienByStateController" class="org.springframework.web.servlet.mvc.ParameterizableViewController" p:viewName="lienByState" /> </beans>
springapp servlet
JSPCode:<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd"> <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver"> <property name="viewClass"> <value>org.springframework.web.servlet.view.JstlView</value> </property> <property name="prefix"> <value>/WEB-INF/jsp/</value> </property> <property name="suffix"> <value>.jsp</value> </property> </bean> </beans>
Index ControllerCode:<%@ include file="/WEB-INF/jsp/include.jsp" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@page contentType="text/html" pageEncoding="UTF-8"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Welcome to LienLogic's Investment Portfolio Management System</title> <link href="css/jimgMenu.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="js/jquery-1.7.1.js"></script> <script type="text/javascript" src="js/jquery-easing-1.3.pack.js"></script> <script type="text/javascript" src="js/jquery-easing-compatibility.1.2.pack.js"></script> <script type="text/javascript"> $(document).ready(function () { // find the elements to be eased and hook the hover event $('ul.jimgMenu li a').hover(function() { // if the element is currently being animated if ($(this).is(':animated')) { $(this).stop().animate({width: "260px"}, {duration: 450, easing:"easeOutQuad", complete: "callback"}); } else { // ease in quickly $(this).stop().animate({width: "260px"}, {duration: 400, easing:"easeOutQuad", complete: "callback"}); } }, function () { // on hovering out, ease the element out if ($(this).is(':animated')) { $(this).stop().animate({width: "78px"}, {duration: 400, easing:"easeInOutQuad", complete: "callback"}) } else { // ease out slowly $(this).stop(':animated').animate({width: "78px"}, {duration: 450, easing:"easeInOutQuad", complete: "callback"}); } }); /* , function () { // submenu var $elem = $(this); var $submenu = $elem.find('.submenulien'); if($submenu.length){ var left = '170px'; if($elem.parent().children().length == $elem.index()+1) left = '-170px'; $submenu.show().animate({'left':left},200) } });*/ }); </script> </head> <body> <img src="<%=request.getContextPath()%>/img/LienLogicLogo.jpg" alt="LienLogic, Inc."/> </br> </br> <ul class="jimgMenu"> <li class="taxlien" style="background-position:0 0;"> <a href="#">Lien Management</a> <ul class="submenulien"> <li id="liensummary"><a href="#">Lien Summary</a></li> <li><a href="#">Find Lien</a></li> <li><a href="#">Import Liens</a></li> <li><a href="#">Redemptions</a></li> <li><a href="#">Manage Subs</a></li> <li><a href="#">Reports</a></li> </ul> </li> <li class="financial"><a href="#">Financial Management</a></li> <li class="investor"><a href="#">Investor Management</a></li> <li class="property"><a href="#">Property Management</a></li> </ul> <%-- </div> --%> </body> </html>
Thanks for your assistanceCode:package lienlogic.web; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; /** * Handles request for the application home(index) page */ @Controller public class IndexController { @RequestMapping(value = "/") public String index(){ System.out.println("IndexController: Passing through..."); return "index"; //return "WEB-INF/jsp/index.jsp"; } @RequestMapping("/lienByState.htm") public String lienByState(){ System.out.println("LienByStateController: Passing through..."); return "lienByState"; } }


Reply With Quote