unable to call web application from the spring boot to send params through url.
balu123456 opened this issue · 4 comments
I am try to using Angularjs2 with spring boot application every thing working fine with the small issue.
Description:
step1. if we have default router like router('') meaning localhost:8080/ it is calling index.html page with out having issues.
step2. if we have added context path like router('accountsummary') meaning localhost:8080/accountsummary its not working. when i give like below configuration in spring boot conf like below:
@configuration
public class WebController extends WebMvcConfigurerAdapter{
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/accountSummary").setViewName("index.html");
}
}
it was working fine.
- when i want to configure like route('accountsummary/:reqid). reqid is the parameter meaning i want to call like localhost:8080/accountsummary/abc it is not working. i have given like (/**)
@configuration
public class WebController extends WebMvcConfigurerAdapter{
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/accountSummary/**").setViewName("index.html");
}
}
its not working and giving like below:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Thu Jun 30 15:11:38 EDT 2016
There was an unexpected error (type=Not Found, status=404).
No message available
Can any one pleae help me out
The ViewControllerRegistry can only be used to match a single path (not patterns). You would have to add an actual @Controller if you wanted to make it a pattern match. E.g. see the section on "natural routes" in this tutorial: https://spring.io/guides/tutorials/spring-security-and-angular-js/.
Thanks for adding label @dsyer
@dsyer : I am sorry to say, i really didnt understand the article which you have sent me. by any chance do we have any snippet code. i have make it some configuration like below in app configuration:
@controller
@configuration
public class WebController extends WebMvcConfigurerAdapter{
/*public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/accountSummary").setViewName("index.html");
}*/
@RequestMapping(value = "/{[accountSummary:[^\\.]*}")
public String redirect() {
return "forward:/index.html";
}
}
I think i may wrong, please let me know your suggestions.
That mapping doesn't look like a valid Spring MVC request mapping. The WebMvcConfigurerAdapter is now redundant as well, I guess. There's a lot of material on Spring MVC out there, so it might be a good idea to go and familiarize yourself with it. Please ask general usage questions on stackoverflow, and keep the discussion here to issues relevant to the guide content.