Avatar of dbeachy1

asked on 

PropertyNotFoundException with ${myBean.foo}, but works with #{myBean.foo}

We are porting our web application to run under Tomcat as well as Resin, and I am getting a weird error on one of our pages related to JSF and JSTL.  Here is the code at the top of the page:

<html:form action="/admin/updateCompany.do">
<c:set var="currentCompany" value="<%= userinfo.getCompanyIdAsInt() %>" />
<c:set var="isCurrentCompany" value="${currentCompany == companyForm.id}" />

'companyForm' is defined like this in struts-config.xml:
        <form-bean name="companyForm"
           <form-property name="id" type="java.lang.Integer" />

The page runs fine under Resin, but when running under Tomcat it throws this exception:

>>>javax.el.PropertyNotFoundException: Property 'id' not found on type org.apache.struts.validator.DynaValidatorForm
After digging around for a while I think this is related to JSF; when I change the problem line to this:
<!-- Notice the '#' replacing the '$' below -->
<c:set var="isCurrentCompany" value="#{currentCompany == companyForm.id}" />
...it runs fine under Tomcat.  I am not familiar with JSF yet, so I am trying to figure out why "#{companyForm.id}" resolves successfully but "${companyForm.id}" does not.  I know that '#' is JSF syntax, so I am wondering if this has something to do with JSF's "Managed Bean Creation" I have read about.  From testing, "#{companyForm.id} resolves successfully on Resin as well, but before I change the code I want to figure out exactly what's going on.  

Any help would be appreciated!
Java EEJava

Avatar of undefined
Last Comment

8/22/2022 - Mon