Java Web
x86 Assembly = Servlet
C = JSP
C++ = JSF
================================
Online Shopping Cart
HTTP Cookies vs. HTTP QueryString/Web beacon
================================
HTTP Query String
Technically, the form content is only encoded as a query string when the form submission method is GET. The same encoding is used by default when the submission method is POST, but the result is not sent as a query string, that is, is not added to the action URL of the form. Rather, the string is sent as the body of the request.
================================
JDBC
1)JDBC-ODBC bridge
no additional thrid party jar requred, you can talk to Microsoft Access (*.mdb) in this way
2)thrid party JDBC driver
for instance, SQL Server Driver.
A note to know, when you execute the java class, go like this:
java -classpath .;msbase.jar;mssqlserver.jar;msutil.jar YourClass
=======================================================================
Servlet
* stand-alone servlet
1)create java file for instance %CATALINA_HOME%/webapps/myservlet/classes/SingleServlet.java and compile
2)add following line in %CATALINA_HOME%/webapps/myservlet/WEB-INF/web.xml
<servlet>
<servlet-name>SingleServlet</servlet-name>
<servlet-class>SingleServlet</servlet-class>
</servlet>
<servlet>
<servlet-mapping>
<servlet-name>SingleServlet</servlet-name>
<url-pattern>/SingleServlet</url-pattern>
</servlet-mapping>
3)visit your work through
http://127.0.0.1:8080/myservlet/SingleServlet
* packaged servlets
1)create java file for instance %CATALINA_HOME%/webapps/myservlet/classes/mypkg/PkgServlet.java and compile
2)add following line in %CATALINA_HOME%/webapps/myservlet/WEB-INF/web.xml
<servlet>
<servlet-name>PkgServlet</servlet-name>
<servlet-class>mypkg.PkgServlet</servlet-class>
</servlet>
<servlet>
<servlet-mapping>
<servlet-name>PkgServlet</servlet-name>
<url-pattern>/PkgServlet</url-pattern>
</servlet-mapping>
3)visit your work through
http://127.0.0.1:8080/myservlet/PkgServlet
=======================================================================
JSP(Tomcat)
download and install the windows msi package is ok.
to create you own web program
1)create folder under this one, %CATALINA_HOME%/webapps, for example, a folder named "hello"
%CATALINA_HOME%/Tomcat 5.5/webapps/hello
2)create a folder named WEB-INF under hello
<Path>/Tomcat 5.5/webapps/hello/WEB-INF
3)create index.jsp and place it into %CATALINA_HOME%/webapps/hello
4)visit you jsp file through http://127.0.0.1:8080/hello/index.jsp
*
5)to use JSTL
place jstl.jar and standard.jar into %CATALINA_HOME%/webapps/hello/WEB-INF/lib
=======================================================================
Hibernate
the fastest quickstart is to goole it with "hibernate tutorial", and go to road2hibernate
download the sample code and run it(the sample use hsqldb, an in-memory database)!! that is all!!
1)modify the sample to adapt to SQL Server
just modify the /src/hibernate.cfg.xml, change those lines:
<property name="hibernate.connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="hibernate.connection.url">jdbc:microsoft:sqlserver://127.0.0.1:1433;databasename=pubs</property>
<property name="hibernate.connection.username">sa</property>
<property name="hibernate.connection.password"></property>
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
and re-build and run it, that is all! (you even need not to create table, hbn will do this for you)
=======================================================================
Struts
to experience the framework, download the package and unpack it, then copy
apps/*.war to %CATALINA_HOME%/webapps/.
visit http://127.0.0.1:8080/struts2-blank-2.0.1
that is all!