Guest User

Untitled

a guest
Jan 19th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.58 KB | None | 0 0
  1. [THYMELEAF][http-nio-8080-exec-3] Exception processing template "login":
  2. Exception parsing document: template="login", line 6 - column 3
  3. 2015-08-11 16:09:07.922 ERROR 5756 --- [nio-8080-exec-3] o.a.c.c.C.[.[.[/].
  4. [dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet]
  5. in context with path [] threw exception [Request processing failed; nested
  6. exception is org.thymeleaf.exceptions.TemplateInputException: Exception
  7. parsing document: template="login", line 6 - column 3] with root cause
  8.  
  9. org.xml.sax.SAXParseException: The element type "meta" must be terminated by
  10. the matching end-tag "</meta>".
  11.  
  12. @Controller
  13. @EnableWebMvc
  14. public class WebController extends WebMvcConfigurerAdapter {
  15.  
  16. @Override
  17. public void addViewControllers(ViewControllerRegistry registry) {
  18. registry.addViewController("/index").setViewName("index");
  19. registry.addViewController("/results").setViewName("results");
  20. registry.addViewController("/login").setViewName("login");
  21. registry.addViewController("/form").setViewName("form");
  22. }
  23.  
  24. @RequestMapping(value="/", method = RequestMethod.GET)
  25. public String getHomePage(){
  26. return "index";
  27. }
  28.  
  29. @RequestMapping(value="/form", method=RequestMethod.GET)
  30. public String showForm(Person person) {
  31. return "form";
  32. }
  33.  
  34. @RequestMapping(value="/form", method=RequestMethod.POST)
  35. public String checkPersonInfo(@Valid Person person, BindingResult bindingResult) {
  36.  
  37. if (bindingResult.hasErrors()) {
  38. return "form";
  39. }
  40. return "redirect:/results";
  41. }
  42.  
  43. @Bean
  44. public ViewResolver getViewResolver() {
  45. InternalResourceViewResolver resolver = new InternalResourceViewResolver();
  46. resolver.setPrefix("templates/");
  47. //resolver.setSuffix(".html");
  48. return resolver;
  49. }
  50.  
  51. @Override
  52. public void configureDefaultServletHandling(
  53. DefaultServletHandlerConfigurer configurer) {
  54. configurer.enable();
  55. }
  56.  
  57. }
  58.  
  59. @Configuration
  60. @EnableWebMvcSecurity
  61. public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
  62.  
  63. @Override
  64. protected void configure(HttpSecurity http) throws Exception {
  65. http
  66. .authorizeRequests()
  67. .antMatchers("/", "/index").permitAll()
  68. .anyRequest().authenticated()
  69. .and()
  70. .formLogin()
  71. .loginPage("/login")
  72. .permitAll()
  73. .and()
  74. .logout()
  75. .permitAll();
  76. }
  77.  
  78. @Autowired
  79. public void configureGlobal(AuthenticationManagerBuilder auth) throws Exception {
  80. auth
  81. .inMemoryAuthentication()
  82. .withUser("user").password("password").roles("USER");
  83. }
  84. }
  85.  
  86. <!DOCTYPE html>
  87. <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
  88. <meta>
  89. <meta> charset="UTF-8">
  90. <title></title>
  91. </head>
  92. <body>
  93.  
  94. <h1>Welcome</h1>
  95.  
  96. <a href="../../login.html"><span>Click here to move to the next page</span></a>
  97.  
  98. </body>
  99.  
  100. </html>
  101.  
  102. <!DOCTYPE html>
  103. <html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
  104. <head>
  105. <meta> charset="UTF-8">
  106. <title></title>
  107. </head>
  108. <body>
  109.  
  110. <h1>Welcome</h1>
  111.  
  112. <a href="../../login.html"><span>Click here to move to the next page</span></a>
  113.  
  114. </body>
  115.  
  116. </html>
  117.  
  118. <html xmlns="http://www.w3.org/1999/xhtml"
  119. xmlns:th="http://www.thymeleaf.org"
  120. xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"
  121. xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout">
  122.  
  123. <head>
  124. <meta charset="utf-8" />
  125. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  126. <title>k</title>
  127. </head>
Add Comment
Please, Sign In to add comment