jsp中的搜索條件回顯

今天下午在公司改完bug,經理說,你的搜索條件在提交後,不要clean,於是弄了半天才弄出來,大笑
<%@ 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>


<%
String a=request.getParameter("hehe");
request.setAttribute("temp", a);
%>


<form method="get" action="">
搜索條件:<input type="text" name="hehe" id="hehe"  value="<%=request.getAttribute("temp")==null?"":request.getAttribute("temp") %>"/>
<input type="submit" value="搜素">
</form>



</body>
</html>
方法二、用於此種情況下還可以用ajax技術完成此種情形的功能
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章