note

Spring 예외처리 본문

JSP/Spring

Spring 예외처리

투한 2012. 3. 6. 11:57






















dispatcher-servlet.xml





	
	
		
			
				
					error/mathException
				
				
					error/exception
				
			
		
	
	
	
	
		
		
	
	
	
	
	 
	 	
	 		messages.validation
	 	
	 
	





ArithmeticOperatorController.java
package madvirus.spring.chap06.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class ArithmeticOperatorController {

	@RequestMapping("/math/divide.do")
	public String divide(
			@RequestParam("op1") int op1,
			@RequestParam("op2") int op2, Model model) {
		

		model.addAttribute("result",op1/op2);

		return "math/result";
	}
}




math/result.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>




연산 성공


연산 성공





aa
aaa