File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Just call a regular method at onclick on an image

 
Hauke Meier
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 557
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hauke,


Did you try this: onclick="#{navigation.updateAktuelleSeite()}"

otherwise it might try to access "updateAktuelleSeite" property like getUpdateAktuelleSeite()

 
Hauke Meier
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 557
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic