第3章 课后作业

第2题

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
    <%
        Integer count = (Integer) application.getAttribute("count");
        if (count != null) {
            count++;
        } else {
            count = 1;
        }
        application.setAttribute("count", count);
    %>
    该网页已被访问&nbsp;
    <%=count%>
    &nbsp;次
</body>
</html>

第3题

<%@ page language="java" import="java.util.*,com.news.entity.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>主题列表--管理后台</title>
<link href="../css/admin.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="header">
  <div id="welcome">
    欢迎使用新闻管理系统!</div>
  <div id="nav">
    <div id="logo"><img src="../images/logo.jpg" alt="新闻中国" /></div>
    <div id="a_b01"><img src="../images/a_b01.gif" alt="" /></div>
  </div>
</div>
<div id="admin_bar">
  <div id="status">管理员: 登录  &nbsp;&nbsp;&nbsp;&nbsp; <a href="newspage/login.jsp?action=loginout">login out</a></div>
  <div id="channel"> </div>
</div>
<div id="main">
  <%@include file="console_element/left.html" %>
  <div id="opt_area">
    <ul class="classlist">
      <%
          ArrayList<Topic> list4=(ArrayList<Topic>)session.getAttribute("list4");        
              for(Topic topic: list4) {
      %>
      <li> &nbsp;&nbsp;&nbsp;&nbsp; <%=topic.getTname() %> &nbsp;&nbsp;&nbsp;&nbsp; <a href='topic_modify.jsp?tid=<%=topic.getTid() %>&tname=<%=topic.getTname() %>'>修改</a> &nbsp;&nbsp;&nbsp;&nbsp; <a href='#'>删除</a> </li>
      <%}%>
    </ul>
  </div>
</div>
<div id="footer">
  <%@include file="console_element/bottom.html" %>
</div>
</body>
</html>

第4题

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>添加主题--管理后台</title>
<link href="../css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
    function check() {
        var tname = document.getElementById("tname");

        if (tname.value == "") {
            alert("请输入主题名称!!");
            tname.focus();
            return false;
        }
        return true;
    }
</script>
</head>
<body>
    <div id="header">
        <div id="welcome">欢迎使用新闻管理系统!</div>
        <div id="nav">
            <div id="logo">
                <img src="../images/logo.jpg" alt="新闻中国" />
            </div>
            <div id="a_b01">
                <img src="../images/a_b01.gif" alt="" />
            </div>
        </div>
    </div>
    <div id="admin_bar">
        <div id="status">
            管理员: 登录 &nbsp;&nbsp;&nbsp;&nbsp; <a href="#">login out</a>
        </div>
        <div id="channel"></div>
    </div>
    <div id="main">
        <%@include file="console_element/left.html"%>
        <div id="opt_area">
            <h1 id="opt_type">添加主题:</h1>
            <form action="../util/topic_ control.jsp?opr=add" method="post"
                οnsubmit="return check()">
                <p>
                    <label> 主题名称 </label> <input name="tname" type="text"
                        class="opt_input" id="tname" />
                </p>
                <input name="action" type="hidden" value="addtopic" /> <input
                    type="submit" value="提交" class="opt_sub" /> <input type="reset"
                    value="重置" class="opt_sub" />
            </form>
        </div>
    </div>
    <div id="footer">
        <%@include file="console_element/bottom.html"%>
    </div>
</body>
</html>

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值