views:

878

answers:

1

Hi

  1. I have a javascript function updateHiddenField(value) that gets a value as parameter and then sets this value as the value of a hidden field.

  2. I have a JavaBean flight with parameters id and flightNo.

Problem: How can I pass the parameter id of JavaBean flight to the js function updateHiddenField(value) when using <html:link> tag(struts)?

<html:link href="javascript:updateHiddenField(idToPassHere)"><bean:write name="flight" property="flightNo"/></html:link>

Thanks Umar

A: 
<html:link href="javascript:updateHiddenField(<s:property value="id"/>)"><bean:write name="flight" property="flightNo"/></html:link>

Assuming your taglib import is <% @taglib prefix="s" uri="/struts-tags" %>

Droo