jspä¸å®ç°ä¸¤ä¸ªé¡µé¢ä¹é´çä¼ å¼æ¹æ³å¦ä¸ï¼
举ä¾è¯´æï¼
建ç«ä¸¤ä¸ªJSP页é¢ä¼ å¼,tes1.jspåtest2.jspã代ç å¦ä¸ï¼
<%@pagelanguage="java"import="java.util.*"pageEncoding="GBK"%>
<%
Stringpath=request.getContextPath();
StringbasePath=request.getScheme()+"://"+request.getServerName()
+":"+request.getServerPort()+path+"/";
%>
>
<html>
<head>
<basehrefbasehref="<%=basePath%>">
<title>MyJSP'test1.jsp'startingpagetitle>
<metahttp-equivmetahttp-equiv="pragma"content="no-cache">
<metahttp-equivmetahttp-equiv="cache-control"content="no-cache">
<metahttp-equivmetahttp-equiv="expires"content="0">
<metahttp-equivmetahttp-equiv="keywords"content="keyword1,keyword2,keyword3">
<metahttp-equivmetahttp-equiv="description"content="Thisismypage">
<metahttp_equivmetahttp_equiv="refresh"content="5">
<scriptlanguagescriptlanguage="javascript"type="text/javascript">
functionexecute(){
varobj=document.getElementById("name");
document.form1.action="alipay/test2.jsp?param="+obj.value;
document.form1.submit();
}
script>
head>
<bodyonloadbodyonload="execute();">
<formnameformname="form1"method="post">
<table>
<tr>
<td>
æµè¯JSP页é¢ä¼ å¼<inputtypeinputtype="text"id="username"value="luodada">
</td>
</tr>
</table>
</form>
body>
html>
tset2.jspç代ç å¦ä¸ï¼
<%@pagelanguage="java"import="java.util.*"pageEncoding="GBK"%>
<%
Stringpath=request.getContextPath();
StringbasePath=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
>
<html>
<head>
<basehrefbasehref="<%=basePath%>">
<title>MyJSP'test2.jsp'startingpagetitle>
<metahttp-equivmetahttp-equiv="pragma"content="no-cache">
<metahttp-equivmetahttp-equiv="cache-control"content="no-cache">
<metahttp-equivmetahttp-equiv="expires"content="0">
<metahttp-equivmetahttp-equiv="keywords"content="keyword1,keyword2,keyword3">
<metahttp-equivmetahttp-equiv="description"content="Thisismypage">
head>
<body>
<%
Stringvalue=request.getParameter("param");
out.print("ä»test1.jspä¼ éè¿æ¥çå¼æ¯"+value);
%>
body>
html>
å
·ä½æè·¯å¦ä¸ï¼
å¨JSP页é¢ä¼ å¼test1.jspä¸ï¼éè¿JavaScriptæææ¬æ¡ä¸çå¼è·ååºæ¥ï¼ï¼ä½¿test1.jspå¨å è½½è¿æ¥çæ¶å马ä¸æ§è¡é¡µé¢è·³è½¬ï¼
å¨JSP页é¢ä¼ å¼test2.jspä¸éè¿request.getParameter("åæ°å称");æ¥è·åtest1.jspä¼ éè¿æ¥çå¼å³å¯ã
温馨提示:内容为网友见解,仅供参考