how to use request.getParameter("value") within javascript function
843838Mar 4 2007 — edited Mar 5 2007I have this particular requirement that on my jsp page, i am getting some parameters set by controller servlet and i need to get the values of these parameteres within my java script function so that i can set the values of my form elements and submit it.
here is the incomplete code snippet :
<% if ( "edit button".equals (hello) ) {%>
<script language="javascript">
window.alert ("in if part");
var val1 = "<%=request.getAttribute("FirmwareVersion")%>";
var val2 = "<%=request.getAttribute("SoftwareProduct")%>";
var val3 = "<%=request.getAttribute("SoftwareVersion")%>";
var val4 = "<%=request.getAttribute("SoftwareOperatingSystem")%>";
putValue (val1, val2, val3, val4);
</script>
<%}<%>
function putValue ( var1, var2, var3, var4) {
document.createUpdateForm.productSoftwareProduct.value = val2;
document.createUpdateForm.productSoftwareVersion.value = val3;
document.createUpdateForm.productSoftwareOperatingSystem.value = val4;
document.createUpdateForm.productFirmwareVersion.value = val1;
}
and then i am submitting the form in another function.
any leads???
regards.