📄 5.mvn
字号:
show_body.jsp:
<%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/camel-define.tld" prefix="camel"%>
<html:form action="operatorAction.do" method="post">
<bean:message key="show.body.totalrecords"/>
<bean:write name="pageinfo" property="recordCountNumber" scope="session"/>
<bean:message key="show.body.totalpages"/>
<bean:write name="pageinfo" property="pageCountNumber" scope="session"/>
<bean:message key="show.body.currentlypage"/>
<bean:write name="pageinfo" property="currentlyPage" scope="session"/>
<logic:greaterThan name="pageinfo" property="currentlyPage" value="1">
<html:link href="operatorAction.do?operator=showFirstPage">
<bean:message key="show.body.first"/>
</html:link>
<html:link href="operatorAction.do?operator=showPreviousPage">
<bean:message key="show.body.previous"/>
</html:link>
</logic:greaterThan>
<camel:isLastPage page="pageinfo">
<html:link href="operatorAction.do?operator=showNextPage">
<bean:message key="show.body.next"/>
</html:link>
<html:link href="operatorAction.do?operator=showLastPage">
<bean:message key="show.body.last"/>
</html:link>
</camel:isLastPage>
<br/>
<table align="left" border="1" width="70%">
<tr bgcolor="#COCOCO">
<td align="center">
<bean:message key="book.id"/>
</td>
<td align="center">
<bean:message key="book.name"/>
</td>
<td align="center">
<bean:message key="book.author"/>
</td>
<td align="center">
<bean:message key="book.publish"/>
</td>
<td align="center">
<bean:message key="book.price"/>
</td>
<td align="center">
<bean:message key="book.operator"/>
</td>
</tr>
<logic:iterate id="book" name="books" scope="session">
<tr>
<td width="10%">
<bean:write name="book" property="bookId"/>
</td>
<td width="25%">
<bean:write name="book" property="bookName"/>
</td>
<td width="10%">
<bean:write name="book" property="author"/>
</td>
<td width="25%">
<bean:write name="book" property="publish"/>
</td>
<td width="10">
<bean:write name="book" property="price"/>
</td>
<td width="25%">
<a href="operatorAction.do?operator=showModify&bookid=<bean:write name="book" property="bookId"/>">
<bean:message key="link.modify"/>
</a>
<a href="operatorAction.do?operator=showDelete&bookid=<bean:write name="book" property="bookId"/>">
<bean:message key="link.delete"/>
</a>
</td>
<bean:define id="bookid" name="book" property="bookId"/>
</tr>
</logic:iterate>
</table>
</html:form>
show.jsp:
<%@page contentType="text/html; charset=GBK"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert definition="show-definition"/>
edit_body.jsp:
<%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<!--
<script src="/WEB-INF/js/check.js" type="javascript"/>
onsubmit="return check(this)"
<html:errors/>
-->
<center>
<html:form action="/operatorAction.do?operator=SubmitRecord" method="post">
<logic:present name="bookBean">
<table align="center" border="0">
<tr>
<td>
<bean:message key="book.id"/>
</td>
<td>
<html:text name="bookBean" property="bookId"/>
</td>
</tr>
<tr>
<td>
<bean:message key="book.name"/>
</td>
<td>
<html:text name="bookBean" property="bookName"/>
</td>
</tr>
<tr>
<td>
<bean:message key="book.author"/>
</td>
<td>
<html:text name="bookBean" property="author"/>
</td>
</tr>
<tr>
<td>
<bean:message key="book.publish"/>
</td>
<td>
<html:text name="bookBean" property="publish"/>
</td>
</tr>
<tr>
<td>
<bean:message key="book.price"/>
</td>
<td>
<html:text name="bookBean" property="price"/>
</td>
</tr>
<tr>
<td>
<html:submit property="submit">
<bean:message key="button.submit"/>
</html:submit>
</td>
<td>
<html:reset>
<bean:message key="button.reset"/>
</html:reset>
</td>
</tr>
</table>
</logic:present>
</html:form>
</center>
editrecord.jsp:
<%@page contentType="text/html; charset=GBK"%>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert definition="edit-definition"/>
find_body.jsp:
<%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles"%>
<center>
<html:form action="findRecordAction.do" method="post">
<html:select property="findByKey">
<html:option value="bookName">
<bean:message key="find.jsp.findkey.bookname"/>
</html:option>
<html:option value="author">
<bean:message key="find.jsp.findkey.author"/>
</html:option>
<html:option value="publish">
<bean:message key="find.jsp.findkey.publish"/>
</html:option>
</html:select>
<html:text property="findByValue"/>
<br/>
<html:submit>
<bean:message key="find.jsp.submit"/>
</html:submit>
</html:form>
</center>
findrecord.jsp:
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert definition="find-definition"/>
success_body.jsp:
<%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<table width="50%" border="0" align="center" cellpadding="10" cellspacing="0">
<tr>
<td bgcolor="#A4A4A4">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="15" cellspacing="1">
<tr>
<td bgcolor="#E1E1E1">
<div align="center">
<strong>
<html:link href="/operatorAction.do?operator=showFirstPage">
<bean:message key="success.jsp.operatorerror"/>
<bean:message key="jsp.back"/>
</html:link>
</strong>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
success.jsp:
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert definition="success-definition"/>
error_body.jsp:
<%@page contentType="text/html; charset=GBK"%>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<table width="50%" border="0" align="center" cellpadding="10" cellspacing="0">
<tr>
<td bgcolor="#A4A4A4">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#FFFFFF">
<table width="100%" border="0" cellpadding="15" cellspacing="1">
<tr>
<td bgcolor="#E1E1E1">
<div align="center">
<strong>
<html:link href="/operatorAction.do?operator=showFirstPage">
<bean:message key="error.jsp.operatorerror"/>
<bean:message key="jsp.back"/>
</html:link>
</strong>
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
error.jsp:
<%@ page contentType="text/html; charset=GBK" %>
<%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
<tiles:insert definition="error-definition"/>
以下是消息资源文件,都位于WEB-INF/classes/目录下,
中文消息资源文件ApplicationResources.properties:
head.title.welcome=\u5934\u90e8!
head.language.chinese=\u4e2d\u6587
head.language.english=\u82f1\u6587
left.title.welcome=\u5de6\u8fb9\u83dc\u5355!
left.link.index=\u9996\u9875
left.link.show=\u6d4f\u89c8\u4e66\u7c4d
left.link.addnew=\u6dfb\u52a0\u4e66\u7c4d
foot.title.welcome=\u5e95\u90e8!
foot.copyright=\u7248\u6743\u6240\u6709 @2005.5 by \u5317\u5927\u9752\u9e1f
index.body.title=\u9996\u9875\u4e3b\u4f53\u90e8\u5206!
show.body.title=\u6d4f\u89c8\u9875\u4e3b\u4f53\u90e8\u5206!
index.body.nextshow=\u6d4f\u89c8
index.jsp.lang.error=<font color=red>\u8bed\u8a00\u53c2\u6570\u9519\u8bef</font>
index.jsp.language.null=<font color=red>\u8bed\u8a00\u53c2\u6570\u4e3a\u7a7a</font>
index.jsp.operator.error=<font color=red>\u64cd\u4f5c\u53c2\u6570\u9519\u8bef</font>
index.jsp.operator.null=<font color=red>\u64cd\u4f5c\u53c2\u6570\u4e3a\u7a7a</font>
link.delete=\u5220\u9664
link.modify=\u4fee\u6539
book.id=\u4e66\u53f7
book.name=\u4e66\u540d
book.author=\u4f5c\u8005
book.publish=\u51fa\u7248\u793e
book.price=\u5355\u4ef7
book.operator=\u64cd\u4f5c
button.submit=\u63d0\u4ea4
button.reset=\u91cd\u7f6e
button.cacel=\u53d6\u6d88
show.body.totalrecords=\u603b\u8bb0\u5f55\u6570:
show.body.totalpages=\u603b\u9875\u6570:
show.body.currentlypage=\u5f53\u524d\u9875\u7801:
show.body.first=\u6700\u524d\u9875
show.body.previous=\u4e0a\u4e00\u9875
show.body.next=\u4e0b\u4e00\u9875
show.body.last=\u6700\u540e\u9875
book.bookid.error=\u4e66\u53f7\u4e3a\u7a7a\u6216\u9519\u8bef!
book.bookname.error=\u4e66\u540d\u4e3a\u7a7a\u6216\u9519\u8bef!
book.author.error=\u4f5c\u8005\u4e3a\u7a7a\u6216\u9519\u8bef!
book.publish.error=\u51fa\u7248\u793e\u4e3a\u7a7a\u6216\u9519\u8bef!
book.price.error=\u5355\u4ef7\u4e3a\u7a7a\u6216\u9519\u8bef!
editrecord.jsp.adderror=\u6dfb\u52a0\u8bb0\u5f55\u672a\u6210\u529f!
editrecord.jsp.modifyerror=\u4fee\u6539\u8bb0\u5f55\u672a\u6210\u529f!
editrecord.jsp.deleteerror=\u5220\u9664\u8bb0\u5f55\u672a\u6210\u529f!
editrecord.body.title=\u7f16\u8f91\u9875\u9762\u4e3b\u4f53!
edit.body.error=\u975e\u6cd5\u64cd\u4f5c!
error.jsp.operatorerror=\u64cd\u4f5c\u9519\u8bef!
left.link.findbykey=\u81ea\u5b9a\u4e49\u67e5\u8be2
find.jsp.error=<font color=red>\u8bf7\u9009\u62e9\u548c\u586b\u5199\u67e5\u8be2\u53c2\u6570!</font>
find.jsp.submit=\u67e5\u627e
find.jsp.findkey.bookname=\u4e66\u540d\u79f0
find.jsp.findkey.author=\u4f5c\u8005
find.jsp.findkey.publish=\u51fa\u7248\u793e
success.jsp.operatorerror=\u64cd\u4f5c\u6210\u529f
jsp.back=\u8fd4\u56de\u4e3b\u9875\u9762
findrecord.jsp.notfound=\u672a\u67e5\u627e\u5230\u76f8\u5173\u8bb0\u5f55!
英文消息资源文件ApplicationResources_en.properties:
head.title.welcome=Head!
head.language.chinese=Chinese
head.language.english=English
left.title.welcome=Welcome Left!
left.link.index=Index
left.link.show=Browse Book
left.link.addnew=Add New Book
foot.title.welcome=Welcome foot!
foot.copyright=Copyright @2005.5 by Camel
index.body.title=Welcome index body!
show.body.title=Welcome browser body!
index.body.nextshow=SHOW
index.jsp.lang.error=<font color=red>Language Error</font>
index.jsp.language.null=<font color=red>Language Null</font>
index.jsp.operator.error=<font color=red>Operator Error</font>
index.jsp.operator.null=<font color=red>Operator Null</font>
link.delete=DELETE
link.modify=MODIFY
book.id=ID
book.name=BOOK NAME
book.author=AUTHOR
book.publish=PUBLISH
book.price=PRICE
book.operator=OPERATOR
button.submit=Submit
button.reset=Reset
button.cancel=Cancel
show.body.totalrecords=Total Records:
show.body.totalpages=Total Pages:
show.body.currentlypage=Currently Page:
show.body.first=First
show.body.previous=Previous
show.body.next=Next
show.body.last=Last
book.bookid.error=BookID is null or error!
book.bookname.error=BookName is null or error!
book.author.error=Author is null or error!
book.publish.error=Publish is null or error!
book.price.error=Price is null or not number!
editrecord.jsp.adderror=Add Record Error!
editrecord.jsp.modifyerror=Modify Record Error!
editrecord.jsp.deleteerror=Delete Record Error!
editrecord.body.title=Welcome Edit page body!
edit.body.error=Invalid Operator!
error.jsp.operatorerror=Operator error
jsp.back=Back main page
left.link.findbykey=Custom Find
find.jsp.error=<font color=red>Please select find key and input value!</font>
find.jsp.submit=Find
find.jsp.findkey.bookname=BookName
find.jsp.findkey.author=Author
find.jsp.findkey.publish=Publish
success.jsp.operatorerror=Operator success
jsp.back=Back main page
findrecord.jsp.notfound=It's nothing to found!
我使用的是MySQL4.0数据库,驱动程序为:mm.mysql-2.0.14-bin.jar,数据脚本bookshop如下:
create database bookshop;
use bookshop;
create table booktab
(bookid varchar(20) primary key not null,
bookname varchar(50) not null default '',
author varchar(50) not null default '',
publish varchar(50) not null default '',
price varchar(20) not null default 0.00);
测试记录集由大家去Insert20多条吧。
因为这个论坛我不能上传附件,所以只好把代码一个一个的贴上来,我现在在一家小公司做事,工作中体会最深的是,对于应用软件项目来说,最重要的是客户的需求,使用什么技术不是最重要的,所以想和大家说一下,不要执迷于技术。对于一个软件项目,编写代码只占整个开发周期的20%,甚至更低。大部分的时间是在围绕客户需求做功能测试。能够写出上面的代码,对于一个程序员只能说只是达到了最基本的要求,对于一个程序员来说,最重要的是执着,耐心和锲而不舍。
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -