Good morning, I have been working on this problem for a while and I didn't found a solution in google for it.
There is a way to assign a value to a variable in Struts from JavaScript? I'm new working with Struts so is costing me a little..
This is a part of the code I'm using:
In some part of the code first i create this little guy:
<input type="hidden" name="identificadorProspecto" id="identificadorProspecto" value="-1">
After making some connections to data base I update this value
<script language="JavaScript" type="text/javascript" >
var idContainer = document.getElementById('identificadorProspecto');
alert("idContainer.value: "+contenedorIdentificacion.value);
</script>
<s:url id="car_suc_xx223" action="listar_sucursales.action" >
<s:param name="cod_prospecto" value="%{identificadorProspecto}" />
</s:url>
When i get the alert message, I don't receive the same value that I get in the value="%{identificadorProspecto}"
(this one has some random value)
You can do it by using a property
tag. For example
<script type="text/javascript">
var idContainer = document.getElementById('identificadorProspecto');
idContainer.value = '<s:property value="%{identificadorProspecto}">';
alert("idContainer.value: "+idContainer.value);
</script>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.