Custom iterator is working fine in JSF1.0 and not working in JSF2.0 -



Custom iterator is working fine in JSF1.0 and not working in JSF2.0 -

we in process of migrating application jsf1.0 jsf2.0.

in jsf1.0 have custom iterator class used display list values on jsp page.

if utilize same custom converter in jsf2.0 lastly record of list displaying repeatedly in rows.

below screenshot of output. list contained 4 object , lastly object has values "test4" , "abc4"

we using jsp view in jsf2 runtime.

firstname lastname test4 abc4 test4 abc4 test4 abc4 test4 abc4

here custom iterator custom tag.

package com.util; import java.io.ioexception; import java.util.arraylist; import java.util.iterator; import java.util.list; import java.util.map; import java.util.set; import javax.el.valueexpression; import javax.faces.context.facescontext; import javax.faces.el.valuebinding; import javax.faces.webapp.uicomponentbodytag; import javax.faces.webapp.uicomponenteltag; import javax.servlet.jsp.jspexception; import javax.servlet.jsp.jspwriter; /** * custom jsf iterator tag */ public class customiterator extends uicomponenteltag { /** * <p> * thread safety: @threadsafe * </p> */ /*private final static logger logservice = logger .getinstance(customiterator.class.getname());*/ /** * iterator. */ private iterator iterator; /** * data. */ private object values; /** * info tag attribute. */ private string data; /** * temporary storage name. */ private string var; private valueexpression ve; public valueexpression getve() { homecoming ve; } public void setve(valueexpression ve) { this.ve = ve; } /** * default constructor. */ public customiterator() { } public string getcomponenttype() { homecoming null; } public string getrenderertype() { homecoming null; } public void setdata(string data) { this.data = data; } public string getdata() { homecoming data; } public void setvar(string var) { this.var = var; } public string getvar() { homecoming var; } /** * start tag encoder. * * @return indication render. */ public int dostarttag() { final string methodname = "dostarttag"; facescontext context = facescontext.getcurrentinstance(); if (isvaluereference(data)) { //valuebinding vb = context.getapplication().createvaluebinding(data); valueexpression ve12 = context.getapplication().getexpressionfactory().createvalueexpression(context.getelcontext(), data, arraylist.class); if (ve12 != null) { //values = vb.getvalue(context); values = ve12.getvalue(getelcontext()); } else { homecoming skip_body; } } else { throw new nullpointerexception(); } if ((null != values) && (values instanceof list)) { list list = (list) values; if (null == iterator) { iterator = list.iterator(); } //valuebinding vb = null; //valueexpression ve = null; object obj = null; if (iterator.hasnext()) { obj = iterator.next(); ve = context.getapplication().getexpressionfactory().createvalueexpression(context.getelcontext(), utilconstants.expression_open_str + var + utilconstants.expression_close_str, object.class); ve.setvalue(getelcontext(), obj); homecoming eval_body_include; } else { homecoming skip_body; } } homecoming 0; } private boolean isvaluereference(string value) { if (value == null) { throw new nullpointerexception(); } if ((value.indexof("#{") != -1) && (value.indexof("#{") < value.indexof('}'))) { homecoming true; } homecoming false; } /** * end tag encoder. * * @return indication render. */ public int doendtag() throws jspexception { final string methodname = "doendtag"; homecoming 0; } /** * after body encoder. * * @return indication render. */ public int doafterbody() { final string methodname = "doafterbody"; facescontext context = facescontext.getcurrentinstance(); if (null != bodycontent) { seek { jspwriter out = getpreviousout(); out.print(bodycontent.getstring()); bodycontent.clearbody(); } grab (ioexception e) { //logservice.logerror(e.getmessage()); } } if ((iterator != null) && (iterator.hasnext())) { if (values instanceof list) { object obj = iterator.next(); ve.setvalue(getelcontext(), obj); } homecoming eval_body_again; } else { homecoming skip_body; } } public void release() { final string methodname = "release"; iterator = null; } }

please suggest how solve problem.

iterator

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -