wood burning stoves 2.0*
The moose likes JSP and the fly likes Problem while Tag lib Up gradation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Problem while Tag lib Up gradation" Watch "Problem while Tag lib Up gradation" New topic
Author

Problem while Tag lib Up gradation

Seenu Reddy
Ranch Hand

Joined: Apr 03, 2002
Posts: 108
We have problem while Tag library application upgraded from Websphere3.5 to Websphere6. The Tag library looks in JSP has follows.

<database:query id='headers' scope='application'>
SELECT <%=report.getColumnName()%> Product, hdr_desc_txt Header, hdr_cd Action FROM <%=report.getReportType()%>_HDR_VIEW where <%=report.getColumnName()%>='<%=report.getProduct()%>'
</database:query>

In above query the dynamic values are populating correctly and become complete valid query while executing in the JSP. Problem only when this query set into BodyContent class by the Tag libraries the query become

SELECT <jsp:expression></jsp:expression> Product, hdr_desc_txt Header, hdr_cd Action FROM <jsp:expression></jsp:expression>_HDR_VIEW where <jsp:expression></jsp:expression>='<jsp:expression></jsp:expression>'

In above query the original value by <%=report.getColumnName()%> is replacing with value <jsp:expression></jsp:expression>. That is the reson I am getting JDBC errors. I have upgraded the .tld version to 1.2 and tested, but it has the same errors. I think there is some problem while executing setBodyContent() in BodyTagSupport class by web sphere runtime environment.

Do you guys have any idea about this error? Please let me know? My code is below.

QueryTag.java
----------------
package tags.jdbc;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;

import beans.jdbc.Query;

import com.lincolnlife.services.AWPUtils;


public class QueryTag extends BodyTagSupport implements Constants {
private String scope = "page";
private boolean update = false, driverLoaded = false;

public void setId(String id) {
this.id = id;
}
public void setScope(String scope) {
this.scope = scope;
}
public void setUpdate(boolean update) {
this.update = update;
}
public int doEndTag() throws JspException {
Connection conn = null;

try {

conn = (Connection)AWPUtils.getConnection();
}
catch(Exception cex) {
throw new JspException(cex.getMessage());
}

if(bodyContent != null) {
try {
String query = bodyContent.getString();
System.out.println("query: " + query);
Statement statement = conn.createStatement(
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs = null;
int rows = 0;

if(update) {
rows = statement.executeUpdate(query);
Query.save(new Query(statement, rows),
pageContext, id, scope);
}
else {
rs = statement.executeQuery(query);
Query.save(new Query(statement, rs),
pageContext, id, scope);
}
}
catch(SQLException ex) {
throw new JspException(ex.getMessage());
}
}
return EVAL_PAGE;
}
}
Database.tld
--------------

<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag
Library 1.2//EN"
"http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">


<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<shortname>Sun Microsystems Press Tag library</shortname>
<tag>
<name>show_table</name>
<tagclass>tags.jdbc.ShowTableTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>query</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>database</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>border</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>cellPadding</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>transaction</name>
<tagclass>tags.jdbc.TransactionTag</tagclass>
<bodycontent>tagdependent</bodycontent>
<attribute>
<name>file</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>prepareStatement</name>
<tagclass>tags.jdbc.PrepareStatementTag</tagclass>
<bodycontent>tagdependent</bodycontent>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

</tag>
<tag>
<name>executePreparedStatement</name>
<tagclass>tags.jdbc.ExecutePreparedStatementTag</tagclass>
<bodycontent>None</bodycontent>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>variables</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>update</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

</tag>
<tag>
<name>query</name>
<tagclass>tags.jdbc.QueryTag</tagclass>
<bodycontent>tagdependent</bodycontent>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>scope</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>update</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>rows</name>
<tagclass>tags.jdbc.RowsTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>query</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>startRow</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>endRow</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>columnNames</name>
<tagclass>tags.jdbc.ColumnNamesTag</tagclass>
<teiclass>tags.jdbc.ColumnNamesTagInfo</teiclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>query</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>id</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
<tag>
<name>columns</name>
<tagclass>tags.jdbc.ColumnsTag</tagclass>
<teiclass>tags.jdbc.ColumnsTagInfo</teiclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>query</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>columnValue</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
<attribute>
<name>columnName</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

</tag>
<tag>
<name>release</name>
<tagclass>tags.jdbc.ReleaseTag</tagclass>
<bodycontent>JSP</bodycontent>
<attribute>
<name>query</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>
</taglib>


Thanks,<br />Seenu<br />SCJP1.4,SCBCD1.3,Next-->SCWCD1.4
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60804
    
  65

"Seenu R",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Problem while Tag lib Up gradation
 
Similar Threads
Custom tags in Tomcat 3.1 - what's the function of the URI
displat:table tag pls help me
Can't deploy code for taglibs on Tomcat 5.5
Custom Tags - Repeating Tags
jakarta-tomcat-4.0.1 taglib problem