Removed Tomcat Plugin from pom.xml, rename Userdetails to User and moved
the controller to web
This commit is contained in:
parent
8306f357b3
commit
f553c8f049
@ -164,14 +164,6 @@
|
|||||||
</configuration>
|
</configuration>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.tomcat.maven</groupId>
|
|
||||||
<artifactId>tomcat7-maven-plugin</artifactId>
|
|
||||||
<version>2.2</version>
|
|
||||||
<configuration>
|
|
||||||
<path>/</path>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
<properties>
|
<properties>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.baeldung.model;
|
package org.baeldung.model;
|
||||||
|
|
||||||
public class UserDetails {
|
public class User {
|
||||||
private String firstname;
|
private String firstname;
|
||||||
private String lastname;
|
private String lastname;
|
||||||
private String emailId;
|
private String emailId;
|
@ -6,7 +6,6 @@ import java.util.Set;
|
|||||||
import org.baeldung.dialect.CustomDialect;
|
import org.baeldung.dialect.CustomDialect;
|
||||||
import org.springframework.context.MessageSource;
|
import org.springframework.context.MessageSource;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.context.annotation.Description;
|
import org.springframework.context.annotation.Description;
|
||||||
import org.springframework.context.support.ResourceBundleMessageSource;
|
import org.springframework.context.support.ResourceBundleMessageSource;
|
||||||
@ -24,7 +23,6 @@ import org.thymeleaf.templateresolver.ServletContextTemplateResolver;
|
|||||||
|
|
||||||
@EnableWebMvc
|
@EnableWebMvc
|
||||||
@Configuration
|
@Configuration
|
||||||
@ComponentScan("org.baeldung.controller")
|
|
||||||
public class ClientWebConfig extends WebMvcConfigurerAdapter {
|
public class ClientWebConfig extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
public ClientWebConfig() {
|
public ClientWebConfig() {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.baeldung.controller;
|
package org.baeldung.web.controller;
|
||||||
|
|
||||||
import org.baeldung.model.UserDetails;
|
import org.baeldung.model.User;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
@ -13,7 +13,7 @@ public class UserController {
|
|||||||
|
|
||||||
@RequestMapping(value = "/", method = RequestMethod.GET)
|
@RequestMapping(value = "/", method = RequestMethod.GET)
|
||||||
public String showForm(final Model model) {
|
public String showForm(final Model model) {
|
||||||
final UserDetails user = new UserDetails();
|
final User user = new User();
|
||||||
user.setFirstname("John");
|
user.setFirstname("John");
|
||||||
user.setLastname("Roy");
|
user.setLastname("Roy");
|
||||||
user.setEmailId("John.Roy@gmail.com");
|
user.setEmailId("John.Roy@gmail.com");
|
||||||
@ -22,8 +22,9 @@ public class UserController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/processForm", method = RequestMethod.POST)
|
@RequestMapping(value = "/processForm", method = RequestMethod.POST)
|
||||||
public String processForm(@ModelAttribute(value = "user") final UserDetails user, final Model model) {
|
public String processForm(@ModelAttribute(value = "user") final User user,
|
||||||
// Insert userDetails into DB
|
final Model model) {
|
||||||
|
// Insert User into DB
|
||||||
model.addAttribute("name", user.getFirstname() + " " + user.getLastname());
|
model.addAttribute("name", user.getFirstname() + " " + user.getLastname());
|
||||||
return "hello";
|
return "hello";
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user