Spring MVC Annotation with Multiple URL mapping and wildcard


This tutorial will show how to map more than one URL to Same controller using Annotation 

Code

package com.candidjava.springmvc;

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

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;


@Controller
public class CustomerController
{
	@RequestMapping(value={"/customer.htm","/customer1/*.htm"})	
	public ModelAndView addCustomer(HttpServletRequest request, HttpServletResponse response)
	{
		ModelAndView model = new ModelAndView("page");

		model.addObject("msg", "RequestMapping with Multiple URL!");

		return model;
	}

	
}

Screenshot
            



Download
            Spring MVC Annotation Multiple Url maven zip
            Spring MVC Annotation Multiple Url war
            



Comments


©candidjava.com