• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Not able to use action attribute in JSF graphicImage

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am using the following code to display graphic image.
<h:graphicImage id="fiPricePendingToolRefreshImage"
value="/images/refresh.jpg">
<rich:toolTip for="fiPricePendingToolRefreshImage"
followMouse="true" direction="top-right" showDelay="200"
styleClass="tooltip">
<span style="white-space: nowrap">Refresh</span>
</rich:toolTip>
</h:graphicImage>

Graphic Image does not have attribute like "action". So I am enclosing this image in the <a4j:commandLink> like this:
<a4j:commandLink id="Refresh"
action="#{fiPriceController.downloadFile}">
<h:graphicImage id="fiPricePendingToolRefreshImage"value="/image/refresh.jpg"><rich:toolTip for="fiPricePendingToolRefreshImage"
followMouse="true" direction="top-right" showDelay="200"
styleClass="tooltip">
<span style="white-space: nowrap">Refresh</span>
</rich:toolTip>
</h:graphicImage>
</a4j:commandLink>

But in the above case my action method is not getting invoked.
If I use command button to invoke the same action method. It's working fine and I am able to download the file.
<h:commandButton id="export"
action="#{fiPriceController.downloadFile}">
</h:commandButton>

has anybody ever used the <h:graphicImage> to invoke the action method and how it has been done. Please reply as it is very critical to my project.
Thanks in advance.
 
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well I am not sure about a4jCommandLink but i tried the same case with <h:commandLink> and found that it is working.

For your understanding I am providing the code too. Hope this will help you.

--------------------------------------------------------------------
The page Code
--------------------------------------------------------------------
<h:form>
<a4j:outputPanel id="banner" styleClass="banner" layout="block">
<a4j:outputPanel id="banlogo" styleClass="banlogo" layout="block">
<h:commandLink action="#{loginBean.login}" >
<h:graphicImage value="images/ui/logo1.gif"
width="180" height="60" style="border:none;">
</h:graphicImage>
</h:commandLink>
</a4j:outputPanel>

</a4j:outputPanel>
</h:form>

--------------------------------------------------------------------
The Bean Code
--------------------------------------------------------------------

public String login() throws Exception {
System.err.println("in Login<------------------");

return "success";
}

--------------------------------------------------------------------
The Console Output
--------------------------------------------------------------------

[10/8/08 15:29:11:236 BST] 00000028 SystemErr R in Login<------------------





Himanshu
[ October 08, 2008: Message edited by: Himanshu Gupta ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic