Help

Controls

PermLinkWikiLink

Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

Forum: Seam Users Forum ListTopic List
25. Jul 2008, 15:05 CET | Link

Hi everyone.

The simplified situation looks like this: I have a picture in a page. The user clicks on it, and I have to store it's address. For example: <h:graphicImage value="img/pic01.jpg"> </h:graphicImage> and I need to store somewhere, in a context variable or something, the value: "img/pic01.jpg", in order to access it later in the page. How can I do that?

Thank you.

1 Reply:
25. Jul 2008, 16:43 CET | Link

You could do something like:

<h:graphicImage url="img/pic01.jpg" onclick="storePicture(this.src);"/>
<h:graphicImage url="img/pic02.jpg" onclick="storePicture(this.src);"/>

<a4j:jsFunction name="storePicture" action="#{storePictureBean.store}">
    <a:actionparam name="param1" assignTo="#{storePictureBean.src}"/>
</a4j:jsFunction>

And then handle adding the src to whatever context you want in the Bean.

Cheers,

Damian.