Hi,
Thanks for the reply. I tried but to no avail (see below). Is there a way
for me to dump the value of ${dtSet} in jsp like a Data::Dumper in CGI?
dataset dtset = new dataset();
ResultSet rs = dtset.getDataSet(this.conn, " Select * from oss_users
", "" , " order by id");
ArrayList userList = new ArrayList();
users user = new users();
try {
rs.last();
int last = rs.getRow();
int ctr = 0;
rs.first();
for (ctr = 0; ctr < last; ctr++ ){
user.setId(rs.getString("ID"));
user.setPassword(rs.getString("PASSWORD"));
user.setUsername(rs.getString("USERNAME"));
user.setFname(rs.getString("FNAME"));
user.setMname(rs.getString("MNAME"));
user.setLname(rs.getString("LNAME"));
user.setEmail(rs.getString("EMAIL"));
user.setPosition(rs.getString("POSITION"));
user.setAge(rs.getString("AGE"));
userList.add(user);
rs.next();
}
} catch (SQLException e){
e.printStackTrace();
}
sce.getServletContext().setAttribute("dtSet", userList);
}
Regards,
Joseph
On Wed, Jul 2, 2008 at 10:05 AM, Eduardo Dela Rosa <
[EMAIL PROTECTED]> wrote:
> I think this line
>
> for (ctr = 0; ctr < *rs.getRow()*; ctr++ )
>
> will keep your code from loading contents of your ResultSet into your List.
>
> rs.getRow() returns the current row pointer (which is ZERO) and will never
> be greater than your counter.
>
> hth.
>
> On Wed, Jul 2, 2008 at 2:42 PM, Joseph Bautista <
> [EMAIL PROTECTED]> wrote:
>
>> Hello,
>>
>> Can someone shed light please?
>>
>> Regards
>>
>> On Fri, Jun 27, 2008 at 8:58 AM, Joseph Bautista <
>> [EMAIL PROTECTED]> wrote:
>>
>>> Hello Gurus,
>>>
>>> I've been fixing this "Nothing to display" problem for week now but to
>>> no avail. Can somebody please help?? See code below...
>>>
>>> public void contextInitialized(ServletContextEvent sce) {
>>>
>>> dataset dtset = new dataset();
>>> ResultSet rs = dtset.getDataSet(this.conn, " Select * from
>>> oss_users ", "" , " order by id"); This returning the list
>>> ArrayList userList = new ArrayList();
>>> users user = new users();
>>> try {
>>>
>>> rs.last();
>>> int ctr = 0;
>>> rs.first();
>>>
>>> for (ctr = 0; ctr < rs.getRow(); ctr++ ){
>>> user.setId(rs.getString("ID"));
>>> user.setPassword(rs.getString("PASSWORD"));
>>> user.setUsername(rs.getString("USERNAME"));
>>> user.setFname(rs.getString("FNAME"));
>>> user.setMname(rs.getString("MNAME"));
>>> user.setLname(rs.getString("LNAME"));
>>> user.setEmail(rs.getString("EMAIL"));
>>> user.setPosition(rs.getString("POSITION"));
>>> user.setAge(rs.getString("AGE"));
>>> userList.add(user);
>>> rs.next();
>>> }
>>>
>>> } catch (SQLException e){
>>> e.printStackTrace();
>>> }
>>> sce.getServletContext().setAttribute("dtSet", userList);
>>> }
>>> In my jsp:
>>>
>>> <display:table name="${dtSet}" export="true" id="row" class="dataTable"
>>> defaultsort="1" defaultorder="ascending"
>>> pagesize="16" cellspacing="0" >
>>> <display:column property="ID" title="ID"
>>> class="hidden" headerClass="hidden" media="html" />
>>> <display:column property="USERNAME"
>>> title="Username" sortable="true" class="username" headerClass="username" />
>>> <display:column property="PASSWORD"
>>> title="password" class="hidden" headerClass="hidden" media="html" />
>>> <display:column property="FNAME"
>>> title="First Name" sortable="true" class="fname" headerClass="fname" />
>>> <display:column property="LNAME"
>>> title="Last Name" sortable="true" class="lname" />
>>> <display:column property="MNAME"
>>> title="Middle Name" sortable="true" class="mname" headerClass="mname" />
>>> <display:column property="EMAIL"
>>> title="Email Address" sortable="true" class="email" headerClass="email" />
>>> <display:column property="POSITION"
>>> title="Position" sortable="false" class="position" headerClass="position" />
>>> <display:column property="AGE"
>>> title="AGE" sortable="false" class="age" headerClass="age" />
>>> </display:table>
>>> In my web.xml,
>>>
>>> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
>>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>>> <welcome-file-list>
>>> <welcome-file>users.jsp</welcome-file>
>>> </welcome-file-list>
>>> <listener>
>>> <listener-class>oss.service.dataloader</listener-class>
>>> </listener>
>>>
>>> </web-app>
>>>
>>> Regards,
>>>
>>> Joseph
>>> --
>>>
>>>
>>
>>
>> --
>> Joseph DC Bautista
>>
>> Senior Activation Analyst - OSS
>> Tel +971 4 369 2063
>> Mobile +971 55 953 1596
>> www.du.ae
>>
>>
>> -------------------------------------------------------------------------
>> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
>> Studies have shown that voting for your favorite open source project,
>> along with a healthy diet, reduces your potential for chronic lameness
>> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
>> _______________________________________________
>> displaytag-user mailing list
>> displaytag-user@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>>
>>
>
>
> --
> Eduardo Dela Rosa
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> _______________________________________________
> displaytag-user mailing list
> displaytag-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/displaytag-user
>
>
--
Joseph DC Bautista
Senior Activation Analyst - OSS
Tel +971 4 369 2063
Mobile +971 55 953 1596
www.du.ae
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
displaytag-user mailing list
displaytag-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/displaytag-user