Sorry for sending wrong SampleList.java, the following contains the
right file.
Hi All,
I am new to this taglib, and I am trying to do the following:
File: test2.jsp
-------------------------------------------------------------
<%@ include file="inc/header.jsp" %>
<%@ page import="test.SampleList" %>
<%
request.setAttribute( "test", new SampleList() );
List test2 = new ArrayList( 6 );
test2.add( "Test String 1" );
test2.add( "Test String 2" );
test2.add( "Test String 3" );
test2.add( "Test String 4" );
test2.add( "Test String 5" );
test2.add( "Test String 6" );
request.setAttribute( "test2", test2 );
%>
<display:table name="test2" />
<display:table name="test" >
<display:column property="firstname"/>
<display:column property="lastname"/>
</display:table>
<%@ include file="inc/footer.jsp" %>
/////////////////////////////////////////////////////////////////
File: SampleList.java
--------------------------------------------------------------------
package test;
import java.util.ArrayList;
/**
* Just a utility class for testing out the table and column tags.
*
*
* @author ajay
* @version 1.0
*/
public class SampleList extends ArrayList
{
private String fname="first";
private String lname="last";
/**
* Creats a SampleList that is filled with 10 SampleObjects suitable for testing
*/
public SampleList()
{
super();
for (int j = 0; j < 10; j++)
{
add(new SampleObject(fname+j, lname+j);
}
}
public String getName()
{
return name;
}
}
///////////////////////////////////////////////////////////////////
File: SampleObject.java
----------------------------------------------------------------------
package test;
public class SampleObject extends Object
{
private String firstname;
private String lastname;
public SampleObject(String str1, String str2)
{
this.firstname=str1;
this.lastname=str2;
}
public String getFirstname()
{
return firstname;
}
public String getLastname()
{
return lastname;
}
}
Can anyone let me why I am getting this error:
root cause
javax.servlet.ServletException: Error looking up property "firstname"
in object type "java.lang.String"
at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:533)
at org.apache.jsp.test2_jsp._jspService(test2_jsp.java:187)
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
displaytag-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/displaytag-user