刚开始运用的pageContext样例

来源:互联网 发布:php shell exec 阻塞 编辑:程序博客网 时间:2024/05/15 03:46
<%@ page language="java" import="java.util.*" pageEncoding="utf-8" isELIgnored="false" %><%@ page import="demo.entity.*,demo.db.*" %><%@ taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <base href="<%=basePath%>">        <title>明细列表</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>   <jsp:useBean id="pfDAO" class="demo.db.ProfileDAO"></jsp:useBean>  <%   Profile profile = null;    String id_str = request.getParameter("id");  this.log("list页面传递到detaily页面的ID的值:" + id_str); if(id_str != null && !id_str.equals("")){ profile = new Profile();  profile.setId(Long.valueOf(id_str));  profile = pfDAO.get(Integer.valueOf( id_str));  }    pageContext.setAttribute("profile_str",profile); /**/  %>  <body>   <c:if test="${not empty pageScope.profile_str}">  <table border="2">  <tr>  <td>编号</td>  <td>${pageScope.profile_str.id }</td>  </tr>  <tr>  <td>姓名</td>  <td>${pageScope.profile_str.name }</td>  </tr>  <tr>  <td>性别</td>  <td>${pageScope.profile_str.gender }</td>  </tr>  <tr>  <td>职业</td>  <td>${pageScope.profile_str.career }</td>  </tr>  <tr>  <td>地址</td>  <td>${pageScope.profile_str.address }</td>  </table>  <a href="list.jsp"><input type="button" value="返回"/></a>  </c:if>    </body></html>