⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 htmljavabean.jsp

📁 此资源是jsp应用开发 邓子云等编写的一书里的源代码
💻 JSP
字号:
<%@ page contentType="text/html;charset=GB2312" %>
<%!
public String codeToString(String str)
{//处理中文字符串的函数
	String s=str;
  	try{
    	byte tempB[]=s.getBytes("ISO-8859-1");
    	s=new String(tempB);
    	return s;
  	}catch(Exception e){
    	return s;
  	}  
}
%>

<jsp:useBean id="csaiBookZYS" class="bean.book" scope="page">
</jsp:useBean>
<jsp:setProperty name="csaiBookZYS" property="*"/>
<html>
<head>
<title>用HTML表单设置JavaBean的属性</title>
</head>
<body>
<div align="center">
  <center>
<%
    out.println("书籍ID号:"+csaiBookZYS.bookId+"<br>"); 
    out.println("书名:"+codeToString(csaiBookZYS.bookName)+"<br>");
    out.println("作者:"+codeToString(csaiBookZYS.bookAuthor)+"<br>");
    out.println("出版社:"+codeToString(csaiBookZYS.bookPublisher)+"<br>");
    out.println("定价:"+csaiBookZYS.bookPrice);  
%>
  <table border="1" width="46%">
  <form name="form1" action="" method="post">
    <tr>
      <td width="44%">请输入书籍ID号:</td>
      <td width="56%"> <input type="text" name="bookId" size="20"></td>
    </tr>
    <tr>
      <td width="44%">请输入书名:</td>
      <td width="56%"> <input type="text" name="bookName" size="20"></td>
    </tr>
    <tr>
      <td width="44%">请输入作者名字:</td>
      <td width="56%"> <input type="text" name="bookAuthor" size="20"></td>
    </tr>
    <tr>
      <td width="44%">请输入出版社名称:</td>
      <td width="56%"> <input type="text" name="bookPublisher" size="20"></td>
    </tr>
    <tr>
      <td width="44%">请输入此书的定价:</td>
      <td width="56%"> <input type="text" name="bookPrice" size="20"></td>
    </tr>
    <tr>
      <td width="100%" colspan="2">
        <p align="center"><input type="submit" name="T1" size="20" value="提交">
                <input type="reset" name="T1" size="20" value="重置"> </td>
    </tr>
    </form>
  </table>
  </center>
</div>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -