RE: about html:error ( error handling )

2002-11-13 Thread Alex Almero
could you post a sample code tnx

aalmero

-Original Message-
From: wolfgang [mailto:wolfgang127jp@;ybb.ne.jp]
Sent: Wednesday, November 13, 2002 3:01 AM
To: Struts Users Mailing List
Subject: Re: about html:error ( error handling )


Hi there,

Finally, I figured it out.
Actually the way is just not to use struts tag libraries. ;(
Get the ActionErrors and search the key.
if there's an object corresponding to the key, write FF
if no, write FF

thank you.
wolfgang

-- 
wolfgang <[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:
<mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:struts-user-help@;jakarta.apache.org>

--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@;jakarta.apache.org>




Re: about html:error ( error handling )

2002-11-12 Thread wolfgang
Hi there,

Finally, I figured it out.
Actually the way is just not to use struts tag libraries. ;(
Get the ActionErrors and search the key.
if there's an object corresponding to the key, write FF
if no, write FF

thank you.
wolfgang

-- 
wolfgang <[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




Re: about html:error ( error handling )

2002-11-12 Thread wolfgang
Hi Mouratidis,

Thank you for replying me.

but unfortunately that's not what I wanted to know.

I wasn't asking how to just handle errors.

thank you.
wolfgang


-- 
wolfgang <[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 




RE: about html:error ( error handling )

2002-11-12 Thread Mouratidis, Georg
hi wolfgang,

you do not have to go this way.

1. in the struts-config.xml add in your appropriate  the attribute 
validate="true".
2. in your actionformbean there is (has to be ) a method called validate().
inside this method you only add your ActionsErrors object.

If there is not error you have to return null
else you have to return your ActionErrors object.

i work this way and it works on my system.


 public ActionErrors validate(ActionMapping mapping,
   HttpServletRequest request) {

  ActionErrors errors = new ActionErrors();
  if ((username == null) || (username.length() < 1))
  errors.add("username", new ActionError("login.error.username.required"));
  if ((password == null) || (password.length() < 1))
  errors.add("password", new ActionError("login.error.password.required"));
  if ((organization == null) || (organization.length() < 1))
  errors.add("organization", new 
ActionError("login.error.organization.required"));
  if ((language == null) || (language.length() < 1))
  errors.add("language", new ActionError("login.error.language.required"));

  return errors;

  }

hopefully i could help you

-Original Message-
From: wolfgang [mailto:wolfgang127jp@;ybb.ne.jp]
Sent: Dienstag, 12. November 2002 16:33
To: Struts Users Mailing List
Subject: about html:error ( error handling )


Hi there,

I'm trying to make an error handling in my web application with 
 and .
but I'm stuck.

what I wanna do is that 
when struts catch the error (user didn't fill in the required textarea) ,
struts say there's an error.
And
even though there were no errors, strust says there was No error.

now I can do only former one with the code below...

In ApplicationResource.properties file --
username.required=FF   (<-- red color in html)
-

In ActionForm bean --
ActionErrors errors = new ActionErrors();
if(.){
   errors.add("username", new ActionError("username.required"));
}

-

In jsp --

   

-

when struts catches the error, the HTML( transformed from jsp ) write
out FF.

I want struts write a word I specified even though There's NO error.
Is it impossible ???

why I wanna do this is that I wanna change the font's color depending on
either error or not.

If there's error foobar
If there's NO error foobar

I tried coding in jsp.

">
   


   F

">foobar

This does NOT work because if username property is okay , but other
properties got errors,  will be
processed...

so I gotta do like below...(since I don't know how to code, I just write
words)

">
   if(this error is username property's one){
  
   }else{
  write F
   }


   F

">foobar


I don't know how to code

Please Please anyone helps me out...

Thanks in advance.
wolfgang



-- 
wolfgang <[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   
For additional commands, e-mail: 


--
To unsubscribe, e-mail:   
For additional commands, e-mail: