This week's book giveaway is in the General Computing forum.
We're giving away four copies of Learning Regular Expressions and have Ben Forta on-line!
See this thread for details.
Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Just call a regular method at onclick on an image  RSS feed

 
Greenhorn
Posts: 2
  • 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
 
Ranch Hand
Posts: 558
  • 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
  • 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: 558
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!