form表单发送请求实例
Posted 奋斗的大海
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了form表单发送请求实例相关的知识,希望对你有一定的参考价值。
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8" import="java.util.*,javax.faces.context.FacesContext,javax.faces.application.FacesMessage,javax.servlet.http.HttpServletRequest"%>
<%@include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/meta.jsp"%>
<%@include file="/common/validator.jsp"%>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>搜索</title>
<link href="${ctx }/css/yyrj.css" rel="stylesheet" type="text/css">
<link href="${ctx }/scripts/calendar/skin/WdatePicker.css" rel="stylesheet" type="text/css">
<link href="css/main.css" rel="stylesheet" type="text/css">
<link href="css/table.css" rel="stylesheet" type="text/css">
<link href="css/Admin_Style.css" rel="stylesheet" type="text/css">
<style type="text/css">
body,td,th {
font-size: 12px;
}
.column_1 {
width: 100%;
text-align: left;
}
.position1{position:relative; bottom:-2px
}
.edit1{BORDER-BOTTOM: #8F908B 1px solid;
BORDER-LEFT: #8F908B 1px solid;
BORDER-RIGHT: #8F908B 1px solid;
BORDER-TOP: #8F908B 1px solid;
FONT-SIZE: 9pt;
height:20px;
}
</style>
<script type="text/javascript" src="${ctx}/scripts/calendar/WdatePicker.js"></script>
<script language="JavaScript" type="text/javascript">
document.onkeydown = function(evt){
var evt = window.event?window.event:evt;
if(evt.keyCode==13){
var find = document.getElementById("model.find").value;
form1.action="Msg_find_h.do?find="+encodeURI(encodeURI(find));
form1.submit();
}
}
</script>
<script language="javascript">
function findByEg() {
var find = document.getElementById("model.find").value;
form1.action="Msg_find_h.do?find="+encodeURI(encodeURI(find));
form1.submit();
}
function findByEgQ() {
var find = document.getElementById("model.find").value;
var pageNoid = document.getElementById("pageNoid").value;
pageNoid = parseInt(pageNoid)-1;
form1.action="Msg_find_h.do?find="+encodeURI(encodeURI(find))+"&pageNo="+pageNoid;
form1.submit();
}
function findByEgH() {
var find = document.getElementById("model.find").value;
var pageNoid = document.getElementById("pageNoid").value;
pageNoid = parseInt(pageNoid)+1;
form1.action="Msg_find_h.do?find="+encodeURI(encodeURI(find))+"&pageNo="+pageNoid;
form1.submit();
}
function findByEgS() {
var find = document.getElementById("model.find").value;
form1.action="Msg_find_h.do?find="+encodeURI(encodeURI(find))+"&pageNo=1";
form1.submit();
}
function findByEgM() {
var find = document.getElementById("model.find").value;
var pageNoid = document.getElementById("pageNoZid").value;
form1.action="Msg_find_h.do?find="+encodeURI(encodeURI(find))+"&pageNo="+pageNoid;
form1.submit();
}
function openFile(url) {
//alert("Msg_open.do?filename="+encodeURI(encodeURI(filename))+"&fullname="+encodeURI(encodeURI(url)));
window.location.href="Msg_open.do?fullname="+encodeURI(encodeURI(url));
}
</script>
</head>
<body>
<br>
<form name="form1" method="post" action="" id="form1">
<table width="95.5%" border="0" align="center" cellpadding="0"
cellspacing="0" class="line2">
<tr>
<td>
<table width="100%" bgcolor="#F9F9F9">
<tr>
<td width="50%" align="right" bgcolor="#F9F9F9">搜索附件:
<INPUT name="title" id="model.find" styleClass="edit1" size="57" value="${find}">
</td>
<td width="50%" align="left" bgcolor="#F9F9F9" class="position1">
<a href="#" class="a1" onclick="findByEg()"><img src="${ctx }/images/search_button.gif" border="0" alt="搜索"></a>
<!-- <input src="${ctx }/images/cx.gif" type="image" style="border:0px; width:66px; height:25px;" alt="查询"/> -->
</td>
</tr>
</table>
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5"></td>
</tr>
</table>
</form>
<%--
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="38"></td>
<td> 共有记录${totalHits}条</td>
</tr>
</table>
--%>
<form name="form2" method="post" action="" id="form2">
<input type="hidden" name="pageNo" id="pageNoid" value="${pageNo}"/>
<input type="hidden" name="pageNoZ" id="pageNoZid" value="${totalPages}"/>
<table width="96%" align="center">
<%--
<tr>
<td bgcolor="#7DBBE3" valign="top" align="center">
<span><h4>全文搜索结果</h4></span>
</td>
</tr>--%>
<%--
<input type="hidden" name="pageNo" id="pageNoid" value="${page.pageNo}" />
<table width="100%" border="0" cellspacing="1" cellpadding="0">
<tr align="center" bgcolor="#D4EAF8">
<td width="" background="../../images/62.jpg" class="lineheight20"> 标题 </td>
<td width="20%" background="../../images/62.jpg" class="lineheight20">所在路径</td>
<td width="12%" background="../../images/62.jpg" class="lineheight20">评分</td>
<td width="40%" background="../../images/62.jpg" class="lineheight20">内容</td>
</tr>
<c:forEach items="${list}" var="item" varStatus="status">
<tr bgcolor="#FFFFFF">
<td align="center" bgcolor="#FFFFFF">${item.title}</td>
<td align="center" bgcolor="#FFFFFF">${item.url}</td>
<td align="center" bgcolor="#FFFFFF">${item.grade}</td>
<td align="center" bgcolor="#FFFFFF">${item.content}</td>
</tr>
</c:forEach>
</table> --%>
<tr>
<td>
<table class="table" border="1" BorderColor="#9B9C96" cellpadding="1" cellspacing="0" style="border-collapse:collapse;border-top:none">
<thead>
<tr >
<th align="center" scope="col" bgcolor="#E5E5E5">附件搜索结果</th>
</tr>
</thead>
<%--
<c:choose>
<c:when test="${list != ‘‘ && list != null}">
</c:when>
<c:otherwise>
<tr bgcolor="#FFFFFF">
<td align="center" bgcolor="#FFFFFF"> <font color="#FF0000"> 没有相关记录! </font> </td>
</tr>
</c:otherwise>
</c:choose>
--%>
<c:forEach items="${list}" var="item" varStatus="status">
<tr bgcolor="#FFFFFF">
<td align="left" bgcolor="#FFFFFF">
<a href="javascript:openFile(‘${item.url}‘)" ><u>${item.title}</u></a><br>
${item.content}<br>
<%--所在路径:${item.url} 评分: ${item.grade}--%>
类型:${item.type} 发布时间:${item.operatetime} 发布人: {${item.username}} 所属频道:${item.channelname} 所属专题:${item.special}
</td>
</tr>
</c:forEach>
<tr bgcolor="#FFFFFF" id="show" style="display:‘‘">
<td align="center" bgcolor="#FFFFFF"> <font color="#FF0000"> 没有相关记录! </font> </td>
</tr>
</table>
<!-- 显示分页 -->
<table id="page" width="100%" border="0" align="center"
cellpadding="0" cellspacing="0" style="display:none">
<tr>
<td width="61%" align="right">
第${pageNo}页 | 共${count}条 | 共${totalPages}页 | <a href="#" onclick="findByEgS()">首页</a> | <a href="#" onclick="findByEgQ()">上一页</a> | <a href="#" onclick="findByEgH()">下一页</a> | <a href="#" onclick="findByEgM()">末页</a>
</td>
</tr>
<tr>
<td height="1" colspan="4" bgcolor="#666666"></td>
</tr>
</table>
<h:inputHidden id="flag" value="${flag}"></h:inputHidden>
</td>
</tr>
</table>
</form>
</body>
<script type="text/javascript">
if(document.getElementById("flag").value==‘true‘){
show.style.display=‘none‘;
page.style.display=‘‘;
}
</script>
</html>
以上是关于form表单发送请求实例的主要内容,如果未能解决你的问题,请参考以下文章