Pages

Monday, June 16, 2008

JSP Reference

For Reference
--------------

JWS ---> For Testing Purpose
JSP engine ---> Process jsp file

Java Web Sever
---------------
set path =C:\JWS

C:\ jserv -nojre -javahome C:\Jdk1.3

Methods --------> Get ,Post

Get is used to send small amount of data .No Security
In get method all data are in querystring(Enviornment variable--> To send data from Client to server) this are added at the end of requested URL

If method is post all data from user is stored in STDIN (Enviornment variable--> To send data from Client to server) ,high security not visible to client .The data is passed through socket.


The data from Server to Client
------------------------------
Response ----- Response Header ,Response Data ,Status code


Status code ----Result of request

Eg : 404 ---Not found
200----Sucess
500----Internal server (Error prblm with server side pgm)



XML IS FOR DATA STORAGE
MIME -Multipurpose Internet Mail Extension

JSP TAGS
---------
Directives
Scripting Elements
a) Declarations b) Scriplets c) Expression
Actions
Comments

Directives
----------

<%@ page import= "Java.util.*"%> --To import JSP package
<%@ page contentType="text/html"%>
<%@ page language ="java"%>
<%@ page isErrorpage ="true"%>

Directives gives Global information about JSP Pages

------------------------------
Syntax For JSP

1) ASP like Syntax
2) XML syntax


ASP Syntax
----------
<%@ page import="java.util.*"%>

XML syntax
-----------
JSP:directive.page import="java.util.*"

--------------------------------------------------------------
jsp:forward page="abc.jsp"


Actions
--------
jsp:plugin ------ is to download applets >
jsp:usebean ------ is action tag used to create object of java beans >


Example --------- Closing and opening Tags should be added
---------

html
jsp: plugin type ="applet" code="audio.class" width =230 height = 500
jsp: fall back> cannot download applet jsp:fallback
jsp:plugin>
html


Session ------> Represents an user (browser) Creates session ID


Comments
---------

1) (HTML) --- Process at Client Side
2) <%---'Contents'---------> (JSP) --- Process at Server Side
3) Java like
a) // b) /* */


Session Tracking (To identify Client )
----------------

1) User authentication
2) Hidden Fields
3) URL Rewriting
4) Cookies


Command for starting J2EE
> j2ee -verbose
> j2ee -stop ------> To stop

Set Path java_home=d:\jdk\bin

*.jar --------> jar archive (zip like file of java ) (Collection of Class file)

Example
---------
<%@page import ="java.sql.*"%>
<%@page import ="sun.jdbc.odbc.JdbcodbcDriver"%>
---- 3 interfaces connect,statement,Result set
<% Connection con =null // Store actvie db connect Statement st =null; //used for parsing sql command Result set rs =null // Storing db result %>

---Html Codes in this outprintln-------");
out.println("
Employee No.
");
while (rs.next())
{
out.println("
");
out.println("
" + rs.getString("empno")+ "....");
out.println("");
rs.close();
st.close();
con.close();
}
%>
--->

No comments:

Post a Comment