jakarta-taglibs-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "sia far" <sia_...@hotmail.com>
Subject A problem
Date Wed, 10 Sep 2003 17:22:40 GMT
Hello Everyone:

Can anyone tell me what the following message means? or What problem causes
it?

org.apache.jasper.runtime.BodyContentImpl@46b39013

I have written a taglib that recevies a vector as an attribute. The elements
of the vector each also reference a vector (actually each is a row in a
database). The taglib is supposed to return each row at a time and make it
available for further processing in the tag body.

Here is my code:

private String type;
private String name;
private Iterator sqlResult;

/**
* Constructor for GapIteratorSQL.
*/
public GapRowIterator() {
	super();
	type = null;
	sqlResult = null;
	}
public void setName(String name) {
	this.name = name;
}

public void setType(String type) {
	this.type = type;
}

public void setList(Collection sqlResult) {

/* Regardless of the result of sql, sqlResult.get(0)
* contains the a reference to a vector holding the attributes
* chosen by the user.
*/
if (sqlResult.size() > 1)
	this.sqlResult = sqlResult.iterator();
}

public int doStartTag() {
int rc = 0;
if (this.sqlResult == null)
	rc = SKIP_BODY;
else {
              if (this.sqlResult.hasNext()) {
                        //skip the first two rows
	        sqlResult.next();
	        sqlResult.next();
	        pageContext.setAttribute(name, sqlResult.next());
	        rc = EVAL_BODY_BUFFERED;
	} else {
	       rc = SKIP_BODY;
	}
          }
return rc;
}

public int doAfterBody() {
int rc = 0;
if (this.sqlResult.hasNext()) {
	pageContext.setAttribute(name, sqlResult.next());
	rc = EVAL_BODY_AGAIN;
} else {
	rc = SKIP_BODY;
}

return rc;
}

public int doEndTag() throws JspException {

BodyContent bc = getBodyContent();
if (bc != null) {
	JspWriter out = getPreviousOut();
	try {
		out.println(bc.toString());
	} catch (IOException e) {
		throw new JspException("GapIteratorSQL: " + e.getMessage());
	}
    }

return EVAL_PAGE;
}

public void release() {
name = null;
type = null;
sqlResult = null;

}

Now in my JSP file I have the following snippet to use the tag:

<%@ taglib uri="/WEB-INF/tld/gaptaglib.tld" prefix="gap" %>
<gap:rowIterator name="row" type="java.util.Vector" list="<%=
(Vector)results %>">

<tr bgcolor=#FFFFFF >
<%
	for(int j=0;j<row.size();j++){
%>

<td align=<%= "right" %> >
<b> <%=(String)row.get(j) %> <b> </td>

<%}//end of for%>
</tr>

</gap:rowIterator>

I would really appreciate if anyone can give me a hint in resolving this
issue. Thanks to all in advance.
regards,

_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*   
http://join.msn.com/?page=features/junkmail


Mime
View raw message