Reply from subhasisc on Apr 18 at 1:09 AM Please check if using DWR helps you in this case.
| | | ---------------Original Message--------------- From: Iman_Paryudi Sent: Wednesday, April 11, 2012 1:13 AM Subject: Passing Argument of JavaScript Function Into Java Code I am creating a GUI using dojo slider. Beside the slider there is a text box which will be used to display the current value of the slider. What I want is that each time the slider is slided, the current value of the slider appears on the text box. Next, this value will be used in further calculation and the result will be displayed on another textbox. What I have been doing is: inside the dojo slider, I call a javascript function which passes the current value of the slider. Inside the javascript function, I want to pass the argument of the function into a java code inside the function. The argument will be used by the java code to do a calculation. My problem is that I could not pass the argument to the java code. My question is how can I do that? Below is the coding I have written: <head> <script type="text/javascript"> dojo.require("dijit.form.Slider"); dojo.require("dijit.form.TextBox"); dojo.ready(function(){ var slider = new dijit.form.HorizontalSlider({ name: "slider", value: dojo.byId("walluvalueinit").value, minimum: 0, maximum: 1, discreteValues:11, intermediateChanges: true, style: "width:300px;", onChange: function(value){ dojo.byId("walluvalue").value = value; changewalluvalue(value); //CALLING FUNCTION changewalluvalue() } }, "slider"); }); </script> </head> <body class="claro"> <jsp:useBean id="beanAnalysis" class="bean.Analysis" scope="application"/> <script> function changewalluvalue(value){ <% ExteriorUnheatedGroundLossCalculation eug = new ExteriorUnheatedGroundLossCalculation(); //MORE CALCULATIONS //SET U VALUES PROPERTY IN ExteriorUnheatedGroundLossCalculation eug.setWallUValue(value); //THE ARGUMENT "value" SHOULD BE PASSED HERE ====more java code===== %> } </script> <form id="form1" name="form1" method="post" action=""> <tr> <td width="150">Wall U Value</td> <td width="411" align="center" valign="middle"><div id="slider"></div></td> <td width="154" align="center" valign="middle"><label for="walluvalueinit"></label> <input type="text" name="walluvalueinit" id="walluvalueinit" value="${beanAnalysis.wallUValue}"/>& lt;/td> <td width="152" align="center" valign="middle"><label for="walluvalue"></label> <input type="text" name="walluvalue" id="walluvalue" /></td> </tr> <td colspan="2" align="center">Transmission Loss</td> <td align="center" valign="middle"><label for="transmissionlossinit"></label > <input type="text" name="transmissionlossinit" id="transmissionlossinit" value="${beanAnalysis.transmissionLoss}" /></td> <td align="center" valign="middle"><label for="transmissionloss"></label> <%--CALCULATION RESULT WILL BE DISPLAYED HERE--%> <input type="text" name="transmissionloss" id="transmissionloss" /></td> </form> </body> | | Reply to this email to post your response. __.____._ | In the Spotlight Become a blogger at Toolbox.com and share your expertise with the community. Start today. _.____.__ |
No comments:
Post a Comment