add java to javascript:-
<script type="text/javascript" xml:space="preserve">
document.getElementById("latitude").value="<%=latitude%>";
document.getElementById("longitude").value="<%=longitude%>";
alert(document.getElementById("longitude").value);
</script>
add javscript to java:-
<%
String selectForAdd;
selectForAdd = "javascript:document.personViewForm.PKpersonItemType.value='javascript:document.personViewForm.personType.value';";
selectForAdd += "document.personViewForm.PKpersonItemCode.value='javascript:document.personViewForm.personItemCode.value';";
selectForAdd +="document.personViewForm.PKpersonItemLang.value='javascript:document.personViewForm.personItemLang.value';";
selectForAdd +="document.personViewForm.pageMode.value='addChild';";
%>
Then we can send this variable in a button click
<input type="button" name="select" onClick="<%= selectForAdd%>" />
add strtus to javascript:-
<bean:define name="res" property="bkClasses" id="selectedClass"/>
<script>
oldBkClasses[oldBkClasses.length]='<bean:write name="selectedClass"/>';
</script>
To access a javascript value at the server end:-
create a hidden field on the jsp and set it with the desired value. This will be submitted to the server as a request parameter
No comments:
Post a Comment