maxlength="80" /><br />
<b>Definition: </b><br />
<stripes:textarea name="definition" rows="10" cols="75"></stripes:textarea>
<stripes:submit name="add" class="btn" value="Add" /></div>
</stripes:form>
<div class="footer">
<hr style="height: 1px;" />
Glossary 1.0 is brought to you by <a target="_blank"
href="http://ibm.com/developerworks">IBM DeveloperWorks</a></div>
</div>
</body>
</html>
]]>
图 19 展示了 Glossary 1.0 Add Term 表单。
图 19. Glossary 1.0 Add Term 表单
利用Stripes、Apache Derby和Eclipse进行无配置的J2EE开发(二)(10)
时间:2011-03-26 IBM B.J. Allmon
/glossary/termEdit.jsp
/glossary/termEdit.jsp 文件(如 清单 12 所示)与 termAdd.jsp 几乎相同,只有 两点除外。首先,预填充的表单值利用 JSTL。其次,Submit 按钮名触发 save 而不是 add 事件处理程序。
清单 12. /glossary/termEdit.jsp
<![CDATA[
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="text/html;charset=UTF-8" language="java"% >
<%@ taglib prefix="stripes"
uri="http://stripes.sourceforge.net/stripes.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"% >
<html>
<head>
<link rel="stylesheet" type="text/css"
href="${pageContext.request.contextPath}/style/glossary.css" />
<script src="${pageContext.request.contextPath}/scripts/glossary.js"></script> ;
<title>Glossary 1.0</title>
</head>
<body>
<div class="contentBorder">
<a href="${pageContext.request.contextPath}">
<img border="0" src="${pageContext.request.contextPath}/images/glossary.gif"
class="logo" />
</a>
<c:if test=''${actionBean.term.term == null}''>
<jsp:forward page="/glossary/action/Glossary.action" />
</c:if>
<stripes:form action="/glossary/action/Glossary.action" method="POST">
<stripes:hidden name="termId" value="${actionBean.term.id}" />
<div class="contentBody">
<div class="title">Term:
<span id="term"><c:out value="${actionBean.term.term}" /></span></div>
<br />
<br />
<b>Definition: </b><br />
<stripes:textarea name="definition" rows="10" cols="75"
value="${actionBean.term.definition}" />
|