File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Not able to use action attribute in JSF graphicImage

 
Vikas Taank
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
Himanshu Gupta
Ranch Hand
Posts: 598
Android Eclipse IDE Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • 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>
<a4jutputPanel id="banner" styleClass="banner" layout="block">
<a4jutputPanel 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>
</a4jutputPanel>

</a4jutputPanel>
</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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic