81,094
社区成员
发帖
与我相关
我的任务
分享
<tr>
<td width="100">用户名</td>
<td width="150"><input type="text" name="username" id="username" size="20"></td>
</tr>
<tr>
<td>密码</td>
<td><input type="password" name="password" id="password" size="21"></td>
</tr>
<tr>
<td>验证码</td>
<td><input type="text" id="Verification" name="Verification" value="" size="2"> <span id="VerCode"></span><iframe width=0 height=0 id="vc" name="vc" src=image.jsp></iframe></br><a href="" onclick="reload()">换一张</a></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value="登陆"><input type="reset" value="重置"></td>
</tr>
image页面:
<script language="JavaScript">
function reloadcode(){
parent.VerCode.innerHTML = "<input type=\"image\" src=\"VerficationServlet\" disabled>";
}
</script>
</head>
<body onload="reloadcode()">
</body>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
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>My JSP 'MyJsp.jsp' starting page</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">
-->
<script language="JavaScript">
function reload(){
vc.window.location.reload();
}
</script>
</head>
<body>
<table>
<tr>
<td>验证码</td>
<td><input type="text" id="Verification" name="Verification" value="" size="2"> <span id="VerCode"></span><iframe width=0 height=0 id="vc" name="vc" src=b.jsp></iframe></br><a href="" onclick="reload()">换一张</a></td>
</tr>
</table>
</body>
</html>
然后B.jsp:
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<%
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>My JSP 'image.jsp' starting page</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">
-->
<script language="JavaScript">
function reloadcode(){
parent.VerCode.innerHTML = "<input type=\"image\" src=\"VerficationServlet\" disabled>";
}
</script>
</head>
<body onload="reloadcode()">
</body>
</html>
你看下有什么问题吗?
<c:if test="${!empty(requestScope.path)}">
<script>
parent.document.getElementById("path").value="${requestScope.path}";
parent.document.getElementById("view").innerHTML="<img src=\"${pageContext.request.contextPath}/${requestScope.path}\" height='200 width='200'/> "
</script>
</c:if>
[code=text]
<tr>
<td>
图片
</td>
<td>
<iframe
src="${pageContext.request.contextPath }/upload.jsp?path=${requestScope.product.path}"
width="100%" height="25" marginheight="0" marginwidth="0"
scrolling="no" frameborder="0"></iframe>
</td>
</tr>
<tr>
<td>
浏览
</td>
<td id="view">
<c:if test="${empty(requestScope.product.path )}">
</c:if>
<c:if test="${!empty(requestScope.product.path)}">
<img
src="${pageContext.request.contextPath }/${requestScope.product.path}"
width="200" height="200" />
</c:if>
</td>
</tr>
[/code]