I've run into the same issue but with a different tag other than <c:out>.
I'm assuming they are related but I'm really looking for some advice here...

I'm in the process of converting my application to JSTL from Struts tags.
Once Struts 1.1 Release Candidate 2 came out supporting EL I decided to
stick with Struts EL since converting the entire application to JSTL and
removing all of my Struts tags didn't seem possible when I started to run
into this issue.

In my original code I had the following "if" statement within my JSP...

<logic:equal name="adminDownloadForm" property="idFlag" value="true">
<%-- Show some related information if 'idFlag' evaluates to true --%>
</logic:equal>

The above worked just fine and returned the expected information. When I
tried to convert this simple "if" statement to JSTL I ran into a problem...
Here's the code I attempted to use...

<c:if test="${adminDownloadForm.idFlag}">
<%-- Show some related information if 'idFlag' evaluates to true --%>
</c:if>

Once I tried the <c:if> tag and executed the JSP I received the error
described by Matt below... "

>> An error occurred while evaluating custom action
>> attribute "value" with value
>> "${adminDownloadForm.idFlag}": Unable to find a value for
>> "ifFlag" in object of class
>> "com.xxxx.xxx.xxxx.xxx" using operator "."
>> (null)' 

JSTL is not aware of the adminDownloadForm object. I know this Form is
related to Struts but the behavior of these JSTL tags is inconsistent. In
order to get my <c:if> tag to work properly I had to use a <bean:define> tag
from the Struts library and define the 'idFlag' variable.

Now if I do something like this, my <c:if> tag works fine....

<bean:define id="idFlag" name="adminDownloadForm" property="idFlag" />
<c:if test="${idFlag}">
....
</c:if>

But now I'm writing two lines of code when all I needed was one line using
the <logic:equals> tag from the Struts library. I know an additional line of
code is not the end of the world but which is better practice? Is having
Struts tags and JSTL tags in your JSP bad practice? Could it cause confusion
to other developers down the road?

Back to my point of JSTL being inconsistent... I have this standalone tag in
my JSP (with no bean define or <c:set> and I do not get an exception from
this tag... It works just fine....

<c:forEach var="assetType" items="${summaryForm.assetTypeQueues}">

What's confusing and inconsistent is that I didn't need to define the
'summaryForm' object. It was capable of seeing it and extracted the variable
I asked from it just fine. Why doesn't the <c:if> tag act in the same
manner? Is this a bug or am I doing something wrong?

I apologize for the novel I just wrote but I didnšt want to leave out any
details. Any advice would be greatly appreciated.

Thanks

- Billy -


On 7/3/03 9:47 AM, "Michael Duffy" <[EMAIL PROTECTED]> wrote:

> 
> Hi Sgarlata,
> 
> I had this problem, too.  Drove me crazy!  I had a
> class named "Component" that didn't behave correctly.
> When I renamed the class to "AssemblyComponent",
> everything worked fine.
> 
> The only class in the JDK that might interfere this
> way is java.awt.Component.  I'm not sure how it
> happens, but JSTL couldn't find my methods on my
> Component class.
> 
> I know it's not a great answer, but it is a
> workaround.  At least I can offer my sympathy - I
> suffered with this, too. - MOD
> 
> 
> --- Sgarlata Matt <[EMAIL PROTECTED]> wrote:
>> Hello,
>> 
>> I'm having some problems with the <c:out> tag (and
>> also with the <bean:write> tag from Struts) where I
>> have some code that works in one application but
>> does not work in another application.  I know my
>> variables are set out correctly because of some
>> scriptlet code.  Here is the working code:
>> 
>> <c:forEach items="${lookup.days}" var="day">
>>  <c:out value="${day.title}"/>
>> </c:forEach>
>> 
>> 
>> Here is the same code that does not work in another
>> application:
>> 
>> <c:forEach items="${lookup.components}"
>> var="component">
>>  <c:out value="${component.shortDesc}"/>
>> </c:forEach>
>> 
>> The error message is:
>> 
>> An error occurred while evaluating custom action
>> attribute "value" with value
>> "${component.shortDesc}": Unable to find a value for
>> "shortDesc" in object of class
>> "com.bah.ebspnp.dao.Component" using operator "."
>> (null)' 
>> 
>> 
>> However, this does work correctly:
>> 
>> <c:forEach items="${lookup.components}" var="item">
>>  <%=
>> 
> ((Component)pageContext.getAttribute("item")).getShortDesc()
>> %>
>> </c:forEach>
>> 
>> Any ideas?  Thanks!
>> 
>> Matt
>> 
> 
> 
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
> 
> ---------------------------------------------------------------------
> 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