• Post Reply Bookmark Topic Watch Topic
  • New Topic

create a checklistbox using tld in jsp  RSS feed

 
rutvi gen
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i have create a Tag Library File that generate checklist box. and this file i m using in jsp page.
the data in checklist box is coming from one of my database table.
now the problem is i m getting just five row from table. and i want all the data present in table.

my coding of tld file is as below,
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.1//EN" "http://java.sun.com/j2ee/dtds/web-jsptaglibrary_1_1.dtd">

<taglib>
<tlibversion>1.2</tlibversion>
<jspversion>1.1</jspversion>
<shortname>customlist</shortname>
<uri>http://www.servletsuite.com/servlets/customlisttag</uri>
<info>Custom list box taglib</info>

<tag>
<name>customlist</name>
<tagclass>com.cj.customlist.CustomListTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>ouputs a custom listbox</info>

<attribute>
<name>width</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>height</name>
<required>true</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>background</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>borderWidth</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>borderColor</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>className</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>style</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

</tag>

<tag>
<name>element</name>
<tagclass>com.cj.customlist.ElementTag</tagclass>
<bodycontent>JSP</bodycontent>
<info>ouputs an element</info>

<attribute>
<name>className</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>

<attribute>
<name>style</name>
<required>false</required>
<rtexprvalue>true</rtexprvalue>
</attribute>
</tag>

</taglib>


my coding of jsp page is,


<body>
<cl:customlist width="180px" height="1000px">
<% try {
String userName = "root";
String password = "root";
String url = "jdbc:mysql://192.168.4.29:3306/pts";
Class.forName("com.mysql.jdbc.Driver").newInstance();
conn = DriverManager.getConnection(url, userName, password);
System.out.println("Database connection established");
st = conn.createStatement();
ResultSet rs = st.executeQuery("select distinct(technology) from technology");
while (rs.next())
{
System.out.println(rs.getString(1));

%>
<cl:element><input type="checkbox" name=" <%=rs.getString(1)%>"><%=rs.getString(1)%></cl:element>
<%
}

} catch (Exception e1) {
System.err.println("Cannot connect to database server" + e1.getMessage());
} finally {
rs = null;
}
%>

</cl:customlist>

</body>
can anyone help???
thanks in advance.........
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"rutvija rutvijaG",
Please check your private messages regarding an important administrative matter.
-Ben
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!