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,

Reply via email to