You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Guus Holshuijsen <gh...@videtur.nl> on 2001/07/20 17:52:56 UTC

Problem with tag?

I am using Struts 1.0 on Tomcat 3.2.1.

When I try to use
<bean:message name="<%= Constants.STATS_KEY %>" property="ci" scope="request"/>
I get the message
"According to TLD attribute key is mandatory for tag message"

The message is incorrect, at least if I am to believe the documentation of the BEAN TLD!

Does anyone has any experience using "name" & "property" instead of "key"?

Regards,
Guus

Guus Holshuijsen, Videtur
Horsten 1, unit 1.18
5612 AX Eindhoven
The Netherlands
T:+31-40-2450214  F:+31-40-2939343  M:+31-6-25077204

Re: Problem with tag?

Posted by Martin Cooper <ma...@tumbleweed.com>.
The ability to use 'name' and 'property' attributes with <bean:message> is
new for Struts 1.1, and is not available in Struts 1.0. If you're looking at
the documentation on the Struts web site, you should be aware that this
always reflects the latest builds of Struts. For the Struts 1.0
documentation, you should refer to the struts-documentation.war application
which is part of the Struts 1.0 distribution.

--
Martin Cooper


----- Original Message -----
From: "Matthias Brahm" <br...@justis.de>
To: <st...@jakarta.apache.org>
Sent: Monday, July 23, 2001 1:45 PM
Subject: Re: Problem with <bean:message> tag?


> I downloaded the source of the nightly build and you are right, there are
the
> two attributes.
> But in the 1.0 final release of struts (which i use) there are no property
and
> name attributes for the bean:message tag.
>
> Matthias
>
> > "Matthias Brahm" <br...@justis.de> wrote:
> >
> > > This must be an error in the Tag Library Reference (in the
> > source-code
> > > of the bean:message tag there are no name and property attributes)!
> > > Read the Tag Library Guides for the usage of the bean:message tag.
> > In
> > > this documentation name and property are not mentioned.
> > >
> > > Matthias
> >
> > They are:
> >
> > From: struts-bean.html to attribute key:
> >
> > The message key of the requested message, which must have a
> > corresponding
> > value in the message resources. If not specified, the key is obtained
> > from the
> > name and property attributes.
> >
> >
> > --
> >
> > gR
> >
> >
>



Re: Problem with tag?

Posted by Matthias Brahm <br...@justis.de>.
I downloaded the source of the nightly build and you are right, there are the 
two attributes.
But in the 1.0 final release of struts (which i use) there are no property and 
name attributes for the bean:message tag.

Matthias

> "Matthias Brahm" <br...@justis.de> wrote:
> 
> > This must be an error in the Tag Library Reference (in the
> source-code
> > of the bean:message tag there are no name and property attributes)!
> > Read the Tag Library Guides for the usage of the bean:message tag.
> In
> > this documentation name and property are not mentioned.
> >
> > Matthias
> 
> They are:
> 
> From: struts-bean.html to attribute key:
> 
> The message key of the requested message, which must have a
> corresponding
> value in the message resources. If not specified, the key is obtained
> from the
> name and property attributes.
> 
> 
> --
> 
> gR
> 
> 

Re: Problem with tag?

Posted by Gregor Rayman <gr...@gmx.net>.
"Matthias Brahm" <br...@justis.de> wrote:

> This must be an error in the Tag Library Reference (in the source-code
> of the bean:message tag there are no name and property attributes)!
> Read the Tag Library Guides for the usage of the bean:message tag. In
> this documentation name and property are not mentioned.
>
> Matthias

They are:

From: struts-bean.html to attribute key:

The message key of the requested message, which must have a corresponding
value in the message resources. If not specified, the key is obtained from the
name and property attributes.


--

gR



Getting Exception errors from session beans

Posted by Matt Raible <ma...@yahoo.com>.
In my action classes, I am getting a populated JavaBean from my SessionBean,
and I want to know how to get an exception into the errors using errors.add().

The difference between this and traditional errors is that there is no key in
ApplicationResource.properties, but rather, I am grabbing a string from the
EntityException.

<code snippet>
		// Populate the EntityDO
		try
		{	EntityDO aEntityDO = new EntityDO(request.getParameter("id");
			InitialContext ctx = new InitialContext();
			EntityManagerHome home = (EntityManagerHome) ctx.lookup(
EntityManagerHome.CLASS_CTX );
			EntityManager entityMgr = home.create();
			aEntityDO = entityMgr.getEntityDetails(aEntityDO);	
		}
		catch (NamingException ne)
		{
			log(_className, " NamingException occurred in getEntityDetails()");
			errors.add(ActionErrors.GLOBAL_ERROR, new
ActionError("errors.namingException"));
		} 
		catch (EntityException re)
		{
			log(_className, " ResourceException occurred in getResourceDetails()");
			// Get EntityException from SessionBean
			// *** HELP NEEDED HERE *** //
			// How do I get the "re" String into an errors.add ??
		}
</code snippent>

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

Re: Problem with tag?

Posted by Matthias Brahm <br...@justis.de>.
This must be an error in the Tag Library Reference (in the source-code 
of the bean:message tag there are no name and property attributes)!
Read the Tag Library Guides for the usage of the bean:message tag. In 
this documentation name and property are not mentioned.

Matthias

Guus Holshuijsen wrote:

> The documentation for the <bean:message> tag states the following:
> 
> "Retrieves an internationalized message for the specified locale, using the
> specified message key, and write it to the output stream. Up to five
> parametric replacements (such as "{0}") may be specified.
> 
> The message key may be specified directly, using the key attribute, or
> indirectly, using the name and property attributes to obtain it from a
> bean."
> 
> So what I expect is that I can use the name and property attributes to
> retrieve a message key from the "ci" property in the "<%=
> Constants.STATS_KEY %>" bean!
> 
> Regards,
> Guus
> 
> 
> ----- Original Message -----
> From: "Mark Schenk" <M....@dto.tudelft.nl>
> To: <st...@jakarta.apache.org>
> Sent: Friday, July 20, 2001 19:38
> Subject: RE: Problem with <bean:message> tag?
> 
> 
>>> When I try to use
>>> <bean:message name="<%= Constants.STATS_KEY %>" property="ci"
>> 
>> scope="request"/>
>> 
>>> I get the message
>>> "According to TLD attribute key is mandatory for tag message"
>>> 
>>> The message is incorrect, at least if I am to believe the documentation
>> 
> of
> 
>> the BEAN TLD!
>> 
>>> Does anyone has any experience using "name" & "property" instead of
>> 
> "key"?
> 
>> Are you sure you're not confusing <bean:message> and <bean:write> ? What
>> would
>> you expect as output from your above tag?
>> 
>> <Mark/>
>> 
>> 
>> --------------------------------------------------------------------------
> 
> --
> 
>> Mark Schenk                     |       Ceci n'est pas une signature
>> Blackboard Project Manager      |
>> Delft University of Technology  |E-mail: M.M.A.Schenk@dto.tudelft.nl
>> Dept.: DTO                      |Phone:  +31 152785448 (85448)
>> Room: LB00.680                  |Fax:    +31 152786359
>> --------------------------------------------------------------------------
> 
> --



Re: Problem with tag?

Posted by Guus Holshuijsen <gh...@videtur.nl>.
The documentation for the <bean:message> tag states the following:

"Retrieves an internationalized message for the specified locale, using the
specified message key, and write it to the output stream. Up to five
parametric replacements (such as "{0}") may be specified.

The message key may be specified directly, using the key attribute, or
indirectly, using the name and property attributes to obtain it from a
bean."

So what I expect is that I can use the name and property attributes to
retrieve a message key from the "ci" property in the "<%=
Constants.STATS_KEY %>" bean!

Regards,
Guus


----- Original Message -----
From: "Mark Schenk" <M....@dto.tudelft.nl>
To: <st...@jakarta.apache.org>
Sent: Friday, July 20, 2001 19:38
Subject: RE: Problem with <bean:message> tag?


> > When I try to use
> > <bean:message name="<%= Constants.STATS_KEY %>" property="ci"
> scope="request"/>
> > I get the message
> > "According to TLD attribute key is mandatory for tag message"
> >
> > The message is incorrect, at least if I am to believe the documentation
of
> the BEAN TLD!
> >
> > Does anyone has any experience using "name" & "property" instead of
"key"?
>
> Are you sure you're not confusing <bean:message> and <bean:write> ? What
> would
> you expect as output from your above tag?
>
> <Mark/>
>
>
> --------------------------------------------------------------------------
--
> Mark Schenk                     |       Ceci n'est pas une signature
> Blackboard Project Manager      |
> Delft University of Technology  |E-mail: M.M.A.Schenk@dto.tudelft.nl
> Dept.: DTO                      |Phone:  +31 152785448 (85448)
> Room: LB00.680                  |Fax:    +31 152786359
> --------------------------------------------------------------------------
--
>


RE: Problem with tag?

Posted by Mark Schenk <M....@dto.tudelft.nl>.
> When I try to use
> <bean:message name="<%= Constants.STATS_KEY %>" property="ci"
scope="request"/>
> I get the message
> "According to TLD attribute key is mandatory for tag message"
>
> The message is incorrect, at least if I am to believe the documentation of
the BEAN TLD!
>
> Does anyone has any experience using "name" & "property" instead of "key"?

Are you sure you're not confusing <bean:message> and <bean:write> ? What
would
you expect as output from your above tag?

<Mark/>


----------------------------------------------------------------------------
Mark Schenk                     |       Ceci n'est pas une signature
Blackboard Project Manager      |
Delft University of Technology  |E-mail: M.M.A.Schenk@dto.tudelft.nl
Dept.: DTO                      |Phone:  +31 152785448 (85448)
Room: LB00.680                  |Fax:    +31 152786359
----------------------------------------------------------------------------