Client state taglib ver. 1.1

    Custom JSP taglib lets you deal with serialized beans. Tag saveBean lets you serialize bean and save it in the hidden variable, tag restoreBean lets you extract serialized bean from the request parameter. For example:
 


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

<%
  TestBean o = new TestBean();
  o.setField1("f1");
  o.setField2("f2");
%>

<form method="post" ...>

<en:saveBean value="<%=o%>" field="test"/>

</form>

Here TestBean instance will be saved in the hidden form field named test. In your JSP file processed the form you can use some like this:
 


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

<en:restoreBean id="o" parameter="test"/>

<%=((TestBean)o).getField1()%>

and in case of servlet you can use some like this:
 


Object o = com.cj.clientstate.RestoreBean.RestoreBean(request.getParameter("test"));

Tags are:

saveBean

Tag serializes the bean and saves it in the hidden field. Parameters are:

1) field Describes a name for your field.
2) name Optional parameter. Describes a name for your bean in the page (request, session, application) scope.
3) value Optional parameter. Describes a value for your bean.

restoreBean

Tag restores your bean from the request parameter. Parameters are:

1) parameter Describes a name for your parameter.
2) id Optional parameter. Describes a name for the page scope variable with the restored bean.
3) type Optional parameter. Describes a type for your bean. By default is java.lang.Object.
 

for downloading:

 Library: cstatetag.jar     Description: taglib.tld

 © Coldbeans      Comments?

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