struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bailey, Shane C." <>
Subject RE: Struts and Constants ?
Date Mon, 28 Jul 2003 13:32:09 GMT

They (the authors) are just trying to show code without any scriptlets
because that would be a "no no".  But, like the example already posted in
response to your question, using <bean:write name="<%= IConstants.SOME_CONST
%>" ...> would be the equivalent way to use a constant in your tags.

It's just not as pretty plus your html developers don't need to know Java
when you go without the scriptlets.

Using <%= IConst.SOME_CONST %> you'll need to have to have this at the top
of the JSP: <%@ page import="whatever.package.IConst" %> or you can do: 
<%= whatever.package.IConst.SOME_CONST %>

-----Original Message-----
From: Emil Alexandrov [] 
Sent: Monday, July 28, 2003 9:13 AM
Subject: Struts and Constants ?

I'm new in Struts and I'm trying to catch up with Chuck's Jakarta Struts
but I must confess that I'm a little confused with the use of Constants
in Struts. In the examples in the book when we pass some data from
controller to view we use something like
(session,request).setAttribute(IConstants.SOME_CONST, someObj)
where for example SOME_CONST="blah blah"
What puzzles me is that in the jsp when we want to show the object we
<bean:write name="blah blah" property="someProperty"/>
The same examples I saw and in 'Struts Kick Start'. So what is the use
of the Constant? If we change the constant we have to go and manually
change the value of the constant in jsp too!
Am I missing something, or just examples are not complete?


To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message