Setting an array in JSP with resultset data from a javabean

From: Alex (alex.ortiz_at_netzero.com)
Date: 06/22/04


Date: 22 Jun 2004 10:40:57 -0700

Hi all-
I am having a little trouble storing resultset data from a javabean
into an array located in a JSP page.
Any other approaches, advice or links to information would be
appreciated.
Thanks in advance.
Alex O-

If have tried this but I get a tomcat error stating that it expected
String instead of String[].
 
|--BEGIN JSP CODE --|
<% Resultset rs = FieldJB.fieldResults(); %>
<% String [] stringarray = new String [5]; %>

<% for (int floop = 0; floop<= 5; floop++)
        {
        while (rs.next())
                {
                        stringarray[floop] = rs.getString("table.field");
                }
        floop++;
        }
%>
|-- END JSP CODE --|



Relevant Pages

  • Re: OutOfMemoryError - how to find root cause
    ... If you extract a small substring of a large string in any of these ways, you may be fooled into thinking that it uses less heap than it really does. ... That causes a new, right-sized char array to be created for the new String, and it is, IMO, the only reason to ever use the Stringconstructor. ... because only one instance of a JSP not declared non-thread-safe will ever be maintained by the application at one time. ... I find that it helps to keep in mind that JSP is just a shortcut to Java code; if I know how JSP constructs and actions map to Java then I can predict a JSP's fine behavioral details. ...
    (comp.lang.java.programmer)
  • download a file from jsp
    ... I have a jsp where I show a table. ... From each browser I can download a part of the file but not the ... HttpServletResponse response) { ... String strCod_analisis = ...
    (comp.lang.java.help)
  • Re: Performance Issue: JSP response rendering
    ... the tree a fetched from database, appropriate HTML structure is formed ... for each node and is the string is then rendered on the JSP as JSP ... But to render the complete on browser it takes more than 1 minute. ...
    (comp.lang.java.programmer)
  • Re: Javascript : formname.body.value.length == 0 validation
    ... In the jsp there is a validation where we check for the length of the ... JavaScript have nothing to do with one another and aren't even owned by ... generated HTML that the browser sees, or is hidden in the JSP code on the ... The OP definitely needs to clarify the question if he/she intends it to be ...
    (comp.lang.java.programmer)
  • Re: (struts/JSTL) Setting bean property value with jstl choose compound results
    ... I have some JSTL in a JSP that creates a statement on ... Details of layout and prompt should be the exclusive province of the JSP. ... Keep the entire prompt in the form in the first place, and compute the various pieces server side. ... The same logic that computes registrationForm.map.displayableMax could also compute the entire string. ...
    (comp.lang.java.programmer)