[JSP] Strings Constants from JSP using Struts tags

M

Matthias Nietz

Hey NG,

is there a way to share String Constants through an application without
coding Java in the JSPs?
<html:submit property="<%=CONSTANTS.anmeldetext%>" value="..."/>

It would already be happy if I could the Application-Resource keys here but
I can't nest the <bean:message> for <%=...%> into the <html:submit> tag. I
want to make sure that my Actionclass uses the same String to retrieve the
property from the request than used to declare it in the jsp. Is there
another way to achieve my aim?

Regards,

Matthias.
 
V

VisionSet

Matthias Nietz said:
Hey NG,

is there a way to share String Constants through an application without
coding Java in the JSPs?
<html:submit property="<%=CONSTANTS.anmeldetext%>" value="..."/>

It would already be happy if I could the Application-Resource keys here but
I can't nest the <bean:message> for <%=...%> into the <html:submit> tag. I
want to make sure that my Actionclass uses the same String to retrieve the
property from the request than used to declare it in the jsp. Is there
another way to achieve my aim?

Then there are the action form decalaration of properties in the
struts-config.xml

So you have 3 variables for the same property in jsp, xml, and model. jsp &
model versions can at least be homologous, one method is to use reflection
to lift out constants from an interface or wherever, and store them as
context attributes at startup.
 

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

Forum statistics

Threads
473,731
Messages
2,569,432
Members
44,832
Latest member
GlennSmall

Latest Threads

Top