When I am click on Submit button on jsp (Post request) my URL changed and my work flow not coming into controller class
First time when I hit URL http://localhost:9080/LaunchingGateway_Maintance/services/Test my jsp will be opend but when I click on Vendor button on jsp URL will changed to http://localhost:9080/validate and my flow not comming to my controller and on browser I got The webpage cannot be found
please help me I am stuck here from last two week.
my Controller class is : -
package com.us.launchingGatewayController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.us.bean.SSOConfigDynaFldsSrveLstBean;
import com.us.validator.SSOconfigValidator;
@Controller
public class LaunchingGatewayController {
@Autowired
SSOConfigDynaFldsSrveLstBean SSOConfigDynaFldsSrveLstBean;
@Autowired
ModelAndView modelNView;
@Autowired
SSOconfigValidator SSOConfigValidator;
@RequestMapping(value = "/Test", method = RequestMethod.GET)
public ModelAndView test(HttpServletRequest httpRequest, HttpServletResponse resp)throws Exception {
System.out.println("Test In test");
modelNView.setViewName("test");
return modelNView;
}
@RequestMapping(value = "/hello", method = RequestMethod.GET)
public String hello(){
System.out.println("hi");
return "test";
}
@RequestMapping(value = "/validate", method = RequestMethod.POST)
public ModelAndView validate(HttpServletRequest httpRequest, HttpServletResponse resp) throws Exception{
System.out.println("Test In Validate");
SSOConfigValidator.validateSSOconfig(SSOConfigDynaFldsSrveLstBean);
modelNView.setViewName("test");
return modelNView;
}
}
my jsp is :-
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<html>
<head>
<title>Launching Gateway Maintenance</title>
<script language="JavaScript" type="text/javascript">
</script>
</head>
<body bgcolor='#E8E8E8'>
<h1 align="center">Launching Gateway Maintenance</h1>
<form method="POST" action="/validate">
<center>
<input type="submit" name="validate" value="Vendor" />
</center>
</form>
</body>
</html>
my web.xml is :-
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>LaunchingGateway_Maintance</display-name>
<servlet>
<servlet-name>spring-dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-dispatcher-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring-dispatcher</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
my spring-dispatcher-servlet.xml is :-
<?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:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.1.xsd">
<context:component-scan base-package="com.us.launchingGatewayController" />
<bean id="ssoConfigValidator" class="com.us.validator.SSOconfigValidator"></bean>
<bean id="modelNView" class="org.springframework.web.servlet.ModelAndView"></bean>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="../jsp/" />
<property name="suffix" value=".jsp" />
</bean>
</beans>