Discussions

Web tier: servlets, JSP, Web frameworks: ActionMessages are not being displayed in jsp page

  1. ActionMessages are not being displayed in jsp page (1 messages)

    Hi all, I am writing a struts application module that validates a users existance and report confirmation through messages. my code for action class is: ************************************** public ActionForward subscribe(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if(subscriber == null){//checks the availability of subscriber ActionMessages empMsg = new ActionMessages(); ActionMessage msg = new ActionMessage("subscribe.success"); //subscribe.success is associated with a message in //properties file empMsg.add("MessageId", msg); saveMessages(request, empMsg); return mapping.findForward("success"); } else { ActionMessages empMsg = new ActionMessages(); ActionMessage msg = new ctionMessage("error.alreadyMember"); empMsg.add("ErrorId", msg); saveMessages(request, empMsg); return mapping.findForward("success"); } } ***************************** In jsp I am accessing them using Thir Id: I am not getting these messages in the result I am using sitemesh to decorate my pages Can any one please tell me where am I going wrong. Thanks in Advanse.
  2. modified your code to make it work : for details check out this link : http://javaboutique.internet.com/tutorials/excep_struts/index-2.html http://struts.apache.org/1.x/struts-taglib/tagreference.html#messages hope this helps .. Bhagvan K http://www.jroller.com/page/bhagvank