Create MessageController.java
This commit is contained in:
		
							parent
							
								
									067d99aaa5
								
							
						
					
					
						commit
						17166a5394
					
				| @ -0,0 +1,24 @@ | |||||||
|  | package com.baeldung.web.controller; | ||||||
|  | 
 | ||||||
|  | import org.springframework.stereotype.Controller; | ||||||
|  | import org.springframework.ui.Model; | ||||||
|  | import org.springframework.web.bind.annotation.RequestMapping; | ||||||
|  | import org.springframework.web.bind.annotation.RequestMethod; | ||||||
|  | import org.springframework.web.bind.annotation.RequestParam; | ||||||
|  | 
 | ||||||
|  | @Controller | ||||||
|  | @RequestMapping("/message") | ||||||
|  | public class MessageController { | ||||||
|  | 
 | ||||||
|  | 	@RequestMapping(value = "/showForm", method = RequestMethod.GET) | ||||||
|  | 	public String showForm() { | ||||||
|  | 		return "message"; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | 	@RequestMapping(value = "/processForm", method = RequestMethod.POST) | ||||||
|  | 	public String processForm(@RequestParam("message") final String message, final Model model) { | ||||||
|  | 		model.addAttribute("message", message); | ||||||
|  | 		return "message"; | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user