JSP操作XML

来源:互联网 发布:郝海东网络直播视频 编辑:程序博客网 时间:2024/05/29 13:22

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////



<%--index.jsp  添加公告信息页面--%>

<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%
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>保存公告信息到XML文件</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">    
<link rel="stylesheet" type="text/css" href="CSS/style.css">
<script language="javascript">
function check(form){
if(form.title.value==""){
alert("请输入公告标题!");form.title.focus();return false;
}
if(form.content.value==""){
alert("请输入公告内容!");form.content.focus();return false;
}
}
</script>
  </head>
  
  <body>
<form name="form1" method="post" action="PlacardServlet" target="_blank" onSubmit="return check(this)">
  <table width="500" height="271" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
    <tr>
      <td width="90" height="23">&nbsp;</td>
      <td width="410">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" align="center">·添加公告信息</td>
    </tr>
    <tr>
      <td height="28" align="center">公告标题:</td>
      <td><input name="title" type="text" id="title" size="52"></td>
    </tr>
    <tr>
      <td height="157" align="center">公告内容:</td>
      <td><textarea name="content" cols="50" rows="9" id="content"></textarea></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input name="Submit" type="submit" class="btn_grey" value="保存">
      &nbsp;
      <input name="Submit2" type="reset" class="btn_grey" value="重置"></td>
    </tr>
  </table>
</form>  
  </body>

</html>










////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


中转页



<%--index.jsp  中转页--%>
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
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">    


<link rel="stylesheet" type="text/css" href="CSS/style.css">
  </head>
  
  <body>
<c:redirect url="/PlacardServlet">
    <c:param name="action" value="query"/>
</c:redirect>
  </body>
</html>







<%--modify.jsp  修改公告信息页面--%>
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
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">    


<link rel="stylesheet" type="text/css" href="CSS/style.css">
  </head>
  
  <body><form name="form1" method="post" action="PlacardServlet?action=modify">
  <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="61">&nbsp;</td>
      <td width="397">&nbsp;</td>
      <td width="42">&nbsp;</td>
    </tr>
<c:set var="form" value="${placardContent}"/>
    <tr>
      <td height="30" align="center" bgcolor="#FFFFFF">标题:</td>
      <td colspan="2" bgcolor="#FFFFFF"><input name="title" type="text" id="title" value="${form.title}" size="52">
      <input name="id" type="hidden" id="id" value="${form.id}"></td>
    </tr>


    <tr>
      <td height="27" align="center" bgcolor="#FFFFFF">内容:</td>
      <td colspan="2" bgcolor="#FFFFFF"><textarea name="content" cols="50" rows="8" id="content">${form.content}</textarea></td>
    </tr>
    <tr>
      <td height="27" align="center" bgcolor="#FFFFFF">&nbsp;</td>
      <td height="30" colspan="2" align="center" bgcolor="#FFFFFF">
        <input name="Submit" type="submit" class="btn_grey" value="保存">
      &nbsp;
      <input name="Submit2" type="reset" class="btn_grey" value="重置">
&nbsp;
<input name="Submit3" type="button" class="btn_grey" value="返回" onClick="history.back(-1)"></td>
    </tr>
  </table>
  </form>
  </body>
</html>












<%--placardList.jsp  公告列表页面--%>
<%@ page language="java" import="java.util.*" pageEncoding="GBK"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
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">    


<link rel="stylesheet" type="text/css" href="CSS/style.css">
    <style type="text/css">
<!--
.style1 {color: #FFFFFF}
-->
    </style>
</head>
  
  <body>
  <table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="415">&nbsp;</td>
      <td width="43">&nbsp;</td>
      <td width="42">&nbsp;</td>
    </tr>
    <tr>
      <td height="27" colspan="3" align="center" bgcolor="#FFFFFF"><span class="style1"></span><span class="style1"></span>[${description}]${createTime}</td>
    </tr>
    <tr>
      <td height="27" align="center" bgcolor="#FFFFFF">标题</td>
      <td align="center" bgcolor="#FFFFFF">修改</td>
      <td align="center" bgcolor="#FFFFFF">删除</td>
    </tr>
<c:if test="${rssContent==null}">
<tr>
<td height="27" colspan="3" align="center" bgcolor="#FFFFFF">暂无公告!</td>
</tr>
</c:if>
<c:forEach var="form" items="${rssContent}">
    <tr>
      <td height="27" bgcolor="#FFFFFF">&nbsp;${form.title}</td>
      <td align="center" bgcolor="#FFFFFF"><a href="PlacardServlet?action=modify_query&id=${form.id}"><img src="images/modify.gif" width="20" height="18" border="0"></a></td>
      <td align="center" bgcolor="#FFFFFF"><a href="PlacardServlet?action=del&id=${form.id}"><img src="images/del.gif" width="23" height="22" border="0"></a></td>
    </tr>
</c:forEach>
  </table>
<c:if test="${rssContent!=null}">
  <table width="500" height="42" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td align="center"><a href="PlacardServlet?action=clearAll">[删除全部公告]</a></td>
    </tr>
  </table>
</c:if>


  </body>
</html>










////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


<%@ page language="java" contentType="text/html" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>'index.jsp'</title>
    <!--
<link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
  
  <body>
    <jsp:forward page="BookServlet"></jsp:forward>
  </body>
</html>





////////////////////////////////////////////////////////////////////////////////////////////////////////////////////




<%@ page language="java" contentType="text/html" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>'index.jsp'</title>
    <!--
<link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
  
  <body>
    <jsp:forward page="FindAllServlet"></jsp:forward>
  </body>
</html>






<%@ page language="java" contentType="text/html" pageEncoding="GBK"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>'news_list.jsp'</title>
    <!--
<link rel="stylesheet" type="text/css" href="styles.css">
    -->
    <style type="text/css">
    #div1{
    width: 450px;
    margin: 10px;
    font-size: 12px;
    text-align: left;
    }
    li{
    list-style: none;
    }
    </style>
  </head>
  
  <body>
    <div align="center">
    <div style="width: 450px; border: solid 1px;text-align: left; padding: 10px;">
    <font color="red">当前位置&gt;&gt;新闻内容</font>
    <c:forEach items="${list}" var="n">
    <div id="div1">
    <ul>
    <li><b>${n.title}</b>[${n.createTime}]</li>
    <li>${n.content}</li>
    <li style="text-decoration: underline;color: blue;">阅读全文</li>
    </ul>
    <hr>
    </div>
    </c:forEach>
    <a href="Rss.xml" target="_blank">Rss订阅</a>
    订阅地址:http://locahost:8080/Rss.xml
    </div>
    </div>
  </body>
</html>










////////////////////////////////////////////////////////////////////////////////////////////////////////////////////




<%@ page language="java" contentType="text/html" pageEncoding="GBK"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>'index.jsp'</title>
    <!--
<link rel="stylesheet" type="text/css" href="styles.css">
    -->
  </head>
  
  <body>
   <jsp:forward page="FindServlet"></jsp:forward>
  </body>
</html>








<%@ page language="java" contentType="text/html" pageEncoding="GBK"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>学生信息</title>
<style type="text/css">
    #div1{
    font-size:12px;
    width:500px;
    padding: 5px;
    border: solid 1px;
    background-color: yellow;
    }
    ul{
    list-style:none;
    }
    </style>
</head>


<body>
<div>
    <c:forEach items="${list}" var="s">
    <div id="div1">
    <ul>
    <li>学号:${s.id}</li>
    <li>姓名:${s.name}</li>
    <li>年龄:${s.age}</li>
    <li>性别:${s.sex}</li>
    </ul>
    </div>
   </c:forEach>
   </div>
</body>
</html>











////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

0 0
原创粉丝点击