JSP Tutorial

Views:
 
Category: Entertainment
     
 

Presentation Description

No description available.

Comments

Presentation Transcript

Intro to JSP : 

Intro to JSP 01/2004

JSP Tutorial : 

JSP Tutorial Java Server Pages or JSP for short is Sun's solution for developing dynamic web sites. JSP provide excellent server side scripting support for creating database driven web applications.

JSP : 

JSP JSP enable the developers to directly insert java code into jsp file, this makes the development process very simple and its maintenance also becomes very easy.

JSP : 

JSP JSP pages are efficient, it loads into the web servers memory on receiving the request very first time and the subsequent calls are served within a very short period of time.

JSP : 

JSP Java is known for its characteristic of "write once, run anywhere." JSP pages are platform independent. Your port your .jsp pages to any platform.

JSP : 

JSP Java Server Pages are saved with .jsp extension. In jsp java codes are written between '<%' and '%>' tags. So it takes the following form : <%= Some Expression %>

JSP : 

JSP <%@page contentType="text/html" %> <html> <body> <%!int cnt=0;private int getCount(){//increment cnt and return the value

JSP : 

JSP cnt++;return cnt;}%> <p>Values of Cnt are:</p> <p><%=getCount()%></p> <p><%=getCount()%></p>

JSP : 

JSP <p><%=getCount()%></p> <p><%=getCount()%></p> <p><%=getCount()%></p> <p><%=getCount()%></p> </body> </html>

JSP : 

JSP <%= new java.util.Date() %>

JSP : 

JSP <html><head><title>Enter your name</title></head><body><p>&nbsp;</p><form method="POST" action="showname.jsp">

JSP : 

JSP <p><font color="#800000" size="5">Enter your name:</font><input type="text" name="username" size="20"></p><p><input type="submit" value="Submit" name="B1"></p></form></body></html>

JSP : 

JSP The target of form is "showname.jsp", which displays the name entered by the user. To retrieve the value entered by the user we uses the request.getParameter("username");

JSP : 

JSP Here is the code of "showname.jsp" file: <%@page contentType="text/html" %> <html> <body>

JSP : 

JSP <p><font size="6">Welcome :&nbsp; <%=request.getParameter("username")%></font></p> </body> </html>

JSP : 

JSP Tons of examples/info on Sun web-site...

authorStream Live Help