You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Döring Markus <Ma...@tcc-products.de> on 2008/01/25 16:49:51 UTC
[Trinidad] How to use ServerSide ImageMaps
Hello,
I'm trying around with tr:image and server side ImageMaps.
<tr:image> documentation says:
If a server-side image map is desired, specify "server" and place inside a CoreGoLink component. The acceptable values are "server" or "none"; defaults to "none".
What I have so far is the following (really straight forward)
<tr:image source="#{image.url}" imageMapType="server" inlineStyle="width:600px;">
<tr:goLink />
</tr:image>
What I was not able to find out is how to trigger an action listener from this goLink. GoLink only supports stuff like destination and targetFrame, but not something like action / actionListener.
Also if I try something like
<tr:image source="#{image.url}" imageMapType="server" inlineStyle="width:600px;">
<tr:goLink>
<f:actionListener type="my.package.ActionListener" />
</tr:goLink>
</tr:image>
This does not work because <tr:goLink> is not an JSF "action source" (com.sun.facelets.tag.TagException: /sample.xhtml @9,116 <f:actionListener> Parent is not of type ActionSource, type is: CoreGoLink[UIXFacesBeanImpl, id=_id46])
So how do I manage to call an actionListener from <tr:goLink> and how to get the coordinates of the click inside of it?
I'm using:
JBoss 4.2.0
MyFaces 1.1.5
Faclets 1.1.13
Trinidad 1.0.3
Thanks for help
Markus Döring
TCC Products GmbH
AW: [Trinidad] How to use ServerSide ImageMaps
Posted by Döring Markus <Ma...@tcc-products.de>.
I've found out one solution how it works.
The goLink/Image is the same as below, only that the destination is the same .xhtml file as the one where the image is actually on. It can not be only # (as anchor) because the page needs to be reloaded. Additionally there is Jscript that reads the location from address bar, writes it into an inputHidden and than submits a "hidden" button to send the data to the server. Not a nice solution, but works, if anyone has any "nicer" way, please let me now.
test.xhtml:
<ui:composition>
<tr:goLink destination="/test.xhtml">
<tr:image source="#{bean.imageUrl}" imageMapType="server" />
</tr:goLink>
<tr:inputHidden id="mapInputX" value="#{bean.locationX}" />
<tr:inputHidden id="mapInputY" value="#{bean.locationY}" />
<tr:commandButton id="imageMapSubmit" text="" inlineStyle="display:none;">
<f:actionListener type="my.package.SelectImageAreaListener" />
</tr:commandButton>
<script>
str = location.search;
if (str == "") {
//ignore
} else {
var inputX = document.getElementById("mapInputX");
var inputY = document.getElementById("mapInputY");
var submit = document.getElementById("imageMapSubmit");
commaloc = str.indexOf(",");
inputX.value = str.substring(1, commaloc);
inputY.value = str.substring(commaloc+1, str.length);
submit.click();
}
</script>
</ui:composition>
Von: Döring Markus [mailto:Markus.Doering@tcc-products.de]
Gesendet: Freitag, 25. Januar 2008 17:08
An: MyFaces Discussion
Betreff: AW: [Trinidad] How to use ServerSide ImageMaps
Ok, found out something more.
The image has to be inside of the goLink, so this is correct:
<tr:goLink destination="test.html">
<tr:image source="#{image.url}" imageMapType="server" inlineStyle="width:600px;" />
</tr:goLink>
But still, I only have a destination URL, and the cords get posted to it (this works so far)
Now how do I get this cords back inside the JSF lifecycle? Or is there any possibility to get it directly into an actionListener?
Thanks for help
Von: Döring Markus [mailto:Markus.Doering@tcc-products.de]
Gesendet: Freitag, 25. Januar 2008 16:50
An: MyFaces Discussion
Betreff: [Trinidad] How to use ServerSide ImageMaps
Hello,
I'm trying around with tr:image and server side ImageMaps.
<tr:image> documentation says:
If a server-side image map is desired, specify "server" and place inside a CoreGoLink component. The acceptable values are "server" or "none"; defaults to "none".
What I have so far is the following (really straight forward)
<tr:image source="#{image.url}" imageMapType="server" inlineStyle="width:600px;">
<tr:goLink />
</tr:image>
What I was not able to find out is how to trigger an action listener from this goLink. GoLink only supports stuff like destination and targetFrame, but not something like action / actionListener.
Also if I try something like
<tr:image source="#{image.url}" imageMapType="server" inlineStyle="width:600px;">
<tr:goLink>
<f:actionListener type="my.package.ActionListener" />
</tr:goLink>
</tr:image>
This does not work because <tr:goLink> is not an JSF "action source" (com.sun.facelets.tag.TagException: /sample.xhtml @9,116 <f:actionListener> Parent is not of type ActionSource, type is: CoreGoLink[UIXFacesBeanImpl, id=_id46])
So how do I manage to call an actionListener from <tr:goLink> and how to get the coordinates of the click inside of it?
I'm using:
JBoss 4.2.0
MyFaces 1.1.5
Faclets 1.1.13
Trinidad 1.0.3
Thanks for help
Markus Döring
TCC Products GmbH
AW: [Trinidad] How to use ServerSide ImageMaps
Posted by Döring Markus <Ma...@tcc-products.de>.
Ok, found out something more.
The image has to be inside of the goLink, so this is correct:
<tr:goLink destination="test.html">
<tr:image source="#{image.url}" imageMapType="server" inlineStyle="width:600px;" />
</tr:goLink>
But still, I only have a destination URL, and the cords get posted to it (this works so far)
Now how do I get this cords back inside the JSF lifecycle? Or is there any possibility to get it directly into an actionListener?
Thanks for help
Von: Döring Markus [mailto:Markus.Doering@tcc-products.de]
Gesendet: Freitag, 25. Januar 2008 16:50
An: MyFaces Discussion
Betreff: [Trinidad] How to use ServerSide ImageMaps
Hello,
I'm trying around with tr:image and server side ImageMaps.
<tr:image> documentation says:
If a server-side image map is desired, specify "server" and place inside a CoreGoLink component. The acceptable values are "server" or "none"; defaults to "none".
What I have so far is the following (really straight forward)
<tr:image source="#{image.url}" imageMapType="server" inlineStyle="width:600px;">
<tr:goLink />
</tr:image>
What I was not able to find out is how to trigger an action listener from this goLink. GoLink only supports stuff like destination and targetFrame, but not something like action / actionListener.
Also if I try something like
<tr:image source="#{image.url}" imageMapType="server" inlineStyle="width:600px;">
<tr:goLink>
<f:actionListener type="my.package.ActionListener" />
</tr:goLink>
</tr:image>
This does not work because <tr:goLink> is not an JSF "action source" (com.sun.facelets.tag.TagException: /sample.xhtml @9,116 <f:actionListener> Parent is not of type ActionSource, type is: CoreGoLink[UIXFacesBeanImpl, id=_id46])
So how do I manage to call an actionListener from <tr:goLink> and how to get the coordinates of the click inside of it?
I'm using:
JBoss 4.2.0
MyFaces 1.1.5
Faclets 1.1.13
Trinidad 1.0.3
Thanks for help
Markus Döring
TCC Products GmbH