If you've used PHP and Java before, JSPs will be really easy to understand. You write JSPs just like you do PHP, except the syntax is like that of Java rather than a mix of shell scripting and C++. Server-side, JSPs get compiled whereas PHP is always interpreted (as far as I know). This can be annoying for development if your app server (Tomcat, Sun appserver, etc) does not check to see if the source and compiled version are the same version, eg, you make a change but it doesn't recompile the source (solutions are to a) find the jsp_name_here.class and .java and delete them or b) change the server settings). But lets get on with it:
PHP:
my code here ?> (actually there should be no space between the ? and the php but then blogger won't save this post!)
JSP:
<% my code here %>
Additionally, you can also do
<%= call a function here %>
and the return value of the function will get printed. Besides that, the only other difference you need to know to get started is includes, which are import in Java. Here's an example:
<%@page import=" java.util.HashMap, java.util.ArrayList" %>
Just put that at the top of the file. You can include other JSPs too, for example if you have a template you want at the top of your page.
<%@include file="templateTop.jsp" %>
Subscribe to:
Post Comments (Atom)
Labels
- Java (34)
- Oracle (27)
- javascript (24)
- NIX administration (19)
- Reporting (18)
- XML (17)
- Web Graphics (10)
- perl (10)
- CSS (9)
- Tomcat (8)
- Android (7)
- Matlab (7)
- XSL (7)
- HTML (6)
- SQL (6)
- XForms (6)
- browser quirks (6)
- Orbeon XForms (5)
- Solaris (5)
- AJAX (4)
- Mirth Project (4)
- PHP (4)
- Video (4)
- Arduino (3)
- Eclipse (3)
- JPA (3)
- JSP (3)
- JSTL (3)
- LAMPS (3)
- SSH (3)
- SVN (3)
- Hibernate (2)
- Netbeans (2)
- Networking (2)
- Python (2)
- Windows (2)
- Wordpress (2)
- XHTML (2)
- Alfresco (1)
- Architecture (1)
- ArduPilot (1)
- Arduino Yun (1)
- Arduplane (1)
- Audio Recording (1)
- Betaflight (1)
- CouchDB (1)
- DIY (1)
- Design (1)
- FPV (1)
- JSON (1)
- JUnit (1)
- Mobile Development (1)
- Printing (1)
- RC Airplane (1)
- REST (1)
- Scalability (1)
- Struts (1)
- Tools (1)
- Virtualization (1)
- Web services (1)
- camera (1)
- canon (1)
- gphoto2 (1)
- jQuery (1)
- ubuntu (1)
- unix (1)
No comments:
Post a Comment