You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by ekoje ekoje <jo...@gmail.com> on 2007/02/28 13:04:00 UTC
Mgnt Error message
HI Guys,
I tried to manage some custom error messages using ActionMessage and
ActionError. I set the text message in the Action and redirect to the ERROR
result but I don't have any text displayed in the JSP when I use
actionmessage tag and actionerror tag.
Did i miss something ? any configuration ?
Please find my code,
Action:
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.interceptor.ServletRequestAware;
import com.opensymphony.xwork2.ActionSupport;
public class TestAction extends ActionSupport implements ServletRequestAware
{
private static final long serialVersionUID = -7505437345373234225L;
private HttpServletRequest request;
public String execute(){
addActionMessage("TESSSSSSSS");
addActionError("SECONDDDDDDDDDDD");
return ERROR;
}
public void setServletRequest(HttpServletRequest httpServletRequest) {
this.request = httpServletRequest;
}
}
JSP COde:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
</head>
<title>Insert title here</title>
</head>
<body>
<h3>Error Message</h3>
<s:actionerror />
<h3>Error Message</h3>
<s:fielderror />
<h3>Error Message</h3>
<s:actionmessage />
</body>
</html>
I will apreciate any help.
Thanks,
Re: Mgnt Error message
Posted by Nuwan Chandrasoma <my...@gmail.com>.
Hi,
I dont see
<%@ taglib prefix="s" uri="/struts-tags" %>
in your jsp page, this may be the problem.
Thanks,
Nuwan.
----- Original Message -----
From: "ekoje ekoje" <jo...@gmail.com>
To: "user" <us...@struts.apache.org>
Sent: Wednesday, February 28, 2007 12:04 PM
Subject: Mgnt Error message
> HI Guys,
>
> I tried to manage some custom error messages using ActionMessage and
> ActionError. I set the text message in the Action and redirect to the
> ERROR
> result but I don't have any text displayed in the JSP when I use
> actionmessage tag and actionerror tag.
>
> Did i miss something ? any configuration ?
>
> Please find my code,
>
> Action:
>
>
> import javax.servlet.http.HttpServletRequest;
>
> import org.apache.struts2.interceptor.ServletRequestAware;
>
> import com.opensymphony.xwork2.ActionSupport;
>
> public class TestAction extends ActionSupport implements
> ServletRequestAware
> {
>
> private static final long serialVersionUID = -7505437345373234225L;
>
> private HttpServletRequest request;
>
> public String execute(){
> addActionMessage("TESSSSSSSS");
> addActionError("SECONDDDDDDDDDDD");
> return ERROR;
> }
>
> public void setServletRequest(HttpServletRequest httpServletRequest) {
> this.request = httpServletRequest;
> }
> }
>
>
> JSP COde:
>
> <?xml version="1.0" encoding="ISO-8859-1" ?>
> <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
> pageEncoding="ISO-8859-1"%>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
> </head>
> <title>Insert title here</title>
> </head>
> <body>
> <h3>Error Message</h3>
>
> <s:actionerror />
>
> <h3>Error Message</h3>
> <s:fielderror />
>
> <h3>Error Message</h3>
> <s:actionmessage />
>
> </body>
> </html>
>
>
> I will apreciate any help.
>
> Thanks,
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org