Question

I'm playing with Stripes and I wonder if it is possible to send Javascript generated data to ActionBean. To be more specific, when I click with my mouse on certain element on page, I want to send ID of that element back to ActionBean after clicking on stripes:link. Providing I already have that ID saved in a JS variable id, how do I do that?

Was it helpful?

Solution

Are you using parameterised link?

<stripes:link id="mylink" href/beanclass="..." event="...">
   <stripes:param name="id" value="some_default_value"/>
   Click on me!
</stripes:link>

Which would most probably generate: http://mysite.com/...?id=some_default_value, which you would later use javascript to change some_default_value to the id you want?

Note: Suggestion unverified. I've no dev tool installed on this old lappie.

Edit: On second thought, why not just write some javascript to append "?id=" + id; to the link's url address?

OTHER TIPS

create a hidden input element in your html

<input type="hidden" name="?" id="?" />

use javascript to set the value of it

document.getElementById("?").value = ??;

and the value will be posted with your form submission.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top