pass parameter to backing bean in rendered attribute

Components, Ajax Framework, Utilities and More.
Post Reply
jjpclev
Posts: 100
Joined: 12 Jan 2011, 15:28
Location: United States - Cleveland, Ohio

07 Dec 2011, 04:39

hey guys,

it's been a while since I have done any JSF development, but hoping to get back into a little bit. I have run into a small issue, and was wondering if someone could provide a bit of advice. I have a datatable that displays users. in one of the columns, I want to conditionally display (using the rendered attribute) a command link. I have a utility method in a backing bean that I want to use to perform the logic of whether or not to display the link. but I can't seem to figure out how to send a parameter to the backing bean. I tried the following but I seem to get a jsf syntax exception ( javax.el.ELException: Error Parsing: #{manageUsers.showResetLink(user.status)}).

is there a way to even do this? if so, could someone provide some assistance?

xhtml page

Code: Select all

<p:dataTable id="users" var="user" value="#{manageUsers.users}" >
		....
        <p:column headerText="Actions">                
	            <h:outputText value="&#160;" /> 
                <p:commandLink update="resetPasswordPanel" process="@this" 
                			   value="RESET" rendered="#{manageUsers.showResetLink(user)}" >	                	
	            </p:commandLink>  
	      </p:column>          
       
    </p:dataTable>
backing bean

Code: Select all

.......
public boolean isShowResetLink(String status) {
   boolean flag = false;
    if (status.equals()) { ... // do some logic }
  return flag;
	}
....
thank you very much for your assistance,

regards, Jim Pollock
JSF2 - weblogic 10.3.4 - primefaces-3.0-SNAPSHOT - MyEclipse 8.6.1

User avatar
optimus.prime
Prime
Posts: 17586
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Dec 2011, 14:06

What is the EL version in your environment, you need el 2.2 to pass params to EL.

jjpclev
Posts: 100
Joined: 12 Jan 2011, 15:28
Location: United States - Cleveland, Ohio

07 Dec 2011, 14:24

so this might seem like a question that I should have an answer for, right? But I am not exactly sure what version of EL I am using. I am using Weblogic 10.3.4 which supports JSF 2.0. So I guess that would be EL 2.0? I found the following jar el-impl-2.2.0-SNAPSHOT.jar from http://download.java.net/maven/glassfis ... -SNAPSHOT/, can I just drop that into my web app lib directory, and start using it?

thanks,

Jim
JSF2 - weblogic 10.3.4 - primefaces-3.0-SNAPSHOT - MyEclipse 8.6.1

User avatar
optimus.prime
Prime
Posts: 17586
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Dec 2011, 14:27

Probably weblogic doesn't have the necessary EL version to pass parameters.

Instructions to update the EL used in your application can be found at;

http://ocpsoft.com/java/jsf2-java/jsf2- ... l2-to-jsf/

We have no experience regarding EL updates and Weblogic so you may need to consult Weblogic documentation to see how to update the EL used in the server.

jjpclev
Posts: 100
Joined: 12 Jan 2011, 15:28
Location: United States - Cleveland, Ohio

07 Dec 2011, 14:32

thank you very much! I will give that a try and see how it works. I'll post a reply to let you know what I found out.

btw.....my 4 year son is transformer crazy. it's going to be a very big optimus prime / bumblebee christmas this year for him. very cool!!
JSF2 - weblogic 10.3.4 - primefaces-3.0-SNAPSHOT - MyEclipse 8.6.1

User avatar
optimus.prime
Prime
Posts: 17586
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Dec 2011, 14:39

btw.....my 4 year son is transformer crazy. it's going to be a very big optimus prime / bumblebee christmas this year for him. very cool!!
Your son will sure like PrimeFaces as well :)

jjpclev
Posts: 100
Joined: 12 Jan 2011, 15:28
Location: United States - Cleveland, Ohio

07 Dec 2011, 22:22

Here's my solution to getting the EL version updated on Weblogic 10.3.4:

I referenced the following post ( see last post by venur )
https://forums.oracle.com/forums/thread ... dID=982187

1. download jar files and put into my application WEB-INF/lib directory:
http://download.java.net/maven/2/javax/ ... pi-2.2.jar
http://download.java.net/maven/glassfis ... APSHOT.jar
2. modified web.xml

Code: Select all

<context-param>
		<param-name>com.sun.faces.expressionFactory</param-name>
		<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
	</context-param>
3. modified weblogic.xml file

Code: Select all

<wls:container-descriptor>
        <wls:prefer-application-packages>
			<wls:package-name>com.sun.el.*</wls:package-name>
			<wls:package-name>javax.el.*</wls:package-name>
		</wls:prefer-application-packages>
    </wls:container-descriptor>
4. and then my code to execute.
xhtml

Code: Select all

<p:commandLink update="panel" process="@this" value="RESET"
                          rendered="#{statusUtil.showResetLink(user.status)}">           	
backing bean

Code: Select all

public boolean showResetLink(String status) {
	if (..do something) {
	  return true;			
	} else {
	 return false;
	}
}
when I log into my app, I get the following INFO / Warning :
Dec 7, 2011 3:18:51 PM com.sun.faces.lifecycle.ELResolverInitPhaseListener populateFacesELResolverForJsp
INFO: JSF1027: [/pups] The ELResolvers for JSF were not registered with the JSP container.

but it doesn't prevent it from working, so I am not really worried about it.

thanks again for the assist Cagatay!

cheers,
Jim




-
JSF2 - weblogic 10.3.4 - primefaces-3.0-SNAPSHOT - MyEclipse 8.6.1

User avatar
optimus.prime
Prime
Posts: 17586
Joined: 05 Jan 2009, 00:21
Location: Cybertron
Contact:

07 Dec 2011, 23:43

We've never faced with such an error, it seems to be related with weblogic environment, please consult weblogic documentation.

davegerber
Posts: 1
Joined: 17 May 2017, 18:02

17 May 2017, 18:05

At the last conference on Java, lecturer shared with us a site where you can find useful information about object-oriented languages, look here - casestudywriter.org .

Post Reply
  • Information
  • Who is online

    Users browsing this forum: Baidu [Spider], cristiandean and 20 guests