• Post Reply Bookmark Topic Watch Topic
  • New Topic

f:setPropertyActionListener is not working in a JSP page  RSS feed

 
ranjinie Nama
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have jsp page and used <f:setPropertyActionListener in my page. It says Unknown tag (f:setPropertyActionListener). When I deployed and try to view the page. I am getting exceptions.


part of the code in my login.jsp page.
I have added
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>


<f:view>....

<h:commandButton value="#{TRS['btn.login']}" action="#{securityBean.loginAction}">
<f:setPropertyActionListener value="new" target="#{serviceRequestDashboardViewBean.type}" />

</h:commandButton>

</f:view>

Could you please let me know how do I fix this issue. thanks a lot!
 
Tim Holloway
Bartender
Posts: 18531
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's usually not a good idea to use JSF on login pages. Not all servers will process then via the FacesServlet. Also, ".jsp" pages are obsolete.

I see no benefit to using a propertyActionListener here. When you submit the form, if the form data is valid the backing bean will be automatically updated with the form value. And if the form data isn't valid, the action method doesn't get executed nor do the listeners.

If you want notification that a backing bean value is actually being changed, as opposed to retaining the same value as before the form submit, you can add a JSF valueChangeListener element to the submit.
 
ranjinie Nama
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks a lot for your response.

My original code we are using myfaces and JSP.

this is what we have in login.jsp page

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t"%>
<%@ page import="com.trs.view.bean.security.SecurityBean"%>

<f:view>
<h:commandButton
value="#{TRS['btn.login']}" action="#{securityBean.loginAction}">
<t:updateActionListener value="new" property="#{serviceRequestDashboardViewBean.type}" />
<t:updateActionListener value="#{serviceRequestDashboardViewBean}" target="#{serviceRequestDashboardViewBean.type}" />
<t:updateActionListener value="#{employeeDashboardBean}" target="#{securityBean.employeeDashboardBean}" />

</h:commandButton>

</f:view>




this code is working in tomcat and development server which is OAS server. When we deploy the code into QA OAS server. I am getting null pointer exception. I did a Google search. it was suggesting to use f:setPropertyActionListener. That's why I was using it. I am not sure why development server is working but the QA server is not working with the same code. and what is the alternative solution. I will look at the valuechangelistener and see. in the mean time if you have any other idea please let me know.

java.lang.NullPointerException

at org.apache.myfaces.custom.updateactionlistener.UpdateActionListener.processAction(UpdateActionListener.java:137)

at javax.faces.event.ActionEvent.processListener(ActionEvent.java:51)

at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:487)

at javax.faces.component.UICommand.broadcast(UICommand.java:78)

at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)

at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)

at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)

at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)

at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)

at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java
:64)

at com.trs.view.filter.SecurityFilter.doFilter(SecurityFilter.java:76)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java
:15)

at org.apache.myfaces.webapp.filter.ExtensionsFilter.doFilter(ExtensionsFilter.java:147)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java
:17)

at com.trs.view.filter.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:26)

at com.evermind[Oracle Containers for J2EE 10g (10.1.3.4.0) ].server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java
:17)

at com.opensymphony.sitemesh.webapp.SiteMeshFilter.obtainContent(SiteMeshFilter.java:129)

at com.opensymphony.sitemesh.webapp.SiteMeshFilter.doFilter(SiteMeshFilter.java:77)

 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!