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

📄 contactlist.jsp

📁 java对象/关系数据库映射工具hibernate和java web 框架struts结合的实例
💻 JSP
字号:
<!doctype HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<%@ taglib uri="/tags/struts-bean" prefix="bean" %>
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="/tags/struts-logic" prefix="logic" %>
<%@ page import="eg1.ContactList" %>
<!-- name="<%=ContactList.USER%>" -->
<!-- You normally don't need to do this, but we want to use the same page with three different examples -->
<bean:define id="action" name="org.apache.struts.action.mapping.instance" property="path" type="java.lang.String"/>
<html>
<head>
<title>Address Book</title>
</head>
<body>
	<h2>Hibernate Contact List Demo</h2>
    <html:link action="/HomePage"/>
	<html:form action="/ContactList">
		<html:text property="userName"/>
		<html:submit property="login"/>
		<input type="hidden" name="action" value="login"/>
	</html:form>

    <logic:equal name="egForm" property="loggedIn" value="true">

	<html:form action="<%=action%>">

		<h2>
			Address Book For:
			<html:text property="name" />
			<html:submit property="action" value="update" />
			<html:submit property="action" value="delete" />
		</h2>

	</html:form>

		<h4><bean:size name="user" property="contacts" id="contacts"/><bean:write name="contacts"/> contacts</h4>

		<table>
			<tr>
				<td><b>Name</b></td>
				<td><b>Address</b></td>
				<td><b>Phone</b></td>
				<td><b>Delete</b></td>
			</tr>
            <html:form action="<%=action%>">
            <logic:iterate id="contact" name="user" property="contacts">
				<tr>
					<td><bean:write name="contact" property="contactName" /></td>
					<td><bean:write name="contact" property="address" /></td>
					<td><bean:write name="contact" property="phone" /></td>
					<td><html:hidden property="action" value="deleteEntry" />
					    <html:submit property="id"><bean:write name="contact" property="id" /></html:submit></td>
				</tr>
			</logic:iterate>
	        </html:form>
	        <html:form action="<%=action%>">
			<tr>
				<td><html:text property="contactName" /></td>
				<td><html:text property="address" /></td>
				<td><html:text property="phone" /></td>
				<td><html:submit property="action" value="addEntry" /></td>
			</tr>
        	</html:form>
		</table>

	</logic:equal>

    <hr>

    <p>
    <html:link action="/eg1">Example 1</html:link> | <html:link action="/eg2">Example 2</html:link>  | <html:link action="/eg3">Example 3</html:link>
    </p>

</body>
</html>

⌨️ 快捷键说明

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