jsp-簡單小程序(乘法表、)

乘法表

<%@ 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 '2.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">
	-->

  </head>
  
  <body>
    <%
    	out.print("<table style='width:450px;height:270px' border='1'");
    	for(int i=1;i<10;i++){
    		out.print("<tr>");
    		for(int j=1;j<=i;j++){
    			out.print("<td>");
    			out.print(j+"脳"+i+"="+i*j);
    			out.print("</td>");
    		}
    		out.print("</tr>");
    	}
    	out.print("</table>");
     %>
  </body>
</html>

wKiom1eE4pTCDuyVAABLQ9B7PYM524.png

發佈新聞

<%@ 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 'fabu.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 type="text/javascript">
	</script>
  </head>
  
    <frameset rows="20%,*">
    	<frame name="top" src="top.jsp"/>
    	<frameset cols="30%,*">
    		<frame name="left" src="main.jsp"/>
    		<frame name="down" src="welcome.jsp"/>	
    	</frameset>
    </frameset>
</html>
<%@ 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 'onetitle.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 type="text/javascript">
		function demo(){
			var b=true;
			var onetxt=document.getElementById("onetxt");
			var sonetxt=document.getElementById("sonetxt");
			var main1=parent.frames[1].document.getElementById("f1");
			if(onetxt.value.length==0){
				sonetxt.style.color="red";
				sonetxt.innerText="請輸入一級標題";
				b=false;
			}else{
				sonetxt.innerText="";
				main1.innerHTML="<font style='color:#00FF00' id='f1' onclick='demo1(this)'><u>一級標題發佈</u></font>";
				parent.frames[2].location.href="onesuccess.jsp";
			}
			return b;
		}
	</script>
  </head>
  
  <body>
  	<form action="onesuccess.jsp" method="post" submit=" return demo()">
    <center>
    	<h3>一級標題發佈</h3>
    	<br/><br/><br/><br/>
    	標題名:<input type="text" id="onetxt"><span id="sonetxt"></span>
    	<br/><br/>
    	<input type="submit" value="確定"/>&nbsp;
    	<input type="reset" value="重置"/>
    	<br/><br/><br/><br/><br/>
    	<b>注意:發佈前請認真檢查輸入的標題是否正確</b>
    </center>
    </form>
  </body>
</html>


<%@ 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 'twotitle.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 type="text/javascript">
function demo(){
var b=true;
var twotxt=document.getElementById("twotxt");
var stwotxt=document.getElementById("stwotxt");
var main2=parent.frames[1].document.getElementById("f2");
if(twotxt.value.length==0){
stwotxt.style.color="red";
stwotxt.innerText="請輸入二級標題";
b=false;
}else{
stwotxt.innerText="";
main2.innerHTML="<font style='color:#00FF00' id='f2' onclick='demo2(this)'><u>二級標題及文件位置發佈</u></font>";
parent.frames[2].location.href="twosuccess.jsp";
}
return b;
}
</script>
  </head>
  
  <body>
    <form action="twosuccess.jsp" method="post" submit=" return demo()">
    <center>
    <h3>二級標題及文件位置發佈</h3>
    <br/><br/><br/><br/>
    <table>
    <tr>
    <td>一級標題:</td>
    <td>
    <select id="one">
    <option>金融熱點</option>
    <option>娛樂熱點</option>
    <option>體育熱點</option>
    </select>
    </tr>
    <tr>
    <td>二級標題:</td>
    <td>
    <input type="text" id="twotxt"/><span id="stwotxt"></span>
    </td>
    </tr>
    <tr>
    <td>文件位置:</td>
    <td>
    <input type="file" value="瀏覽"/>
    </td>
    </tr>
    </table>
    <br/>
    <input type="submit" value="確定"/>
    <input type="reset" value="重置"/>
    <br/><br/>
    (二級標題最好與新聞稿件標題一致)
    <br/><br/><br/>
    <b>注意:發佈前請認真檢查輸入的標題是否正確</b>
   
    </center>
    </form>
  </body>
</html>


wKioL1eE4fzTfpI9AASToSYRa94740.png

wKioL1eE4iXjL3IEAAGyCYbHeFM424.png

wKiom1eE4vnAycpWAAHF9lW31i4976.png

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章