Hi Ganesh,
 Listing down what all has to be done to display error message
when you are using resource bundle and tiles definition.

This is a very simple example which should give you a picture of 
how to go about it.
 

application.properties ( The resource bundle file )
error.auth.failure=Error:Not authorized to access this page.

Including a snippet of an example Action class.

 public final class UserConfAction extends DispatchAction {

 public ActionForward addUser(ActionMapping mapping,
                              ActionForm form,
                              HttpServletRequest request,
                              HttpServletResponse response)
 throws Exception {


         try {

             authMgr.createUser(sessionKey, user);

         } catch (AuthException aex) {
           
            // Code to handle container based error condition.
            ActionErrors errors = new ActionErrors();
            errors.add(ActionErrors.GLOBAL_ERROR,
            new ActionError("error.auth.failure"));
            saveErrors(request,errors);
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />           
 
            return mapping.findForward("failure");
         }

         return mapping.findForward("success");
 
  }

}

struts configuration file ( struts-config.xml )
 
  <action 
    path="/UserConfig"
    type="com.action.main.UserConfAction"
    scope="request"
    parameter="method" >  
    <forward name="success" path="Success"/>
    <forward name="failure" path="Failure"/>
 </action>
 
tiles defintion file ( tiles-defs.xml )
 
<!-- Definition for the Failure -->
 <definition name="Failure" extends="configBaseDef">
    <put name="top" value="/WEB-INF/pages/top.jsp"/>
    <put name="body" value="/WEB-INF/pages/userconf.jsp"/>
    <put name="top" value="/WEB-INF/pages/bottom.jsp"/>
 </definition>
 
Say the error message to be displayed will be in the body part of
this layout. So, in the userconf.jsp you need to have something like this
 
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>


<!-- Error Block  -->
 
<tr>
  <td align="center" colSpan="2">
    <html:errors/>
  </td>
<tr>

 
Hope this should give you a fair idea on how to do the implementation.
 
Cheers,
Ashutosh Satyam


-----Original Message-----
From: Ganesh Rao [ mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 01, 2004 11:01 AM
To: Struts Users Mailing List
Subject: Error messages in tiles using tiles-defs.xml



Hi everybody!

Can anybody tell  me how to display error messages using saveErrors()

from resouecebundle properties.

Here i'm using tiles.So i need to follow tiles-defs.xml file configureation rules.

Ur help thankfully accepted.

Ganesh



               
---------------------------------
  Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download 
Messenger Now

Reply via email to