Re: question about ActionErrors

2003-07-12 Thread Yan Zhu

nevermind, the source code for PropertyResourceMessages is good enough.

thanks!

yan

Yan Zhu wrote:

> I like all the features currently implemented in the PropertyMessageResources.
> It just seems a bit odd to me that the only way implemented is to look
> for the property file in the classpath, and you don't have a way to specify
> the path to the file. Is there an example of extending that class for your own
> use
> anywhere I can take a look at?
>
> thanks!
>
> yan
>
> Jing Zhou wrote:
>
> > - Original Message -
> > From: "Yan Zhu" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Saturday, July 12, 2003 9:10 AM
> > Subject: Re: question about ActionErrors
> >
> > >
> > > I might be wrong about this, but doesn't this still force it to look for
> > files
> > > in app's classpath, such as in directories like WEB-INF/classes or /lib ?
> > >
> > > I need to load the property file from WEB-INF/conf/myapp.message,
> > > how would I do that?
> >
> > You might have to create a custom version of PropertyMessageResources.
> > In the class, you use ServletContext.getResourceAsStream to obtain a
> > input stream with a context relative path and then use it to initialize the
> > properties.
> >
> > Before you go down that path, evaluate the benefits of the current
> > PropertyMessageResources. It allows you to group message resources
> > into different packages. It is easy to tell, say a message format like
> >
> > key34= Input {0} is invalid
> >
> > is specified for which classe and in which package. This is very useful when
> > your project get larger. Of course, there are other better organization
> > structures. Some people think storing message resources in database
> > is a good way. I am interested in that direction for larger projects.
> >
> > >
> > > thanks
> > >
> > > yan
> > >
> >
> > Jing
> > Netspread Carrier
> > http://www.netspread.com
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: question about ActionErrors

2003-07-12 Thread Yan Zhu

I like all the features currently implemented in the PropertyMessageResources.
It just seems a bit odd to me that the only way implemented is to look
for the property file in the classpath, and you don't have a way to specify
the path to the file. Is there an example of extending that class for your own
use
anywhere I can take a look at?

thanks!

yan


Jing Zhou wrote:

> - Original Message -
> From: "Yan Zhu" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Sent: Saturday, July 12, 2003 9:10 AM
> Subject: Re: question about ActionErrors
>
> >
> > I might be wrong about this, but doesn't this still force it to look for
> files
> > in app's classpath, such as in directories like WEB-INF/classes or /lib ?
> >
> > I need to load the property file from WEB-INF/conf/myapp.message,
> > how would I do that?
>
> You might have to create a custom version of PropertyMessageResources.
> In the class, you use ServletContext.getResourceAsStream to obtain a
> input stream with a context relative path and then use it to initialize the
> properties.
>
> Before you go down that path, evaluate the benefits of the current
> PropertyMessageResources. It allows you to group message resources
> into different packages. It is easy to tell, say a message format like
>
> key34= Input {0} is invalid
>
> is specified for which classe and in which package. This is very useful when
> your project get larger. Of course, there are other better organization
> structures. Some people think storing message resources in database
> is a good way. I am interested in that direction for larger projects.
>
> >
> > thanks
> >
> > yan
> >
>
> Jing
> Netspread Carrier
> http://www.netspread.com
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: question about ActionErrors

2003-07-12 Thread Jing Zhou

- Original Message - 
From: "Yan Zhu" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Saturday, July 12, 2003 9:10 AM
Subject: Re: question about ActionErrors


>
> I might be wrong about this, but doesn't this still force it to look for
files
> in app's classpath, such as in directories like WEB-INF/classes or /lib ?
>
> I need to load the property file from WEB-INF/conf/myapp.message,
> how would I do that?

You might have to create a custom version of PropertyMessageResources.
In the class, you use ServletContext.getResourceAsStream to obtain a
input stream with a context relative path and then use it to initialize the
properties.

Before you go down that path, evaluate the benefits of the current
PropertyMessageResources. It allows you to group message resources
into different packages. It is easy to tell, say a message format like

key34= Input {0} is invalid

is specified for which classe and in which package. This is very useful when
your project get larger. Of course, there are other better organization
structures. Some people think storing message resources in database
is a good way. I am interested in that direction for larger projects.


>
> thanks
>
> yan
>

Jing
Netspread Carrier
http://www.netspread.com



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: question about ActionErrors

2003-07-12 Thread Yan Zhu

I might be wrong about this, but doesn't this still force it to look for files
in app's classpath, such as in directories like WEB-INF/classes or /lib ?

I need to load the property file from WEB-INF/conf/myapp.message,
how would I do that?

thanks

yan


Peter Smith wrote:

> Hi Yan,
>
> For your properties file, there is an entry in struts-config that you can
> make.  Here is an example:
>
> 
> null="false"/>
>
> For this example, the file would be application.properties.
>
> For your other questions, there is an ActionMessages class that does what
> you need.
>
> HTH, Peter
> --
> Peter Smith
> Software Engineer
> InfoNow Corporation
>
> > From: Yan Zhu <[EMAIL PROTECTED]>
> > Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Date: Fri, 11 Jul 2003 16:59:18 -0500
> > To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > Subject: question about ActionErrors
> >
> >
> >   It's my understanding that ActionErrors builds a property/message
> > list based on the Apppiation.Properties file found in the classpath.
> > Is there anyway to change that behavior so that it can read of a file
> > that application specifies?
> >
> >   Also, ActionErrors handles the displaying of the error messages
> > quite well. But what if I simply want to pass a status message back
> > to the users based on my action. Is there an equivalent of
> > ActionStatues?
> > For example, if I add a user to the db, I want the page to return to the
> >
> > add user jsp after each add, with a message like user blah is added
> > successfully. It operates exactly like the errors, except it shows up
> > when actions are successful.
> >
> >   thx
> >
> > yan
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: question about ActionErrors

2003-07-11 Thread Yan Zhu

great, thanks a lot!


Peter Smith wrote:

> Hi Yan,
>
> For your properties file, there is an entry in struts-config that you can
> make.  Here is an example:
>
> 
> null="false"/>
>
> For this example, the file would be application.properties.
>
> For your other questions, there is an ActionMessages class that does what
> you need.
>
> HTH, Peter
> --
> Peter Smith
> Software Engineer
> InfoNow Corporation
>
> > From: Yan Zhu <[EMAIL PROTECTED]>
> > Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Date: Fri, 11 Jul 2003 16:59:18 -0500
> > To: Struts Users Mailing List <[EMAIL PROTECTED]>
> > Subject: question about ActionErrors
> >
> >
> >   It's my understanding that ActionErrors builds a property/message
> > list based on the Apppiation.Properties file found in the classpath.
> > Is there anyway to change that behavior so that it can read of a file
> > that application specifies?
> >
> >   Also, ActionErrors handles the displaying of the error messages
> > quite well. But what if I simply want to pass a status message back
> > to the users based on my action. Is there an equivalent of
> > ActionStatues?
> > For example, if I add a user to the db, I want the page to return to the
> >
> > add user jsp after each add, with a message like user blah is added
> > successfully. It operates exactly like the errors, except it shows up
> > when actions are successful.
> >
> >   thx
> >
> > yan
> >
> >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: question about ActionErrors

2003-07-11 Thread Peter Smith
Hi Yan,

For your properties file, there is an entry in struts-config that you can
make.  Here is an example:


  

For this example, the file would be application.properties.

For your other questions, there is an ActionMessages class that does what
you need.

HTH, Peter
-- 
Peter Smith
Software Engineer
InfoNow Corporation

> From: Yan Zhu <[EMAIL PROTECTED]>
> Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> Date: Fri, 11 Jul 2003 16:59:18 -0500
> To: Struts Users Mailing List <[EMAIL PROTECTED]>
> Subject: question about ActionErrors
> 
> 
>   It's my understanding that ActionErrors builds a property/message
> list based on the Apppiation.Properties file found in the classpath.
> Is there anyway to change that behavior so that it can read of a file
> that application specifies?
> 
>   Also, ActionErrors handles the displaying of the error messages
> quite well. But what if I simply want to pass a status message back
> to the users based on my action. Is there an equivalent of
> ActionStatues?
> For example, if I add a user to the db, I want the page to return to the
> 
> add user jsp after each add, with a message like user blah is added
> successfully. It operates exactly like the errors, except it shows up
> when actions are successful.
> 
>   thx
> 
> yan
> 
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about ActionErrors &

2003-01-31 Thread atta ur rehman
Well, I think your resource file is missing header and footer properties.
try to add

errors.header=
errors.footer=

at the top of your resource file.

hope it helps.

ATTA

- Original Message -
From: "Ali Khan" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, January 31, 2003 2:18 PM
Subject: Question about ActionErrors & 


> Hi,
>
> have made an simple struts-application. I got one problem.
>
> That is when my actionerrors are shown generated with ,
> it shows null in start and in the end of the error-messages. Don't
> understand why the null's occur ? It shows like this:
> 
> null Definition not filled
> Paymenttype not filled
> null
> -
>
> Here is my code:
> ---
> In ActionForm:
>   public ActionErrors validate(ActionMapping mapping,
>  HttpServletRequest request) {
> ActionErrors errors = new ActionErrors();
>
> if(paymenttype == null || "".equals(paymenttype)){
> errors.add("paymenttype",new ActionError("errors.typename"));
> }
>
> if(definition == null || "".equals(definition)){
> errors.add("definition",new ActionError("errors.comment"));
> }
> return errors;
> }
> ---
> In ApplicationResources.properties:
> errors.typename=Definition not filled
> errors.comment=Paymenttype not filled
> -
> In web.xml:
> ...
> ...
> 
>  application
>  ApplicationResources
>
> ...
> .
>
> All help appreciated.
> Thanx.
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Question about ActionErrors &

2003-01-31 Thread David Graham
In 1.0.2 you must define errors.header and errors.footer in your messages 
properties file.  I believe in 1.1 this isn't required.

David






From: Ali Khan <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Subject: Question about ActionErrors & 
Date: Fri, 31 Jan 2003 23:18:03 +0100

Hi,

have made an simple struts-application. I got one problem.

That is when my actionerrors are shown generated with , it 
shows null in start and in the end of the error-messages. Don't understand 
why the null's occur ? It shows like this:

null Definition not filled
Paymenttype not filled
null
-

Here is my code:
---
In ActionForm:
 public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
   ActionErrors errors = new ActionErrors();

   if(paymenttype == null || "".equals(paymenttype)){
   errors.add("paymenttype",new ActionError("errors.typename"));
   }

   if(definition == null || "".equals(definition)){
   errors.add("definition",new ActionError("errors.comment"));
   }
   return errors;
   }
---
In ApplicationResources.properties:
errors.typename=Definition not filled
errors.comment=Paymenttype not filled
-
In web.xml:
...
...

application
ApplicationResources
  
...
.

All help appreciated.
Thanx.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_
Protect your PC - get McAfee.com VirusScan Online  
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Question about ActionErrors &

2003-01-31 Thread Ali Khan
Thanx, that did it, cheers.



Anders Hermansen wrote:


* Ali Khan ([EMAIL PROTECTED]) wrote:
 

Hi,

have made an simple struts-application. I got one problem.

That is when my actionerrors are shown generated with , 
it shows null in start and in the end of the error-messages. Don't 
understand why the null's occur ? It shows like this:

null Definition not filled
Paymenttype not filled
null
   


Struts is trying to set in the errors.header and errors.footer message
keys. But they are not defined.

 

In ApplicationResources.properties:
errors.typename=Definition not filled
errors.comment=Paymenttype not filled
   


Add also:
errors.header = These errors occured:
errors.footer = 

you get the idea...


Hope this helps,
Anders

--
Anders Hermansen
YoYo Mobile as

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


 




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Question about ActionErrors &

2003-01-31 Thread Anders Hermansen
* Ali Khan ([EMAIL PROTECTED]) wrote:
> Hi,
> 
> have made an simple struts-application. I got one problem.
> 
> That is when my actionerrors are shown generated with , 
> it shows null in start and in the end of the error-messages. Don't 
> understand why the null's occur ? It shows like this:
> 
> null Definition not filled
> Paymenttype not filled
> null

Struts is trying to set in the errors.header and errors.footer message
keys. But they are not defined.

> In ApplicationResources.properties:
> errors.typename=Definition not filled
> errors.comment=Paymenttype not filled

Add also:
errors.header = These errors occured:
errors.footer = 

you get the idea...


Hope this helps,
Anders

--
Anders Hermansen
YoYo Mobile as

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




RE: Question about ActionErrors &

2003-01-31 Thread Greg.Reddin
Do you have the "errors.header" and "errors.footer" properties in your 
ApplicationResources.properties file?  I don't believe they are required, but it's 
something to look at.

Greg

> -Original Message-
> From: Ali Khan [mailto:[EMAIL PROTECTED]]
> Sent: Friday, January 31, 2003 4:18 PM
> To: [EMAIL PROTECTED]
> Subject: Question about ActionErrors & 
> 
> 
> Hi,
> 
> have made an simple struts-application. I got one problem.
> 
> That is when my actionerrors are shown generated with 
> , 
> it shows null in start and in the end of the error-messages. Don't 
> understand why the null's occur ? It shows like this:
> 
> null Definition not filled
> Paymenttype not filled
> null
> -
> 
> Here is my code:
> ---
> In ActionForm:
>   public ActionErrors validate(ActionMapping mapping,
>  HttpServletRequest request) {
> ActionErrors errors = new ActionErrors();
> 
> if(paymenttype == null || "".equals(paymenttype)){
> errors.add("paymenttype",new 
> ActionError("errors.typename"));
> }
> 
> if(definition == null || "".equals(definition)){
> errors.add("definition",new 
> ActionError("errors.comment"));
> }
> return errors;
> }
> ---
> In ApplicationResources.properties:
> errors.typename=Definition not filled
> errors.comment=Paymenttype not filled
> -
> In web.xml:
> ...
> ...
> 
>  application
>  ApplicationResources
>
> ...
> .
> 
> All help appreciated.
> Thanx.
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]