> <%! String fname %>
> <% String nextName=notebookBean.getNextFirstname();
> while (nextName != null) {%>
> nextName=<%= nextName %>;
> <% nextName = notebookBean.getNextFirstname();
> } %>
Try:
<% // I'll just use one "big" scriptlet block
String fname;
String nextName = notebookBean.getNextFirstname() ;
while ( !nextName.equals( null ) ) {
fname = nextName; // I think this is what you meant, right?
nextName = notebookBean.getNextFirstname();
// etc.
}
%>
It looks like you used = (assignment), rather than == (comparison), in your
while condition statement. Either way, I think you want to use equals()
method, as shown.
String objects are compared with equals() to show if the values are the same
and == to show if the objects are the same.
Hope this helps.
Phil
-----Original Message-----
From: Garcia, Cristina <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Monday, May 15, 2000 8:11 AM
Subject: using "while" statement
>I tried to use a "while" statement as a scriplet but it didnīt work.
>
>The code looks like this:
>
><%! String fname %>
><% String nextName=notebookBean.getNextFirstname();
> while (nextName != null) {%>
> nextName=<%= nextName %>;
><% nextName = notebookBean.getNextFirstname();
> } %>
>
>The same "idea" but written with an IF statement works but not with
>the WHILE statement. Why?
>
>I appreciate your help!
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets