This content has been marked as final.
Show 1 reply
-
1. Re: Client side image map and passing data
nbelaevski Oct 19, 2008 8:09 PM (in response to rpartmann)Hi Reinhard,
Here is the working page sample:<h:form id="form"> <h:inputText value="#{testBean.size}"> <f:convertNumber /> <a4j:support reRender="mapImage, mapGroup" event="onchange"></a4j:support> </h:inputText> <a4j:mediaOutput usemap="#map" id="mapImage" createContent="#{testBean.paint}" element="img" style="width: #{testBean.size}px; height: #{testBean.size}px;"/> <h:panelGroup id="mapGroup"> <map name="map"> <area shape="rect" coords="0, 0, #{testBean.size / 2}, #{testBean.size / 2}" href="?tl" title="Top-Left" /> <area shape="rect" coords="#{testBean.size / 2}, 0, #{testBean.size}, #{testBean.size / 2}" href="?tr" title="Top-Right" /> <area shape="rect" coords="0, #{testBean.size / 2}, #{testBean.size / 2}, #{testBean.size}" href="?bl" title="Bottom-Left" /> <area shape="rect" coords="#{testBean.size / 2}, #{testBean.size / 2}, #{testBean.size}, #{testBean.size}" href="?br" title="Bottom-Right" /> </map> </h:panelGroup> </h:form>
testBean.size - long, 200 by default
testBean.paint:public void paint(OutputStream os, Object o) { try { FileInputStream fis = new FileInputStream("C:/combos1.png"); int read; while ((read = fis.read()) != -1) { os.write(read); } fis.close(); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }