Struts - Is there a way to..

V

Vijay

hi all,

In my JSP, I am trying to write something like

<html:submit style='<bean:message key="submit.style"/>' />

This is not doing what I want. Is there any way in which I can put a
locale specific style attribute in it?

Thanks,
 
U

ufmemo

What i've done in the past is get a handle to the resource bundle and
then push a string into the HTML tag.

For example:

<%
String key = "some key that comes from the resource bundle";
%>


Then add your button

<html:submit style="<%= key %>"/>

Hope this helps..

John
 
W

Wendy Smoak

Vijay said:
<html:submit style='<bean:message key="submit.style"/>' />
This is not doing what I want.

It shouldn't be doing *anything* -- you can't have tags inside of tags.
Is there any way in which I can put a
locale specific style attribute in it?

http://struts.apache.org/userGuide/struts-html.html#submit

Only lists 'style' and 'styleClass'. It seems like you want 'styleKey'
(which doesn't exist). You could enter it in Bugzilla as an enhancement
request.

I haven't tried it, but I think <c:set> will use the body of the tag as its
value:
<c:set var="mystyle">
<fmt:message key="submit.style"/>
</c:set>

Then with Struts-EL:
<html-el:submit style="${mystyle}" >

(You have to set the javax.servlet.jsp.jstl.fmt.localizationContext context
param in web.xml for <fmt:message> to work. Ask if you need an example.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,121
Latest member
LowellMcGu
Top