You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Ramesh Mekkara, ASDC Chennai" <ra...@hcltech.com> on 2005/07/15 15:18:46 UTC

help needed - struts internatonalization

Hi All,

I have an Application built on EJB-Struts framework. I need to implement
internationalization on all jsp pages which we view. How can it be done ?
  
 
 

Necessity is the Mother of Invention. 
_______________________________________________________ 
Ramesh Mekkara
Software Engineer 
HCL Technologies 109, Sapna Trade Center, P.H.Road Chennai - 84, India *
rameshm@hcltech.com <ma...@hcltech.com> * Office #: +91-44-28221119
| Extn #: 2217 * Mobile #: +91-9840709983
________________________________________________________ 

This message and any attachment(s) contained here are information that is
confidential, proprietary to HCL Technologies and its customers. Contents
may be privileged or otherwise protected by law. The information is solely
intended for the individual or the entity it is addressed to. If you are not
the intended recipient of this message, you are not authorized to read,
forward, print, retain, copy or disseminate this message or any part of it.
If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.



-----Original Message-----
From: Ext.Ilitia2@dinosol.es [mailto:Ext.Ilitia2@dinosol.es]
Sent: Friday, July 15, 2005 6:34 PM
To: Struts Users Mailing List
Subject: Re: Some advice



Ok... mayby that an example

This is a posible ActionForm..... the variable "flag" indicates the type of
validation that needs

public class CosaForm extends ActionForm {

      private String nombre = "";
      private String apellidos = "";
      private String telefono = "";
      private String direccion = "";
      private String flag = ""; //The hidden field

      public void reset(ActionMapping arg0, HttpServletRequest arg1) {
            nombre = "";
            apellidos = "";
            telefono = "";
             direccion = "";
      }

      public ActionErrors validate(ActionMapping arg0, HttpServletRequest
arg1) {
            ActionErrors errors = new ActionErrors();

            if(flag.equals("onlyName")){
                  if(nombre.trim().length() == 0)
                        errors.add("validaForm", new ActionError
("error.name.void"));

            else if(flag.equals("onlyAddresTelephone")){
                  if(direccion.trim().length() == 0)
                        errors.add("validaForm", new ActionError
("error.addres.void"));

                  else if(telefono.trim().length() == 0 || telefono.trim
().length() > 9)
                        errors.add("validaForm", new ActionError
("error.thelepone"));
              }

            return errors;
      }



      /**
       *
       */
      public AnadirForm() {
      }

      public String getApellidos() {return apellidos;}
      public void setApellidos(String apellidos) {this.apellidos =
apellidos;}
      public String getNombre() {return nombre;}
      public void setNombre(String nombre) {this.nombre = nombre;}
      public String getTelefono() {return telefono;}
      public void setTelefono(String telefono) {this.telefono = telefono;}
      public String getDireccion() {return direccion;}
      public void setDireccion(String direccion) {this.direccion =
direccion;}

}



|---------+---------------------------->
|         |           Rafael Taboada   |
|         |           <kaliman.forever@|
|         |           gmail.com>       |
|         |                            |
|         |           15/07/2005 14:20 |
|         |           Please respond to|
|         |           "Struts Users    |
|         |           Mailing List"    |
|         |                            |
|         |                            |
|         |                            |
|         |                            |
|---------+---------------------------->
 
>---------------------------------------------------------------------------
-----------------------------------------------------|
  |
|
  |       To:       Struts Users Mailing List <us...@struts.apache.org>
|
  |       cc:
|
  |       bcc:
|
  |       Subject:  Re: Some advice
|
 
>---------------------------------------------------------------------------
-----------------------------------------------------|




Hi Basudeb Acharya for ur help... It's really that I want =)
 Ex.llitia2. I'd like you are more specific. My code in ActionForm is:
 ActionErrors errors = ventaForm.validate(mapping,request);

if (errors==null || errors.isEmpty()) {
 //Do something because all is OK
}
else
saveErrors(request,errors);


--
Rafael Taboada
Software Engineer

Cell : +511-97753290

"No creo en el destino pues no me gusta tener la idea de controlar mi vida"






---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

Re: help needed - struts internatonalization

Posted by Laurie Harper <la...@holoweb.net>.
Ramesh Mekkara, ASDC Chennai wrote:
> I have an Application built on EJB-Struts framework. I need to implement
> internationalization on all jsp pages which we view. How can it be done ?

That's a big topic... :-) You might want to be a bit more specific about 
what you need to know, but as a starting point take a look at the 
<bean:message/> tag in Struts [1] and the format taglib in JSTL [2].

L.

[1] http://struts.apache.org/userGuide/struts-bean.html#message
[2] http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html
-- 
Laurie, Open Source advocate, Java geek and novice blogger:
http://www.holoweb.net/~laurie/


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org