javaEE考试代码

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

public void setLoginName(String loginName) { this.loginName = loginName; } @Column(name = "login_pwd", length = 10) public String getLoginPwd() { return this.loginPwd; } public void setLoginPwd(String loginPwd) { this.loginPwd = loginPwd; } @Temporal(TemporalType.DATE) @Column(name = "signup_date", length = 10) public Date getSignupDate() { return this.signupDate; } public void setSignupDate(Date signupDate) { this.signupDate = signupDate; } @Column(name = "city", length = 10) public String getCity() { return this.city; } public void setCity(String city) { this.city = city; } @Column(name = "mark_deleted") public Boolean getMarkDeleted() { return this.markDeleted; } public void setMarkDeleted(Boolean markDeleted) { this.markDeleted = markDeleted; } }
MemberInfoExtDAO.java:
package com.flightweb.dao.ext; import java.util.Date; import java.util.List; import javax.persistence.EntityManager; import javax.persistence.Query; import com.flightweb.EntityManagerHelper; import com.flightweb.MemberInfo1; import com.flightweb.MemberInfo1DAO; public class MemberInfoExtDAO extends MemberInfo1DAO{ private EntityManager em = EntityManagerHelper.getEntityManager(); public List<MemberInfo1> findByDate(Date start, Date end){ String queryString = "select model from MemberInfo1 model where model.signupDate >= " + ":start and model.signupDate <= :end"; Query query = em.createQuery(queryString); query.setParameter("start", start); query.setParameter("end", end); return query.getResultList(); } }
Leabharlann Baidu
<h:form> 注册时间: <h:inputText value="#{memberBean.start}"> <f:convertDateTime pattern="yyyy.MM.dd"/> </h:inputText> <h:inputText value="#{memberBean.end}"> <f:convertDateTime pattern="yyyy.MM.dd"/> </h:inputText> <h:commandButton value="查 找" action="# {memberBean.findByDate}"></h:commandButton> <h:dataTable value="#{memberBean.allUser}" var="item" styleClass="orders" headerClass="ordersHeader" columnClasses="evenColumn,oddColumn" <h:column> <f:facet name="header"> <h:outputText value="是否删除"/> </f:facet> <h:selectBooleanCheckbox value="# {item.markDeleted}" onchange="submit()"> </h:selectBooleanCheckbox> </h:column> <h:column> <f:facet name="header"> <h:outputText value="会员编号"/> </f:facet> <h:outputText value="#{item.id}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="登陆名"/> </f:facet> <h:outputText value="# {item.loginName}"/> </h:column>
private String city; private Boolean markDeleted; // Constructors /** default constructor */ public MemberInfo1() { } /** minimal constructor */ public MemberInfo1(Integer id) { this.id = id; } /** full constructor */ public MemberInfo1(Integer id, String loginName, String loginPwd, Date signupDate, String city, Boolean markDeleted) { this.id = id; this.loginName = loginName; this.loginPwd = loginPwd; this.signupDate = signupDate; this.city = city; this.markDeleted = markDeleted; } // Property accessors @Id @Column(name = "id", unique = true, nullable = false) public Integer getId() { return this.id; } public void setId(Integer id) { this.id = id; } @Column(name = "login_name", length = 20) public String getLoginName() { return this.loginName; }
<% String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getS %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <base href="<%=basePath%>"> <title>My JSF 'member_list.jsp' starting page</title> <meta http-equiv="pragma" content="no-cache"> <meta http-equiv="cache-control" content="no-cache"> <meta http-equiv="expires" content="0"> <meta http-equiv="keywords" content="keyword1,keyword2,keyword3"> <meta http-equiv="description" content="This is my page"> <link rel="stylesheet" type="text/css" href="styles.css"> </head> <body> <f:view> 会员列表页面. <br>
<h:column> <f:facet name="header"> <h:outputText value="登陆密码"/> </f:facet> <h:outputText value="#{item.loginPwd}"/> </h:column> <h:column> <f:facet name="header"> <h:outputText value="注册时间"/> </f:facet> <h:outputText value="# {item.signupDate}"> <f:convertDateTime pattern="yyyy.MM.dd"/> </h:outputText> </h:column> <h:column> <f:facet name="header"> <h:outputText value="注册城市"/> </f:facet> <h:outputText value="#{item.city}"/> </h:column> </h:dataTable> <h:commandButton value="删 除" action="# {memberBean.deleteRow}"></h:commandButton> <br> 增加会员:<br> 会员编号:<h:inputText value="# {memberBean.member.id}"></h:inputText> 会员名:<h:inputText value="# {memberBean.member.loginName}"></h:inputText> <br> 会员密码:<h:inputText value="# {memberBean.member.loginPwd}"></h:inputText> 注册日期:<h:inputText value="# {memberBean.member.signupDate}"> <f:convertDateTime
MemberInfo1.java:
package com.flightweb; import java.util.Date; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; /** * MemberInfo1 entity. @author MyEclipse Persistence Tools */ @Entity @Table(name = "member_info1", catalog = "flightweb") public class MemberInfo1 implements java.io.Serializable { // Fields private Integer id; private String loginName; private String loginPwd; private Date signupDate;
Member_list.jsp:
<%@ page language="java" pageEncoding="gb2312"%> <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %> <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
pattern="yyyy.MM.dd"/> </h:inputText> <br> 注册城市:<h:inputText value="# {memberBean.member.city}"></h:inputText> <h:commandButton value="增 加" action="# {memberBean.createRow}"></h:commandButton> <br> </h:form> </f:view> </body> </html>
相关文档
最新文档