Hi,
I think the key should be a jsp scripting variable, as your are using a
constant in a java file its being evaludated to ""
why dont you try like this and see..
<bean:define id="myConst" type="java.lang.String">
Constants.SECTION_TITLE
</bean:define>
<bean:el:message key="${myConst}" />
I havent tried this. but this would work i guess :)
Thanks,
Nuwan
----- Original Message -----
From: "semaj.najraham" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Saturday, July 14, 2007 1:40 PM
Subject: Re: How to display message from resource bundle using Struts EL
tags
Nuwan,
sorry for typo... actually i did type <bean:el:message
key="${Constants.SECTION_TITLE}" />
I'm getting same error:
[ERROR] - Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Missing message for key "" in bundle
"(default bundle)" for locale en_US
<bean-el:message> has attribute named bundle. Do I need to mention
anything
there?
Thanks,
semaj
nuwan chandrasoma-2 wrote:
Hi,
I think it should be like this.
<bean-el:message key="${Constants.SECTION_TITLE }" />
Thanks,
Nuwan
----- Original Message -----
From: "semaj.najraham" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Saturday, July 14, 2007 2:02 AM
Subject: Re: How to display message from resource bundle using Struts EL
tags
Laurie,
This is what I did
<%@ taglib uri="http://struts.apache.org/tags-bean-el"
prefix="bean-el"%>
<%@ page import="com.messages.Constants" %>
<bean:message key="${Constants.SECTION_TITLE }" />
where Constants.java contains the following contants
public static final String SECTION_TITLE = "section.title";
and key/value is defined in MessageResources.properties file as
section.title=Add User
and in struts-config.xml, I have <message-resources
parameter="MessageResources" />
isn't this the way I'm supposed to do?
Thanks
semaj
Laurie Harper wrote:
That indicates that the expression you're passing in the 'key'
attribute
is evaluating to null or the empty string. Check how you're specifying
the key, and feel free to post a sample of the JSP markup you're using
if you still can't figure it out.
L.
semaj.najraham wrote:
If I change as you mention, I get the following error:
[ERROR] - Servlet.service() for servlet jsp threw exception
javax.servlet.jsp.JspException: Missing message for key "" in bundle
"(default bundle)" for locale en_US
Any idea?
Thanks,
semaj
nuwan chandrasoma-2 wrote:
<bean-el:message
key="${stringvar}"/>http://struts.apache.org/1.3.8/struts-el/index.html-----
Original Message -----
From: "semaj.najraham" <[EMAIL PROTECTED]>
To: <user@struts.apache.org>
Sent: Friday, July 13, 2007 5:49 AM
Subject: Re: How to display message from resource bundle using Struts
EL
tags
Any idea, guys!!
semaj.najraham wrote:
I have the following jsp:
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ page import="com.messages.Constants" %>
<bean:message key="<%=Constants.SECTION_TITLE %>" />
where Constants.java contains the following containts
public static final String SECTION_TITLE = "section.title";
and key/value is defined in MessageResources.properties file as
section.title=Add User
How can I get the same functionality using Struts EL tag?
Thank you,
semaj
--
View this message in context:
http://www.nabble.com/How-to-display-message-from-resource-bundle-using-Struts-EL-tags-tf4069659.html#a11573783
Sent from the Struts - User mailing list archive at Nabble.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]
--
View this message in context:
http://www.nabble.com/How-to-display-message-from-resource-bundle-using-Struts-EL-tags-tf4069659.html#a11590270
Sent from the Struts - User mailing list archive at Nabble.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]
--
View this message in context:
http://www.nabble.com/How-to-display-message-from-resource-bundle-using-Struts-EL-tags-tf4069659.html#a11593733
Sent from the Struts - User mailing list archive at Nabble.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]