Decode taglib ver. 1.4


    Custom JSP taglib. Lets you decode data encoded in JavaScript with encodeURIComponent function. For example, suppose you are requesting JSP file with some encoded query string:
 


<script type="text/javascript">
document.write("<a href='http://your_host/page.jsp?a="+encodeURIComponent(aValue)+"&b="+encodeURIComponent(bValue)+"'>Go to file.jsp")
</script>

so in your file page.jsp you will need decode data passed in query string. Tag decodeURIComponent lets you decode the entirely query string:
 


<%@ taglib uri="taglib.tld" prefix="dec" %>

<dec:decodeURIComponent id="A"/>
Decoded data is <%=A%>

also you may pass encoded data as a parameter:
 


<dec:decodeURIComponent data="<%=request.getQueryString()%>"/>

Tag decodeParameter lets you extract parameters from the encoded request. For the above mentioned example you can request decoded value for parameter a for example:
 


<dec:decodeParameter name="a"/>

Tags are:

decodeURIComponent

Body tag lets you decode data (query string) encoded with encodeURIComponent JavaScript function. You may set encoded string as a parameter data or as a body for this tag. By default tag uses GET query string as a source. Parameters are:

1) id Optional parameter. Defines a page scope variable (type is java.lang.String) for the decoded data. Without this parameter tag just prints data.
2) data Optional parameter. Defines encoded data

decodeParameter

Body tag lets you decode parameter value from the request (query string) encoded with encodeURIComponent JavaScript function. Tag's body describes a default value. Parameters are:

1) name Defines a parameter in your request
2) id Optional parameter. Defines a page scope variable (type is java.lang.String) for the decoded data. Without this parameter tag just prints data.

for downloading:

Library: decodetag.jar    Description: taglib.tld

 © Coldbeans      Comments?

See also Coldtags suite - the largest collection of custom JSP tags.


     

Also in Coldtags: