oops I didn't see your reply and posted basically the same thing.
sorry :)
Does anyone have trouble with Mozilla not being able to keep threads
together? It doesn't always put a message where it belongs in a thread.
d.
Galbreath, Mark wrote:
> Well, I notice a few things here.
>
> 1. Java constants should be all upper-case, so "iMaxBookmarks" should be
> "IMAXBOOKMARKS," and Java variables and methods should begin lower-case
> chars, so "MyBookmarkArray" should be myBookmarkArray.
>
> 2. I can't see how in the world you are setting a session attribute called
> "MyBookmarkArray" with a ResultSet rs and undefined variable i. I think
> what you want to do is something like
>
> int i = 0;
>
> while( rs.next) {
> myBookmarkArray[i] = rs.getString( "bookmark");
> i++;
> }
>
> rs.close();
> conn.close();
> session.setAttribute("myBookmarkArray", myBookmarkArray);
>
> 3. In your JSP, iterate through the array to get the values:
>
> <%
> Bookmark myBookmarkArray[] =
> ( Bookmark) session.getAttribute( "myBookmarkArray");
>
> for( int i = 0; i < myBookmarkArray.length(); i++) {
> out.println( myBookmarkArray[i];
> }
> %>
>
> 4. You will find more help for this kind of stuff on the struts-user mail
> list at jakarta.apache.org/struts.
>
> Mark
>
> -----Original Message-----
> From: Richard Diaz [mailto:[EMAIL PROTECTED]]
> Sent: Monday, May 20, 2002 4:30 PM
>
> Here's what I'm doing:
>
> int iMaxBookmarks = 25;
> Bookmark[] MyBookmarkArray = new
> Bookmark[iMaxBookmarks];
>
> while (rs.next())
> {
> MyBookmarkArray[i] = new Bookmark();
> session.setAttribute("MyBookmarkArray[" + i + "]",
> MyBookmarkArray);
> // set all data for MyBookmarkArray[i] (this works
> fine)...
>
> }
>
> // Close the ResultSet
> System.out.println("bookmarks done");
> rs.close();
>
> in my JSP page I get a NULL POINTER EXCEPTION...
>
> <%=MyBookmarkArray[1].getpk() %> </br>
>
> I have verified there are 3 bookmarks created.
>
> also I can see all my non array session variables just
> not this array one... a scope problem?
>
> Also, anyone know of a good JSP Forum? I need to also
> figure out how to loop output of the above array
> inside the JSP.
>
> thanks in advance.
> Rich
>
>
> __________________________________________________
> Do You Yahoo!?
> LAUNCH - Your Yahoo! Music Experience
> http://launch.yahoo.com
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
>
--
David Mossakowski [EMAIL PROTECTED]
Instinet Corporation 212.310.7275
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html