| Author |
Just call a regular method at onclick on an image
|
Hauke Meier
Greenhorn
Joined: Jan 08, 2011
Posts: 2
|
|
Hello everyone,
its kind of frustrating now. I have some navigation images on my site like this:
My faces-config.xml looks like this:
and my java class like this
All I want is when I click on the image, that the "updateAktuelleSeite" method will be called with the argument given on the jsf page.
This line is workin fine : <a4j:include viewId="#{navigation.aktuelleSeite }"></a4j:include>
Because when I remove the onclick attributes, it workes.
I always get this error:
javax.servlet.ServletException: /index.jsp(32,4) '#{navigation.updateAktuelleSeite }' Property 'updateAktuelleSeite' not found on type de.hauke.steuerung.web.Navigation
javax.faces.webapp.FacesServlet.service(FacesServlet.java:256)
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
So why is java is thinking, updateAktuelleSeite is an property? It is just a regular method. Do I have to add something inside the faces-config.xml file?
My System:
I used JBoss 4.2.3GA with Richfaces 3.3.3 FINAL and JSF 1.2 (I believe it is 1.2, because a friend of mine configured everything for me and
we didn't get the project working with the latest JSF Libs).
Thanks a lot and many greeting,
Hauke
|
 |
Srinivasan thoyyeti
Ranch Hand
Joined: Feb 15, 2007
Posts: 557
|
|
Hauke,
Did you try this: onclick="#{navigation.updateAktuelleSeite()}"
otherwise it might try to access "updateAktuelleSeite" property like getUpdateAktuelleSeite()
|
Thanks & Regards,<br />T.Srinivasan,<br />SCWCD 1.4(89%),SCJP 5.0(75%)<br />"That service is the noblest which is rendered for its own sake." - Mahatma Gandhi
|
 |
Hauke Meier
Greenhorn
Joined: Jan 08, 2011
Posts: 2
|
|
Hi,
that doesn't work either. But I solved the problem by using this instead:
I don't know if this is a good method but it works.
Many greetings,
Hauke
|
 |
Srinivasan thoyyeti
Ranch Hand
Joined: Feb 15, 2007
Posts: 557
|
|
Hauke,
ok. It seems onclick is not submitting a request to server by default; we need to write a javascript method to do so.
I suppose onclick in any tag will not post a request to server by default.
where as <h:commandLink>'s "action" is going to submit the request to server by default.
Thanks for posting this query.
|
 |
 |
|
|
subject: Just call a regular method at onclick on an image
|
|
|