I want to create a dynamic html table on my JSP page. I think usage of custom tags is the best idea for implementing this.
Does anyone know of any resources where I could get some sample code for this?
If anyone has done something similar before, then I would be grateful if you could share your code or give me some ideas.
The situation is as follows: My JavaBeans will get data from the EJB´s as a "vector of objects". I would like to now display each object with its attributes in one row and so on (i.e. OrderID, Price, Quantity etc). I am confused as to how I should implement it.
Is it possible that my custom tag can create an instance of the JavaBean and use the values directly from the JavaBean?
Any help in this regard would be appreciated. Even a small sample "simple" code would help. Thanks!
Sanjit
Discussions
Web tier: servlets, JSP, Web frameworks: How can I generate a dynamic HTML table using custom tags?
-
How can I generate a dynamic HTML table using custom tags? (1 messages)
- Posted by: Sanjit Singh
- Posted on: October 22 2001 05:30 EDT
Threaded Messages (1)
- How can I generate a dynamic HTML table using custom tags? by Weston Aiken on October 22 2001 11:20 EDT
-
How can I generate a dynamic HTML table using custom tags?[ Go to top ]
- Posted by: Weston Aiken
- Posted on: October 22 2001 11:20 EDT
- in response to Sanjit Singh
here is a very simple ex:
JSP Page
<%@ taglib uri="/META-INF/taglib.tld" prefix="html" %>
<html:GenerateTable/>
TLD File
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE taglib PUBLIC "-//Sun Microsystems...
<taglib>
<tlibversion>1.0</tlibversion>
<jspversion>1.1</jspversion>
<tag>
<name>GenerateTable</name>
<tagclass>TagHandler.class</tagclass>
<bodycontent>empty</bodycontent>
</tag>
</taglib>
TagHandler class
public int doStartTag() throws JspException {
//get JspWriter
JspWriter out = pageContext.getOut();
//lookup EJB and get your Vector of data
out.println("<table>");
//iterate thru Vector and write html table rows
out.println("</table>");
return SKIP_BODY;
}