Skip to content | Skip to navigation
last week we had some theoretical things about jsp/servlets in university, so here just a few things:
- jsp and servlets doing the same thing (a javaserverpage will be run as a servlet)
- the only (afaik) difference between them is, that you can use mixed code (html and expressions, ..) in a jsp, in a servlet you have to print every html output in quotes, ..
short example for mixed code:
<% while (..) { %>
<tr><td>next line</td></tr>
<% } %>
basic examples you can find under: http://java.sun.com/products/jsp/html/jspbasics.fm.html
or a basic servlet example (extends HttpServlet, ..) http://java.sun.com/docs/books/tutorial/servlets/overview/simple.html
hope this helps a little bit.
tull.
So basically a JSP is kinda like PHP in that you can mix HTML and PHP code together in the same script.
exactly.
Is a servlet simply a java source code that gets compiled on the fly and outputs HTML or some other type of information?
imho not compiled on the fly (it runs in the servlet engine (eg tomcat)). About the output: yes.