当前位置:首页 » 编程博文
开发技术指南» 文章正文
    引言: 1. 用户通过login.htmlNT-FAMILY: 宋体;
 

 

    摘要:1. 首先是login.html页面,代码如下: <html> <body> <script language="javascript"> function valid(form) { if(form.username.value.length==0) { alert("please enter user......
    摘要:1. 这是4个servlet之间的通信 2. 代码如下: 1) 首先是test.htm文件,它作为客户端访问的页面 <!doctype html public "-//w3c//dtd html 4.0 transitional//en"> <html><head> <meta http-equiv=content-type ......


Servlet学习笔记(三)-----用HTML页面访问Servlet
1.       用户通过login.html页面,输入机票id号就可以得到该航班的起飞城市与目的城市

<html> 【程序编程相关:如何列举出网络上所有的SQL Serve

2.       login.html代码如下: 【推荐阅读:XMLHTTP抓取数据时乱码问题解决

<title>welcome to the online reservation system </title> 【扩展信息:构建一个.net Remoting 程序

<head>

</head>

<body>

<center>

<table>

<form method=post action="http://127.0.0.1:8000/servletcontext/flightalias">

<tr>

<td>your ticket number id here </td> <td><input type=text name=numid> </td>

</tr>

<tr>

<td>your password here </td> <td><input type=text name=password> </td>

</tr>

</table>

<center> <input type=submit>

</form>

</center>

</body>

</html>

注:servletcontext是web context, flightalias是component aliases

 

3.       servlet代码如下:(flight.java)

 

import javax.servlet.*;

import javax.servlet.http.*;

import java.io.*;

 

import java.util.*;

import java.sql.*;

 

public class flight extends httpservlet

{

       connection dbcon;

       preparedstatement s;

       resultset result;

       public void service(httpservletrequest req, httpservletresponse res)throws ioexception

       {

              //连接数据库

              try

              {                  

                     class.forname("sun.jdbc.odbc.jdbcodbcdriver");


...   下一页
 ·简单的timer例子    »显示摘要«
    摘要:一个简单的timer例子 山哥 http://csdn.blog.net/duoshan 有时想要换一定的间隔时间执行重复的任务,java.util.timer可以很简单的帮你实现。当然你也可以用多线程来实现。下面是用java.util.timer来实现这个功能。 //mytask.java 定义timertask任务,我们会在dotask中调用. //这里只是简单的打印一下任务参数 p......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE