写出javabean类book.java代码

 我来答
西安IT优就业
2017-11-20 · TA获得超过1561个赞
知道小有建树答主
回答量:1108
采纳率:90%
帮助的人:182万
展开全部
Book.java类 package javaBean; public class Book {
private String bookname;//书名
private String author;//作者
private String publish;//出版社
private double price;//价格
private int print;//版次
private int count;//印数
private String time; //出版时间

public String getBookname() {
return bookname;
}
public void setBookname(String bookname) {
this.bookname = bookname;
}
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getPublish() {
return publish;
}
public void setPublish(String publish) {
this.publish = publish;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
public int getPrint() {
return print;
}
public void setPrint(int print) {
this.print = print;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public String getTime() {
return time;
}
public void setTime(String time) {
this.time = time;
}
}
input.html页面:
<html>
<head>
<title>input.html</title>
</head>

<body>
<form action="get.jsp" method="get" >
<table border="1">
<tr>
<td>
书名:
</td>
<td>
<input type="text" name="bookName" >
</td>
</tr>
<tr>
<td>
作者:
</td>
<td><input type="text" name="author" ></td>
</tr>
<tr>
<td>
出版社:
</td>
<td><input type="text" name="publish" ></td>
</tr>
<tr>
<td>
价格:
</td>
<td><input type="text" name="price" ></td>
</tr>
<tr>
<td>
版次:
</td>
<td><input type="text" name="print" ></td>
</tr>
<tr>
<td>
印数:
</td>
<td><input type="text" name="count" ></td>
</tr>
<tr>
<td>
出版时间:
</td>
<td><input type="text" name="time" ></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" name="submit" value="提交"></td>
</tr>
</table>
</form>
</body>
</html>
get.jsp页面:<%@ page language="java" import="java.util.*" pageEncoding="GBK"%><html>
<head>
<title>My JSP 'get.jsp' starting page</title>
</head>

<body>
<jsp:useBean id="book" class="javaBean.Book" scope="session"/><br/>
<jsp:setProperty property="bookname" name="book" param="bookName"/><br/>
<jsp:setProperty property="author" name="book" param="author"/><br/>
<jsp:setProperty property="publish" name="book" param="publish"/><br/>
<jsp:setProperty property="price" name="book" param="price"/><br/>
<jsp:setProperty property="print" name="book" param="print"/><br/>
<jsp:setProperty property="count" name="book" param="count"/><br/>
<jsp:setProperty property="time" name="book" param="time"/><br/>
<a href="show.jsp" >成功获取表单信息</a>
</body>
</html>
show.jsp页面:<%@ page language="java" import="java.util.*" pageEncoding="GBK"%><html>
<head>
<title>My JSP 'index.jsp' starting page</title>
</head>
<body>
<jsp:useBean id="book" class="javaBean.Book" scope="session"></jsp:useBean>
书名:<jsp:getProperty property="bookname" name="book" /><br/>
作者:<jsp:getProperty property="author" name="book" /><br/>
出版社:<jsp:getProperty property="publish" name="book" /><br/>
价格:<jsp:getProperty property="price" name="book" /><br/>
版次: <jsp:getProperty property="print" name="book" /><br/>
印数:<jsp:getProperty property="count" name="book" /><br/>
出版 时间:<jsp:getProperty property="time" name="book" /><br/>
<body>
</body>
</html>
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式