File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes html:messages problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:messages problem" Watch "html:messages problem" New topic

html:messages problem

prashanth Kotla

Joined: Jun 02, 2008
Posts: 9
Hello Friends,

This is prashanth,I am facing some problem while doing struts application using messages tag in jsp.
i am using struts 1.2 version.
Mycode is given bellow....
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"


<action path="/mess" type="com.cts.ErrorAction" >
<forward name="go2jsp" path="/erromess.jsp"/>

<message-resources parameter="errorinfo"/>
package com.cts;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;
public class ErrorAction extends Action {
public ActionForward execute(ActionMapping map,ActionForm form,HttpServletRequest req,HttpServletResponse res)throws Exception{
// ActionMessage mes=new ActionMessage("name.required");
// ActionMessage mes1=new ActionMessage("id.required");
// ActionMessage mes2=new ActionMessage("id.integer");
ActionMessages message=new ActionMessages();
message.add("pmes1",new ActionMessage("id.integer"));
saveMessages(req, message);
System.out.println("end of execute");
return map.findForward("go2jsp");


<%@ taglib uri="" prefix="bean" %>
<%@ taglib uri="" prefix="html" %>
<html:messages property="pmes1" id="msg" message="false">
<li><bean:write name="msg"/></li>
id.integer=not integer
Actuvally i need output not integer in browser,but it is not displaying any meaasage ,only blank screen showing.
if any one knows this problem ,please assist me .
message.only blank screen
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Use the method saveErrors rather than saveMessages in your Action class.

Consultant, Sima Solutions
I agree. Here's the link:
subject: html:messages problem
It's not a secret anymore!