about jsp and html

i ' am new to jsp , if i ask any stupid question , i'm soryy.....

if jsp code incude html,

many book code style like this...

<%

//do something

out.println("<html>test</html>")

%>

i try to code like asp , such like

<%

// do something...

%>

<html>test</html>

<%

continue...

%>

but in the second style, the page can't appear anything... does jsp can't write like the second style...

[537 byte] By [justforfree] at [2007-9-26 3:43:55]
# 1
No.You can use<%=continue%> if its a variable otherwise you cant write constants inside <% %>You can do<%//do whatever%>continue<%//do more%>Here is a literal
adamrau at 2007-6-29 12:23:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

sorry my real mean is that if in asp , we can code asp with html such like:

<%

WHILE NOT rs.EOF

%>

<tr>

<td width="300"><%=rs("FAQExplain")%></td>

</tr>

<% rs.movenext

count = count+1

Wend

%>

can jsp code like this ?

justforfree at 2007-6-29 12:23:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

Sure can. The following should work.

<html>

<body>

<table>

<% for (int i=1; i <= 5; i++) { %>

<tr>

<td>This is row <%=i%></td>

</tr>

<% } // end for %>

</table>

</body>

</html>

jpardi at 2007-6-29 12:23:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...