-
1. Re: EL value expression error javax.el.PropertyNotFoundException
ask4free Oct 10, 2011 12:12 PM (in response to crussell42)Hi Chris,
I'm maybe not answering your question but, do you really need to use that data structure? I see you have a Map of objects (Dogs), are you hardcoding for each Dog an inputText like this?
<h:inportText value="#{myAction.dogManager.dogs['FRED1'].age}"/>
<h:inportText value="#{myAction.dogManager.dogs['FRED2'].age}"/>
<h:inportText value="#{myAction.dogManager.dogs['FRED3'].age}"/>
<h:inportText value="#{myAction.dogManager.dogs['FRED4'].age}"/>
Maybe you could use a List of objects (Dogs), and then make a loop with ui:repeat (facelets) or c:foreach (JSTL). Maybe you could also use a simple data bean (scope session or request) and just populate data on it when it is needed in the controller.
for example "myAction" gets the dogs information and populates it on the bean "listOfDogs" which contains the attribute "list" (list of dogs)... so you would have something like (just pseudo-code):
<ui:repeat value= "#{listOfDogs.list}" item="dog">
<h:inputText value="#{dog.age}"/>
</ui:repeat>
In any case, if you don't have a collection, you just could have a bean "dog" and use it directly like <h:inputText value="#{dog.age}"/>
Best regards,
Antonio.
-
2. Re: EL value expression error javax.el.PropertyNotFoundException
crussell42 Oct 11, 2011 7:11 AM (in response to ask4free)As stated initially, I can work around the problem by using the underlying Collection but this
may not always be the case.
The DogManager class may be some sort of helper class or legacy system adapter that has to
run an RPG program on an AS400 to get at or create Dog objects (who knows).
Point being that method invocation allows more abstraction than having to rely on Collections.
So yes, using Collections to access named objects works but using methods to access named objects
no longer works in AS7.
I'm curious why that functionality (regardless of its merits) went away?
-
3. Re: EL value expression error javax.el.PropertyNotFoundException
timpii Oct 18, 2011 5:51 AM (in response to crussell42)I also am having the same issue. I am upgrading my prototype to AS7, CDI, JSF2 and Richfaces 4. It seems like Weld no longer allows EL method expressions. These worked fine with the Glassfish version of JSF 2 and EL. For example the following .xhtml snippet generates the following runtime error:
<h:selectOneListbox id="profile_nav_type_list" value="#{profileAction.selectedType}" styleClass="profile_type_select"> <f:selectItems value="#{profileAction.profileSelects}"/> <f:ajax event="click" execute="#{profileAction.addProfile()}" render="profileForm" bypassUpdates="false" /> </h:selectOneListbox> The error:
Servlet.service() for servlet Faces Servlet threw exception: javax.el.PropertyNotFoundException: /layout/profile/profile_nav_panel.xhtml @45,114 execute="#{profileAction.addProfile()}": The class 'com.zensa.vault.ui.action.ProfileHandler$Proxy$_$$_WeldClientProxy' does not have the property 'addProfile'.
I would appreciate understanding what I need to do - if I am doing something wrong, or if there is a workaround.
-
4. Re: EL value expression error javax.el.PropertyNotFoundException
crussell42 Oct 18, 2011 9:34 AM (in response to timpii)These tricks may be useful but they still suck to have to do.
Through brute force and ignorance I found a couple of workarounds.
We want to call an initialization routine when starting the page e.g.
{code}
<h:outputText value="#{myBean.initialize()}"/>
public void initialize();
{code}
Worked great in as5.
Now in as7 I have to change the return type of initialize to String and have it return("")
AND I have to rename my method getInitialize(). Then in the EL
{code}
<h:outputText value="#{myBean.initialize}"/>
public String getInitialize();
{code}
AND YET
{code}
<h:outputText value="#{myBean.otherFunction('parm1','parm2')}"/>
{code}
works just fine
Dont understand why we are not seeing more action on this issue. It has got to be hurting others.
These tricks DO NOT however solve the original problem of needing a method to dereference an object within an el expression.
In your case just change your method name to getAddProfile() and have it return a blank String then use .addProfile no parens.
You may be able to leave the return type as void.
-
5. Re: EL value expression error javax.el.PropertyNotFoundException
ask4free Oct 25, 2011 6:46 AM (in response to crussell42)Hi,
mmm... so it's like a trick to simulate a method as it was a property, right?
the thing is that... maybe EL in any JSF input/output field should be used with properties and the method actions should be use in JSF command elements.
maybe it worked in AS5 because of a server implementation bug and I guess it's working now in AS7 because the server "thinks" is accessing a property instead of an action method...
would it be possible to execute all the initialization methods as a controller, populate data into beans, and then redirect to the view where the input/output elements can access the bean properties. Firstly, before accessing a view, a controller should be invoked in order to populate the data to a bean and so it is available to the view.
best regards,
antonio.