spring mvc application to navigate flow from controller to jsp or servlet of another application -


i using spring mvc application. want redirect controller or jsp second application developed in plain servlet , jsps.

how can navigate flow 1 apps servlet/jsps apps jsp.

i have used following lines in controller navigate:

first:

return new modelandview("redirect:/http://localhost:9090/marathiinput/test.jsp"); 

second:

response.sendredirect("http://localhost:9090/marathiinput/test.jsp"); 

currently controller :

@requestmapping(value = "/transfercertificate", method = requestmethod.get) public modelandview get(modelmap map ,httpservletresponse response) {     response.sendredirect("localhost:9090/marathiinput/test.jsp"); } 

and in jsp calling :

<a href="/transfercertificate" class="sis_nav_link">generate tc</a> link 

you have small errors in both tries, both can used.

assuming method controller declared return modelandview can use :

return new modelandview("redirect:http://localhost:9090/marathiinput/test.jsp"); 

if declared return string :

return "redirect:http://localhost:9090/marathiinput/test.jsp"; 

alternatively provided controller method has response parameter, can redirect in controller, have processed response, method must return null :

response.sendredirect("http://localhost:9090/marathiinput/test.jsp"); return null; 

so use :

@requestmapping(value = "/transfercertificate", method = requestmethod.get) public modelandview get(modelmap map ,httpservletresponse response) {     response.sendredirect("http://localhost:9090/marathiinput/test.jsp");     return null; } 

or :

@requestmapping(value = "/transfercertificate", method = requestmethod.get) public string get(modelmap map ,httpservletresponse response) {     return "redirect:http://localhost:9090/marathiinput/test.jsp"); } 

but make sure link includes servlet context , servlet path :

<a href="/application/dispatcher_servlet_path/transfercertificate" class="sis_nav_link">generate tc</a> link 

Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -