<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
<script>
var i = 100;
function gogo(){
window.location = "servlet.jsp?a="+search.value+"&b=2&c=3";
}
</script>
</head>
<body>
<!--1.表单提交 (html调用html)
<form action="servlet.jsp" method="get">
帐号:<input type="text" name="userid" /><br />
密码:<input type="password" name="userpwd"/><br/>
<input type="submit" value="登录"/>
</form>
-->
<%
int id = 1;//假设是从数据库中查询出来的这个id
%>
<!-- 2.链接提交:客户端放服务器变量用EL表达式,HTML传java的值 (html调用java)-->
<a href="servlet.jsp?a=1&b=2&c=3">走,去一个JSP页面</a><br/>
<a href="servlet.jsp?a=<%=id %>&b=2&c=3">走,去一个JSP页面2</a>
<!--3.javascript传值 ,客户端传客户端的值,js传html的值 (js调用html)-->
<input type="text" name="search"/>
<input type="button" value="百度一下" οnclick="gogo()"/>
<!--html调用js ctrl+shift+c -->
<!-- <input type="text" value=""/> -->
<!-- <script>document.write(i)</script> -->
<!-- js调用js -->
<script>
//var j = 100;
//window.location = "servlet.jsp?a="+j;
</script>
<!-- js调用java -->
<script>
//window.location = "servlet.jsp?a = <%=id%>";
</script>
<!-- java调用java -->
<%
//String name = "服务器变量值";//数据共享?
//response.sendRedirect("servlet.jsp?name="+name);
%>
<!-- java调用js -->
<%
//out.println("<script>alert('我是服务器');</script>");//类似于document.write("")
//out.println("<script>window.location='servlet.jsp?a=1'</script>");
%>
<!-- java调用html -->
<%
//out.print("<img src='content.jpg'/>");
%>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>My JSP 'index.jsp' starting page</title>
<script>
var i = 100;
function gogo(){
window.location = "servlet.jsp?a="+search.value+"&b=2&c=3";
}
</script>
</head>
<body>
<!--1.表单提交 (html调用html)
<form action="servlet.jsp" method="get">
帐号:<input type="text" name="userid" /><br />
密码:<input type="password" name="userpwd"/><br/>
<input type="submit" value="登录"/>
</form>
-->
<%
int id = 1;//假设是从数据库中查询出来的这个id
%>
<!-- 2.链接提交:客户端放服务器变量用EL表达式,HTML传java的值 (html调用java)-->
<a href="servlet.jsp?a=1&b=2&c=3">走,去一个JSP页面</a><br/>
<a href="servlet.jsp?a=<%=id %>&b=2&c=3">走,去一个JSP页面2</a>
<!--3.javascript传值 ,客户端传客户端的值,js传html的值 (js调用html)-->
<input type="text" name="search"/>
<input type="button" value="百度一下" οnclick="gogo()"/>
<!--html调用js ctrl+shift+c -->
<!-- <input type="text" value=""/> -->
<!-- <script>document.write(i)</script> -->
<!-- js调用js -->
<script>
//var j = 100;
//window.location = "servlet.jsp?a="+j;
</script>
<!-- js调用java -->
<script>
//window.location = "servlet.jsp?a = <%=id%>";
</script>
<!-- java调用java -->
<%
//String name = "服务器变量值";//数据共享?
//response.sendRedirect("servlet.jsp?name="+name);
%>
<!-- java调用js -->
<%
//out.println("<script>alert('我是服务器');</script>");//类似于document.write("")
//out.println("<script>window.location='servlet.jsp?a=1'</script>");
%>
<!-- java调用html -->
<%
//out.print("<img src='content.jpg'/>");
%>
</body>
</html>