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:[EMAIL PROTECTED] 
Sent: Monday, July 28, 2003 9:13 AM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to