Spring boot application returning the string name of the JSP rather than the JSP itself
I am developing a web app using Spring boot.
The use case is, if an user goes to home page, he will be redirected to a new unique URL each time. Eg: www.Qqd.com --> www.qqd.comjsdh.
Next time it would be something different, like www.qqd.comdkjfbd
But in both the cases, it will show same JSP.
I am doing it as a REST framework so that in future I can extend for mobile app development as well.
package com.example.qqd;
import org.apache.log4j.Logger;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@RestController
public class QDetailsService {
Logger log = Logger.getLogger(QDetailsService.class);
@GetMapping("/")
public ModelAndView getNewUrl(ModelMap model){
log.info("URL generated is: ");
return new ModelAndView("redirect:/"+"abcde", model);
}
@RequestMapping(value="/{url}")
public String addDetails(@PathVariable String url){
log.info("URL: " + url + " , detail: " );
//return new ModelAndView("home.jsp");
return "home";
}
}
ServletInitializer.java
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(QqdApplication.class);
}
}
QqdApplication.java
@SpringBootApplication //This annotation means, it is the starting point of the app.
public class QqdApplication extends SpringBootServletInitializer {
public static void main(String args) {
SpringApplication.run(QqdApplication.class, args);
}
}
spring jsp spring-mvc spring-boot
add a comment |
I am developing a web app using Spring boot.
The use case is, if an user goes to home page, he will be redirected to a new unique URL each time. Eg: www.Qqd.com --> www.qqd.comjsdh.
Next time it would be something different, like www.qqd.comdkjfbd
But in both the cases, it will show same JSP.
I am doing it as a REST framework so that in future I can extend for mobile app development as well.
package com.example.qqd;
import org.apache.log4j.Logger;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@RestController
public class QDetailsService {
Logger log = Logger.getLogger(QDetailsService.class);
@GetMapping("/")
public ModelAndView getNewUrl(ModelMap model){
log.info("URL generated is: ");
return new ModelAndView("redirect:/"+"abcde", model);
}
@RequestMapping(value="/{url}")
public String addDetails(@PathVariable String url){
log.info("URL: " + url + " , detail: " );
//return new ModelAndView("home.jsp");
return "home";
}
}
ServletInitializer.java
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(QqdApplication.class);
}
}
QqdApplication.java
@SpringBootApplication //This annotation means, it is the starting point of the app.
public class QqdApplication extends SpringBootServletInitializer {
public static void main(String args) {
SpringApplication.run(QqdApplication.class, args);
}
}
spring jsp spring-mvc spring-boot
1
You're using the@RestController
annotation. It should be@Controller
. RestController has @ResponseBody annotation which makes it bind responses to the body, rather than resolving a view.
– Strelok
Sep 11 '17 at 3:57
If I use @Controller, should the addDetails( ) return String or ModelAndView() ?
– Samttha Biby
Sep 11 '17 at 4:26
you can use either String or ModelAndView. Whatever you like.
– Strelok
Sep 11 '17 at 4:42
I tried both and I get There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 4:56
It's because your@RequestMapping(value="/{url}")
mapping is catching basically all URLS.
– Strelok
Sep 11 '17 at 5:53
add a comment |
I am developing a web app using Spring boot.
The use case is, if an user goes to home page, he will be redirected to a new unique URL each time. Eg: www.Qqd.com --> www.qqd.comjsdh.
Next time it would be something different, like www.qqd.comdkjfbd
But in both the cases, it will show same JSP.
I am doing it as a REST framework so that in future I can extend for mobile app development as well.
package com.example.qqd;
import org.apache.log4j.Logger;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@RestController
public class QDetailsService {
Logger log = Logger.getLogger(QDetailsService.class);
@GetMapping("/")
public ModelAndView getNewUrl(ModelMap model){
log.info("URL generated is: ");
return new ModelAndView("redirect:/"+"abcde", model);
}
@RequestMapping(value="/{url}")
public String addDetails(@PathVariable String url){
log.info("URL: " + url + " , detail: " );
//return new ModelAndView("home.jsp");
return "home";
}
}
ServletInitializer.java
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(QqdApplication.class);
}
}
QqdApplication.java
@SpringBootApplication //This annotation means, it is the starting point of the app.
public class QqdApplication extends SpringBootServletInitializer {
public static void main(String args) {
SpringApplication.run(QqdApplication.class, args);
}
}
spring jsp spring-mvc spring-boot
I am developing a web app using Spring boot.
The use case is, if an user goes to home page, he will be redirected to a new unique URL each time. Eg: www.Qqd.com --> www.qqd.comjsdh.
Next time it would be something different, like www.qqd.comdkjfbd
But in both the cases, it will show same JSP.
I am doing it as a REST framework so that in future I can extend for mobile app development as well.
package com.example.qqd;
import org.apache.log4j.Logger;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
@RestController
public class QDetailsService {
Logger log = Logger.getLogger(QDetailsService.class);
@GetMapping("/")
public ModelAndView getNewUrl(ModelMap model){
log.info("URL generated is: ");
return new ModelAndView("redirect:/"+"abcde", model);
}
@RequestMapping(value="/{url}")
public String addDetails(@PathVariable String url){
log.info("URL: " + url + " , detail: " );
//return new ModelAndView("home.jsp");
return "home";
}
}
ServletInitializer.java
public class ServletInitializer extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(QqdApplication.class);
}
}
QqdApplication.java
@SpringBootApplication //This annotation means, it is the starting point of the app.
public class QqdApplication extends SpringBootServletInitializer {
public static void main(String args) {
SpringApplication.run(QqdApplication.class, args);
}
}
spring jsp spring-mvc spring-boot
spring jsp spring-mvc spring-boot
edited Sep 11 '17 at 5:28
Samttha Biby
asked Sep 11 '17 at 1:23
Samttha BibySamttha Biby
236
236
1
You're using the@RestController
annotation. It should be@Controller
. RestController has @ResponseBody annotation which makes it bind responses to the body, rather than resolving a view.
– Strelok
Sep 11 '17 at 3:57
If I use @Controller, should the addDetails( ) return String or ModelAndView() ?
– Samttha Biby
Sep 11 '17 at 4:26
you can use either String or ModelAndView. Whatever you like.
– Strelok
Sep 11 '17 at 4:42
I tried both and I get There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 4:56
It's because your@RequestMapping(value="/{url}")
mapping is catching basically all URLS.
– Strelok
Sep 11 '17 at 5:53
add a comment |
1
You're using the@RestController
annotation. It should be@Controller
. RestController has @ResponseBody annotation which makes it bind responses to the body, rather than resolving a view.
– Strelok
Sep 11 '17 at 3:57
If I use @Controller, should the addDetails( ) return String or ModelAndView() ?
– Samttha Biby
Sep 11 '17 at 4:26
you can use either String or ModelAndView. Whatever you like.
– Strelok
Sep 11 '17 at 4:42
I tried both and I get There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 4:56
It's because your@RequestMapping(value="/{url}")
mapping is catching basically all URLS.
– Strelok
Sep 11 '17 at 5:53
1
1
You're using the
@RestController
annotation. It should be @Controller
. RestController has @ResponseBody annotation which makes it bind responses to the body, rather than resolving a view.– Strelok
Sep 11 '17 at 3:57
You're using the
@RestController
annotation. It should be @Controller
. RestController has @ResponseBody annotation which makes it bind responses to the body, rather than resolving a view.– Strelok
Sep 11 '17 at 3:57
If I use @Controller, should the addDetails( ) return String or ModelAndView() ?
– Samttha Biby
Sep 11 '17 at 4:26
If I use @Controller, should the addDetails( ) return String or ModelAndView() ?
– Samttha Biby
Sep 11 '17 at 4:26
you can use either String or ModelAndView. Whatever you like.
– Strelok
Sep 11 '17 at 4:42
you can use either String or ModelAndView. Whatever you like.
– Strelok
Sep 11 '17 at 4:42
I tried both and I get There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 4:56
I tried both and I get There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 4:56
It's because your
@RequestMapping(value="/{url}")
mapping is catching basically all URLS.– Strelok
Sep 11 '17 at 5:53
It's because your
@RequestMapping(value="/{url}")
mapping is catching basically all URLS.– Strelok
Sep 11 '17 at 5:53
add a comment |
3 Answers
3
active
oldest
votes
Have you tried returning the ModelAndView object? Notice that I removed the .jsp from home.jsp
@RequestMapping(value="/{url}")
public ModelAndView addDetails(@PathVariable String url){
log.info("URL: " + url + " , detail: " );
return new ModelAndView("home");
}
If I do that, I get this error : This application has no explicit mapping for /error, so you are seeing this as a fallback. There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 2:44
I don't have any resolver like web.xml or anything. All I have is pom.xml. Before Spring boot, in usual Spring MVC I use to configure in xml.
– Samttha Biby
Sep 11 '17 at 2:52
add a comment |
Ok, I myself found the solution and following did work
Step1: Have the following lines in application.properties
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
Step 2: I don't see Spring tool suite creating WEB-INF/jsp
folders under src/webapp
. So create it and move the jsp under that folder.
This worked like a charm. Thanks everyone for helping me.
add a comment |
This is a big issue i almost spent more than 2 hour but finally able to resolve.
Step 1 : add to application.properties :-
- spring.mvc.view.prefix=/WEB-INF/pages/
- spring.mvc.view.suffix=.jsp
Step 2 : add to pom.xml : -
-dependency
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
Controller
@RequestMapping(value="/homepage",method=RequestMethod.GET)
public String hello(Model model)
{
model.addAttribute("message","Hello");
return "myjsppage";
}
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46147054%2fspring-boot-application-returning-the-string-name-of-the-jsp-rather-than-the-jsp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Have you tried returning the ModelAndView object? Notice that I removed the .jsp from home.jsp
@RequestMapping(value="/{url}")
public ModelAndView addDetails(@PathVariable String url){
log.info("URL: " + url + " , detail: " );
return new ModelAndView("home");
}
If I do that, I get this error : This application has no explicit mapping for /error, so you are seeing this as a fallback. There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 2:44
I don't have any resolver like web.xml or anything. All I have is pom.xml. Before Spring boot, in usual Spring MVC I use to configure in xml.
– Samttha Biby
Sep 11 '17 at 2:52
add a comment |
Have you tried returning the ModelAndView object? Notice that I removed the .jsp from home.jsp
@RequestMapping(value="/{url}")
public ModelAndView addDetails(@PathVariable String url){
log.info("URL: " + url + " , detail: " );
return new ModelAndView("home");
}
If I do that, I get this error : This application has no explicit mapping for /error, so you are seeing this as a fallback. There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 2:44
I don't have any resolver like web.xml or anything. All I have is pom.xml. Before Spring boot, in usual Spring MVC I use to configure in xml.
– Samttha Biby
Sep 11 '17 at 2:52
add a comment |
Have you tried returning the ModelAndView object? Notice that I removed the .jsp from home.jsp
@RequestMapping(value="/{url}")
public ModelAndView addDetails(@PathVariable String url){
log.info("URL: " + url + " , detail: " );
return new ModelAndView("home");
}
Have you tried returning the ModelAndView object? Notice that I removed the .jsp from home.jsp
@RequestMapping(value="/{url}")
public ModelAndView addDetails(@PathVariable String url){
log.info("URL: " + url + " , detail: " );
return new ModelAndView("home");
}
answered Sep 11 '17 at 2:19
Fabian RiveraFabian Rivera
558212
558212
If I do that, I get this error : This application has no explicit mapping for /error, so you are seeing this as a fallback. There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 2:44
I don't have any resolver like web.xml or anything. All I have is pom.xml. Before Spring boot, in usual Spring MVC I use to configure in xml.
– Samttha Biby
Sep 11 '17 at 2:52
add a comment |
If I do that, I get this error : This application has no explicit mapping for /error, so you are seeing this as a fallback. There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 2:44
I don't have any resolver like web.xml or anything. All I have is pom.xml. Before Spring boot, in usual Spring MVC I use to configure in xml.
– Samttha Biby
Sep 11 '17 at 2:52
If I do that, I get this error : This application has no explicit mapping for /error, so you are seeing this as a fallback. There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 2:44
If I do that, I get this error : This application has no explicit mapping for /error, so you are seeing this as a fallback. There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 2:44
I don't have any resolver like web.xml or anything. All I have is pom.xml. Before Spring boot, in usual Spring MVC I use to configure in xml.
– Samttha Biby
Sep 11 '17 at 2:52
I don't have any resolver like web.xml or anything. All I have is pom.xml. Before Spring boot, in usual Spring MVC I use to configure in xml.
– Samttha Biby
Sep 11 '17 at 2:52
add a comment |
Ok, I myself found the solution and following did work
Step1: Have the following lines in application.properties
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
Step 2: I don't see Spring tool suite creating WEB-INF/jsp
folders under src/webapp
. So create it and move the jsp under that folder.
This worked like a charm. Thanks everyone for helping me.
add a comment |
Ok, I myself found the solution and following did work
Step1: Have the following lines in application.properties
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
Step 2: I don't see Spring tool suite creating WEB-INF/jsp
folders under src/webapp
. So create it and move the jsp under that folder.
This worked like a charm. Thanks everyone for helping me.
add a comment |
Ok, I myself found the solution and following did work
Step1: Have the following lines in application.properties
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
Step 2: I don't see Spring tool suite creating WEB-INF/jsp
folders under src/webapp
. So create it and move the jsp under that folder.
This worked like a charm. Thanks everyone for helping me.
Ok, I myself found the solution and following did work
Step1: Have the following lines in application.properties
spring.mvc.view.prefix: /WEB-INF/jsp/
spring.mvc.view.suffix: .jsp
Step 2: I don't see Spring tool suite creating WEB-INF/jsp
folders under src/webapp
. So create it and move the jsp under that folder.
This worked like a charm. Thanks everyone for helping me.
answered Sep 11 '17 at 7:05
Samttha BibySamttha Biby
236
236
add a comment |
add a comment |
This is a big issue i almost spent more than 2 hour but finally able to resolve.
Step 1 : add to application.properties :-
- spring.mvc.view.prefix=/WEB-INF/pages/
- spring.mvc.view.suffix=.jsp
Step 2 : add to pom.xml : -
-dependency
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
Controller
@RequestMapping(value="/homepage",method=RequestMethod.GET)
public String hello(Model model)
{
model.addAttribute("message","Hello");
return "myjsppage";
}
add a comment |
This is a big issue i almost spent more than 2 hour but finally able to resolve.
Step 1 : add to application.properties :-
- spring.mvc.view.prefix=/WEB-INF/pages/
- spring.mvc.view.suffix=.jsp
Step 2 : add to pom.xml : -
-dependency
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
Controller
@RequestMapping(value="/homepage",method=RequestMethod.GET)
public String hello(Model model)
{
model.addAttribute("message","Hello");
return "myjsppage";
}
add a comment |
This is a big issue i almost spent more than 2 hour but finally able to resolve.
Step 1 : add to application.properties :-
- spring.mvc.view.prefix=/WEB-INF/pages/
- spring.mvc.view.suffix=.jsp
Step 2 : add to pom.xml : -
-dependency
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
Controller
@RequestMapping(value="/homepage",method=RequestMethod.GET)
public String hello(Model model)
{
model.addAttribute("message","Hello");
return "myjsppage";
}
This is a big issue i almost spent more than 2 hour but finally able to resolve.
Step 1 : add to application.properties :-
- spring.mvc.view.prefix=/WEB-INF/pages/
- spring.mvc.view.suffix=.jsp
Step 2 : add to pom.xml : -
-dependency
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
Controller
@RequestMapping(value="/homepage",method=RequestMethod.GET)
public String hello(Model model)
{
model.addAttribute("message","Hello");
return "myjsppage";
}
edited Nov 23 '18 at 14:38
Triyugi Narayan Mani
1,06841527
1,06841527
answered Nov 23 '18 at 11:55
Sunil JakharSunil Jakhar
112
112
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f46147054%2fspring-boot-application-returning-the-string-name-of-the-jsp-rather-than-the-jsp%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
You're using the
@RestController
annotation. It should be@Controller
. RestController has @ResponseBody annotation which makes it bind responses to the body, rather than resolving a view.– Strelok
Sep 11 '17 at 3:57
If I use @Controller, should the addDetails( ) return String or ModelAndView() ?
– Samttha Biby
Sep 11 '17 at 4:26
you can use either String or ModelAndView. Whatever you like.
– Strelok
Sep 11 '17 at 4:42
I tried both and I get There was an unexpected error (type=Internal Server Error, status=500). Circular view path [home]: would dispatch back to the current handler URL [/Qqd/home] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
– Samttha Biby
Sep 11 '17 at 4:56
It's because your
@RequestMapping(value="/{url}")
mapping is catching basically all URLS.– Strelok
Sep 11 '17 at 5:53