Advertisement

07.24.2008 at 09:37AM PDT, ID: 23592762
[x]
Attachment Details

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

Asked by dbeachy1 in Java Standard Tag Library (JSTL) & Server Tags, Java Programming Language, Java Server Faces (JSF)

Tags: JSF, JSTL, javax.el.PropertyNotFoundException: Property 'id' not found on type org.apache.struts.validator.DynaValidatorForm

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() %>" />
<!-- THE PROBLEM LINE IS BELOW -->
<c:set var="isCurrentCompany" value="${currentCompany == companyForm.id}" />
<<<

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

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!
Start Free Trial
[+][-]07.24.2008 at 11:32AM PDT, ID: 22082107

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Java Standard Tag Library (JSTL) & Server Tags, Java Programming Language, Java Server Faces (JSF)
Tags: JSF, JSTL, javax.el.PropertyNotFoundException: Property 'id' not found on type org.apache.struts.validator.DynaValidatorForm
Sign Up Now!
Solution Provided By: brunoguimaraes
Participating Experts: 1
Solution Grade: B
 
 
[+][-]07.24.2008 at 03:20PM PDT, ID: 22084139

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.24.2008 at 03:22PM PDT, ID: 22084157

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 05:18AM PDT, ID: 22087765

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.25.2008 at 02:35PM PDT, ID: 22092497

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628