小JSP程序
<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if(testbean==null){
testbean = new kg.TestBean2();
session.setAttribute("testbean",testbean);
}
%>
--%>
<jsp:useBean id="testbean" class="kg.TestBean2" scope="page" />
<%--
<jsp:setProperty name="testbean" property="myText" />
<jsp:getProperty name="testbean" property="myText"/>
<jsp:setProperty name="testbean" property="myPassword"/>
<jsp:getProperty name="testbean" property="myPassword"/>
--%>
<jsp:setProperty name="testbean" property="*"/>
用户名:<%=new String(testbean.getMyText().getBytes("ISO8859_1"),"GBK")%>
密码:<%=testbean.getMyPassword()%>
</body>
</html>
相关文档:
HTTP 通信协议是客户与服务器之间一种提交(请求) 信息与响应信息
(request/respone)的通信协议。在JSP 中,内置对象request 封装了用户提交的信息,
那么该对象调用相应的方法可以获取封装的信息,即使用该对象可以获取用户提交的信
息。
客户通常使用HTML 表单向服务器的某个JSP 页面提交信息,表单的一般格式是: ......
JSP中可能会碰到的问题解答
来源:不详 作者:佚名 更新时间: 2009年07月02日 点击:
JSP中可能会碰到的问题解答
1、如何混合使用Jsp和SSI #include?
在JSP中可以使用如下方式包含纯HTML:
< !--#include file="data.inc"-- >
但是如果data.inc中包含JSP CODE ,我们可以使用:
< %@include file= ......
package com.wxpn.tutorial.db;
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.SQLWarning;
import java.sql.Statement;
import java.util.Date;
/**
* 描述: 数据库连接池类
*
*
&n ......
try {
URL url = new URL("http://www.163.com");
InputStream is = url.openStream();
byte[] buffer = new byte[1024];
  ......
<%@ page language="java" import="kg.TestBean2;" %>
<%@ page contentType="text/html;charset=gb2312" %>
<html>
<head>
<title>HelloBean</title>
</head>
<body>
<%--
<%
kg.TestBean2 testbean=(kg.TestBean2)session.setAttribute("testbean");
if ......