请各位大侠帮忙,jsp最基础的问题!66分哦
1、<form action="playsql.jsp" method=put>与<form action="playsql.jsp" method=get> ,post有什么区别啊?
2、为什么zjp.jsp上的<input type="text" name="licensecode">不能通过playsql.jsp上写的<jsp:setProperty name="sqlbean" property="*"/>传到sqlbean的licensecode属性里,请各位帮我指点一下(我能运行成功,除了打印出out.println(sqlbean.getLicensecode());)
***********************zjp.jsp********************************
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<body>
<h1 align="center">请输入licensecode:
<input type="text" name="licensecode">
</h1>
<h1 align="center"> 点击确定,执行查询语句 </h1>
<form action="playsql.jsp" method=put>
<h1 align="center">
<input type="submit" name="Submit" value="提交">
</h1>
</form>
<h1 align="center"> </h1>
</body>
</html>
***********************playsql.jsp*************************
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="sqlbean" scope="request" class="com.jspdev.ch6.Sqlbean">
<jsp:setProperty name="sqlbean" property="*"/>
</jsp:useBean>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!-- TemplateBeginEditable name="doctitle" -->
<title>执行sql的jsp页面,把zjp.jsp传来的licensecode传给sqlbean?/title>
</head>
<body>
<%
out.println(sqlbean.getLicensecode());
out.println("success ");
%>
</body>
</html>
//////////////Sqlbean.java///////////////////////
package com.jspdev.ch6;
import java.util.HashMap;
import java.lang.*;
import java.io.*;
import java.sql.*;
import java.util.*;
public class Sqlbean
{
private Connection con;
private String licensecode;
private int count;
public Sqlbean()
{
String CLASSFORNAME="com.microsoft.jdbc.sqlserver.SQLServerDriver";
String SERVANDDB="jdbc:microsoft:sqlserver://10.37.241.22:1433;DatabaseName=regiebk";
String USER="sa";
String PWD="@wl@";
try
{
Class.forName(CLASSFORNAME);
con = DriverManager.getConnection(SERVANDDB,USER,PWD);
}
catch(Exception e)
{
e.printStackTrace();
}
}
public void setLicensecode(String licensecode)
{
this.licensecode=licensecode;
}
public String getLicensecode()
{
return this.licensecode;
}
public int getCount()
{
return this.count;
}
public void selectLicensecode()
{
try
{
PreparedStatement stm=con.prepareStatement("select * from dbo.R_License_License where LicenseCode=? ");
stm.setString(1,licensecode);
try
{
ResultSet rs=stm.executeQuery();
while (rs.next())
{count++;
}
}
catch(Exception e)
{
}
con.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}