PDA

View Full Version : out.println



otnj2ee
Sep 10th, 2007, 11:52 PM
In a JSP page, I saw some codes like this:

<%
out.println("<script>");
...
out.println("</script>");
%>

My questions:

1)What is the "out"?

2)where does the "out.println" output the script?



Thanks


Scott

2reikis
Sep 11th, 2007, 12:16 AM
Doesn't look like Javascript to me. Have you tried the Java forum? .Jsp is a Java Server Page and that looks more like a server side language outputting javascript for a web page.

rnd me
Sep 11th, 2007, 06:48 AM
In a JSP page, I saw some codes like this:

<%
out.println("<script>");
...
out.println("</script>");
%>

My questions:

1)What is the "out"?

2)where does the "out.println" output the script?



Thanks


Scott



1. out is usually the page html visible at the url of your jsp file.

2. to the current page buffer, at the place of the command at time of executing, after that which have been written before.

i don't know much about jsp, but servers typically pring pages in a top-down fashion: <html> to </html>.


servers 101

remember that unlike html source, not all the code in a server file will make it to browser. some parts 'runat' the sever, and are not written to the buffer. those parts are where you place the code.


not sure if this is true of jsp, but in asp, php, etc. most simpler server pages can be though of as beefed-up templetes. you use regular html to layout a page, leaving blank spaces for dynamic content. you then fill the holes with server code, which then writes out (in that html hole) the result of the server code.