JSP JavaScript integration taglib ver. 1.3
|
|
|
|
| Articles Reviews JSP | |
| Written by Phil Harrison | |
| Sunday, 18 February 2007 | |
|
{mos_sb_discuss:34}
More precisely tag jscall lets you create a GET HTTP request to your server-side. Technically this tag defines JavaScript function that will implement HTTP request. Because you are calling from JavaScript your server side must return JavaScript too. It could be just a chunk of JavaScript code added to your page (e.g. some set of functions you will call later) or a real JavaScript call. For example from our JavaScript code (main page) we are going to call a JSP file that will update the label for the clicked button on the main page: <%@ taglib uri="taglib.tld" prefix="j" %>
<j:jscall name="f" url="test.jsp"/> <form> <input name="b1" type="button" value="Test" onClick="f('Tested')"> </form> here tag tag jscall defines a function f. Any call for this function will cause GET request to file test.jsp. Arguments will be passed in the query string. So your test.jsp file looks so: document.forms[0].b1.value='<%=request.getQueryString()%>';
Note: you do not need <script> brackets in this file! Powered by jReviews |
|
| Last Updated ( Thursday, 05 July 2007 ) | |
| < Prev | Next > |
|---|







