java - Resolve a URL request containing .jsp in Spring -
java - Resolve a URL request containing .jsp in Spring -
i have created spring web mvc project. want handle request with .jsp in url such request .jsp in url handled same controller.
following url pattern using in web.xml
<servlet-mapping> <servlet-name>project</servlet-name> <url-pattern>/</url-pattern> </servlet-mapping>
the annotation in controller looks this
@requestmapping("/welcome")
with able resolve url of form http://localhost:8080/project/welcome
but not 1 : http://localhost:8080/project/welcome.jsp
that's uncommon requirement spring mvc controller, spring is versatile tool.
you can seek (untested ...) :
@requestmapping("/{name}.jsp") public modelandview jsphandler(@pathvariable("name") string name) { ...
the controller *.jsp
requests , find in name
variable real name has been called
java spring jsp spring-mvc
Comments
Post a Comment