Ranjith Kumar

+ Follow
since Mar 30, 2006
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Ranjith Kumar

Hey Daniel,

Thanks a lot...! That did work.

But I am at a loss as to understand how that worked. The way i see it, i was doing the same thing for the commandButton which never invoked the action method.

You were a great help.
16 years ago
Thanks for the response.

I guess I should have made myself clearer. I am trying to invoke the Click event of the commandButton from the javascript where I have specified bean method in the action attribute.

Now, I can invoke the bean method when i manually click the button. But i am not able to fire the click event from the javascript. Is there a way to do that? Is there an alternative?

Thanks in advance.
16 years ago
I had previously tried the following lines -

but that doesnt work either. So i tried "onclick" as in my previous post.

Any help is greatly appreciated.

16 years ago
Is there a way to call a backingBean method from javascript?

I have a requirement where a click on an image should invoke a bean method. Since i cannot have an action attribute in graphicImage, I invoke a javascript method which fires the "onclick" event of a hidden button where i have specified the bean method to be called in the action attribute.

My code -

This is the javascript function that i call on the click of the image

this is the button that I try to invoke from the javascript function -

PS: i have the correct spelling for klick in my code. It is just that javaranch does not accept the correct spelling here.

When i click the image, i do get the alerts, but the bean method does not get executed. Has anyone faced the same problem? Is there a better way to do this?

Thanks in advance
16 years ago
I thought the error stack would be helpful in better understanding the problem -
10:45:38,796 INFO [STDOUT] java.lang.NullPointerException
10:45:38,796 INFO [STDOUT] at com.veloxe.server.entity.User.loginUser(User.java:184)
10:45:38,796 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
10:45:38,796 INFO [STDOUT] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
10:45:38,796 INFO [STDOUT] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
10:45:38,796 INFO [STDOUT] at java.lang.reflect.Method.invoke(Method.java:324)
10:45:38,796 INFO [STDOUT] at com.sun.faces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:126)
10:45:38,796 INFO [STDOUT] at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
10:45:38,796 INFO [STDOUT] at javax.faces.component.UICommand.broadcast(UICommand.java:312)
10:45:38,796 INFO [STDOUT] at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:267)
10:45:38,796 INFO [STDOUT] at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:381)
10:45:38,796 INFO [STDOUT] at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:75)
10:45:38,796 INFO [STDOUT] at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
10:45:38,796 INFO [STDOUT] at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
10:45:38,796 INFO [STDOUT] at javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
10:45:38,796 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.ja
10:45:38,796 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
10:45:38,796 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
10:45:38,796 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.ja
10:45:38,796 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
10:45:38,796 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
10:45:38,796 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
10:45:38,796 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
10:45:38,796 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.jav
10:45:38,796 INFO [STDOUT] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
10:45:38,796 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
10:45:38,796 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
10:45:38,796 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
10:45:38,796 INFO [STDOUT] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
10:45:38,796 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
10:45:38,796 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Pr
10:45:38,796 INFO [STDOUT] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
10:45:38,796 INFO [STDOUT] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
10:45:38,796 INFO [STDOUT] at java.lang.Thread.run(Thread.java:534)
16 years ago
Hi Peter,

I happen to get the same error but the myfaces jar files are not in the WEB-INF/lib as was in your case but in deploy\jbossweb-tomcat55.sar\jsf-libs. I removed the jsf-lib folder but still the FacesContext is returned as null. I have been breaking my head on this for the last 2 days. Hope you can help.

I am copying my code below �


<td width="20%" align="left">

<html:commandButton image="img/login.jpg" action="#{userBean.loginUser}" />



<description>Login Screen</description>
<from-outcome>success</from-outcome> <to-view-id>/jsp/setup/customer/addCustomer.jsp</to-view-id>

<description>User bean</description>

Can you tell me what listener class you have specified in your web.xml? I earlier had these lines in the web.xml �


But I removed them when I removed the jsf-lib folder. Any help will be greatly appreciated.
16 years ago