Display Error Message to a jsp inside Frameset of another jsp in Spring
Exceptional Handling
I am trying to implement Spring Exceptional Handling following this
tutorial link.
For me the ErrorPage.jsp is inside the frameset of HomePage.jsp ,not
redirecting to a seperate page.Right now I struck when exception condition
raised within HomePage.jsp, the Error Message is not get reflected in
Errorpage.jsp(inside the frameset of HomePage.jsp) but wen i see in chrome
browser's on Developer Tool's for my Request , the Response is the source
code of ErrorPage.jsp with the status 200 ok and instance variable
${exception.exceptionMsg} in it is correctly replaced by Error Message
("Error Occured") .
Can any one help me out for this. I specifically need to do this using
spring...Thanks in Advance .My Goal is to Intimate the Different Exception
Reasons to user within a particular region.
ErrorPage.jsp
<html>
<head>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>....
</head>
<body>...<h3>${exception.exceptionMsg}</h3>...</body> // this was replaced
wit Err msg in response which is not reflected in ErrorPage.jsp of Actual
page
</html>
HomePage.jsp
<frameset rows="87%,*" border="1">
<frame name="ErrorPage" src="<c:url
value="/ErrorPage/?partial=1" />" >
</frameset>
spring-servlet.xml
<bean
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="exceptionMappings">
<props>
<prop key="com.controller.MyException">
ErrorPage
</prop>
</props>
</property>
</bean>
MyException.java
public class MyException extends Exception {
private String exceptionMsg;
public MyException(String exceptionMsg) {
this.exceptionMsg = exceptionMsg;
}
public String getExceptionMsg(){
return this.exceptionMsg;
}
public void setExceptionMsg(String exceptionMsg) {
this.exceptionMsg = exceptionMsg;
}
}
Thanks in Advance
No comments:
Post a Comment