写出javabean类book.java代码
1个回答
展开全部
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>
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>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询