Custom JSP taglib lets you provide an editable area. It is a standard div
area that you can edit in-place. For example:
<script language="JavaScript" src="cjajax.js"></script> <%@ taglib uri="taglib.tld" prefix="e" %> <e:EditDiv id="d1" style="width:200px"> you can edit this content </e:EditDiv> and you will get the following picture:
you can edit this content
Try to move the mouse over this area. The background color will be changed (it is an attribute activeColor). Try to click on this area. You will see now the textarea where your content could be updated. And your updates could be posted back to your server side via Ajax POST. You have two options for setting target server-side script: set it via tag's attribute url or create some JavaScript function that calculates URL dynamically and provide a name for that function via tag's attribute urlFunction. In order to use this tag you have to describe an external JavaScript file cjajax.js on your page. Edit area could be customized (see attributes editStyle and editClassName).
Your updates could be posted via Ajax to your servlet (JSP). You can provide either url or JavaScript function that will return an url
(see JavaScript link taglib also):
<script language="JavaScript" src="cjajax.js"></script> <%@ taglib uri="taglib.tld" prefix="e" %> <e:EditDiv id="d1" url="/servlet/MVC" style="width:200px"> you can edit this content and post it to /servlet/MVC </e:EditDiv> Your server side stuff will get HTTP POST request where parameter name corresponds to the id of your area: id_content. E.g. in the above-mentioned example this name will be d1_content (div's id is d1). After the posting tag will show in the area content returned by your server side. If your servlet (JSP page) will return an empty value than tag will simply show the updated content. Tags are: EditDiv Body tag defines a div block that could be edit in-place. Parameters are: 1) id Describes a CSS (DHTML) id.
for downloading: Library: editdivtag.jar Description: taglib.tld JavaScript library: cjajax.js See also Coldtags suite - the largest collection of custom JSP tags.
|
Also in Coldtags:
|