struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bailey, Shane C." <SHANE.C.BAI...@saic.com>
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 [mailto:Emil.Alexandrov@rila.com] 
Sent: Monday, July 28, 2003 9:13 AM
To: struts-user@jakarta.apache.org
Subject: Struts and Constants ?

Hi,
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
use 
<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?

10x,
Emil

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message