澳门新葡亰网址下载一个jsp的下载实例

by admin on 2020年1月31日

Servlet 代码:

网上的 Jquery ajax Demo 大多都是基于php
很少 有java的 今天就把自己的Demo贴出来 和大家共同学习

新建web project:struts2_0500_actionwildcard

String filenamedownloa = request.getParameter(“url”);
  String filenamedownload = new
String(filenamedownloa.getBytes(“iso8859-1″),”gbk”);
  response.setContentType(“application/x-download”);//
设置为下载application/x-download
  String filenamedisplay = filenamedownload.substring(0,
filenamedownload.length());
  filenamedisplay = URLEncoder.encode(filenamedisplay, “utf-8”);
  response.addHeader(“Content-Disposition”,”attachment;filename=”+filenamedisplay);

先用html写个例子:myajax.html

Build Path

  try {
   RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher(filenamedownload);
   if (dispatcher != null) {
    dispatcher.forward(request,response);
   }
   response.flushBuffer();
  } catch (Exception e) {
   e.printStackTrace();
  }

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“”>
<html xmlns=””>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gbk”
/>
<title>ajax_load.html</title>
</head>
<body>
<h2 style=”color:#FF0000″>我是李云,Jquery很好用!</h2>
</body>
</html>

项目图:

htm代码:

执行ajax的页面:useAjax.html

  src:                  

<html>
 <head>
  <title>Testfiledownload.html</title>

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“”>
<html xmlns=””>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gbk”
/>
  <meta name=”Author” content=””>
  <meta name=”Keywords” content=””>
  <meta name=”Description” content=””>
  <script  type=”text/javascript” src=”jquery-142min.js”
></script>
 </head>
 <script language=”javascript”>
    $(function(){
   $.ajax({
  url:”myajax.html”,
  async:false,
  success:function(data)
  {
           //alert(data);
     $(“p”).html(data);
  }
   });
 });
</script>
 <body>
    <p></p>
 </body>
</html>

    StudentAction.java

  <meta http-equiv=”keywords”
content=”keyword1,keyword2,keyword3″>
  <meta http-equiv=”description” content=”this is my page”>
  <meta http-equiv=”content-type” content=”text/html;
charset=gbk”>
 </head>

$.get()方法实现

    TeacherAction.java

 <body>
  <a
href=”servlet/DownloadFileServlet?url=/temp2/1.doc”>filedownload</a>
 </body>
</html>

<script type=”text/javascript”>
    $(function(){
    $.get(“myajax.html”,function(data){
   $(“p”).html(data);
  });
 });
</script>

    struts.xml

 

$.post()方法实现

  WebRoot:

 <script type=”text/javascript”>
    $(function(){
    $.post(“myajax.html”,function(data){
   $(“p”).html(data);
  });
 });
</script>
现在就  Jquery ajax 的 $.ajax(),$.post(),$.get();

    index.jsp

首先是  服务端的Servlet 演示这三个函数的用法对都是用的同一个 服务端
Java代码 
package com.june.servlet;  
 
import javax.servlet.http.HttpServlet;  
import javax.servlet.http.HttpServletResponse;  
import javax.servlet.http.HttpServletRequest;  
import java.io.IOException;  
import java.io.PrintWriter;  
import javax.servlet.ServletException;  
 
public class jqueryAjaxServer extends HttpServlet {  
     public jqueryAjaxServer(){  
         super();  
     }  
     public void doGet(HttpServletRequest request,HttpServletResponse
response)  
     throws IOException ,ServletException {  
         response.setContentType(“text/html;charset=utf-8”);  
         PrintWriter out=response.getWriter();  
         String account=request.getParameter(“account”);  
         if(“iamcrzay”.equals(account)){  
             out.print(“Sorry,the user is exist”);  
         }  
         else{  
             out.print(“Congratulation,this accont you can
use!!!!”);  
         }  
         out.close();  
     }  
     public void doPost(HttpServletRequest request,HttpServletResponse
response)  
     throws IOException ,ServletException {  
         this.doGet(request, response);  
     }  

    Student_add.jsp

package com.june.servlet;

    Student_delete.jsp

import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;

    Student_edit.jsp

public class jqueryAjaxServer extends HttpServlet {
     public jqueryAjaxServer(){
      super();
     }
     public void doGet(HttpServletRequest request,HttpServletResponse
response)
     throws IOException ,ServletException {
      response.setContentType(“text/html;charset=utf-8”);
      PrintWriter out=response.getWriter();
      String account=request.getParameter(“account”);
      if(“iamcrzay”.equals(account)){
       out.print(“Sorry,the user is exist”);
      }
      else{
       out.print(“Congratulation,this accont you can use!!!!”);
      }
      out.close();
     }
     public void doPost(HttpServletRequest request,HttpServletResponse
response)
     throws IOException ,ServletException {
      this.doGet(request, response);
     }
}

    Student_find.jsp

 

    Teacher_add.jsp

下面是WEB.XML
Xml代码 
<?xml version=”1.0″ encoding=”UTF-8″?> 
<web-app version=”2.5″   
    xmlns=””   
    xmlns:xsi=””   
    xsi:schemaLocation=”   
    “> 
    <servlet> 
       <servlet-name>jqueryAjaxServer</servlet-name> 
      
<servlet-class>com.june.servlet.jqueryAjaxServer</servlet-class> 
    </servlet> 
        <servlet-mapping> 
       <servlet-name>jqueryAjaxServer</servlet-name> 
       <url-pattern>/jqueryAjax</url-pattern> 
    </servlet-mapping> 
  <welcome-file-list> 
    <welcome-file>index.jsp</welcome-file> 
  </welcome-file-list> 
</web-app> 

    Teacher_delete.jsp

<?xml version=”1.0″ encoding=”UTF-8″?>
<web-app version=”2.5″
 xmlns=””
 xmlns:xsi=””
 xsi:schemaLocation=”
 “>
 <servlet>
    <servlet-name>jqueryAjaxServer</servlet-name>
   
<servlet-class>com.june.servlet.jqueryAjaxServer</servlet-class>
 </servlet>
        <servlet-mapping>
    <servlet-name>jqueryAjaxServer</servlet-name>
    <url-pattern>/jqueryAjax</url-pattern>
 </servlet-mapping>
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>
</web-app>

 ————————————Hongten———————————

 

struts.xml

下面是Jsp页面
第一个是 jqueryAjax.jsp  本页使用的是$.ajax()
Html代码 
<%@ page language=”java”  pageEncoding=”utf-8″%> 
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”> 
<html> 
  <head>    
    <title>jquery ajax</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”> 
    <script src=”js/jquery-1.2.6.js”
type=”text/javascript”></script> 
    <script language=”javascript”> 
         $(function(){  
               $(‘.sumbit’).click(function(){  
               if($(‘#account’).val().length==0){  
                  
$(‘.hint’).text(“用户名不能位空”).css({“background-color”:”green”});   
               }  
               else{  
               $.ajax({  
                
url:’jqueryAjax’,  
                 data:{account:$(‘#account’).val()},  
                 error:function(){  
                 alert(“error occured!!!”);  
                 },  
                 success:function(data){  
                 
$(‘body’).append(“<div>”+data+”</div>”).css(“color”,”red”);  
        
                 }  
                   
               });}  
               });  
               });  
                   
         
             
    </script> 
  </head> 
    
  <body> 
                <h3 align=”center”>jquery AjaX</h3> 
                <hr> 
                <label>请输入用户名 :</label> 
                <input id=”account” name=”account” type=”text”> 
                <input class=”sumbit” type=”button”
value=”检测”> 
                <div class=”hint”> 
                </div> 
  </body> 
</html> 

代码:

<%@ page language=”java”  pageEncoding=”utf-8″%>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
  <head> 
    <title>jquery ajax</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”>
 <script src=”js/jquery-1.2.6.js”
type=”text/javascript”></script>
 <script language=”javascript”>
      $(function(){
            $(‘.sumbit’).click(function(){
            if($(‘#account’).val().length==0){
               
$(‘.hint’).text(“用户名不能位空”).css({“background-color”:”green”});
            }
            else{
            $.ajax({
             
url:’jqueryAjax’,
              data:{account:$(‘#account’).val()},
              error:function(){
              alert(“error occured!!!”);
              },
              success:function(data){
              
$(‘body’).append(“<div>”+data+”</div>”).css(“color”,”red”);
  
              }
             
            });}
            });
            });
                
   
       
 </script>
  </head>
 
  <body>
                <h3 align=”center”>jquery AjaX</h3>
                <hr>
                <label>请输入用户名 :</label>
                <input id=”account” name=”account” type=”text”>
                <input class=”sumbit” type=”button”
value=”检测”>
                <div class=”hint”>
                </div>
  </body>
</html>

<?xml version=”1.0″ encoding=”UTF-8″ ?>
<!DOCTYPE struts PUBLIC
    “-//Apache Software Foundation//DTD Struts Configuration 2.0//EN”
    “”>
<struts>
 <constant name=”struts.devMode” value=”true” />
 <package name=”Student” namespace=”/” extends=”struts-default”>
  <action name=”*_*” class=”com.b510.hongten.{1}Action”>
   <result>
    /{1}_{2}.jsp
            </result>
  </action>
  
  
  <action name=”Student_add”
class=”com.b510.hongten.StudentAction”
   method=”add”>
   <result>
    /Student_delete.jsp
            </result>
  </action>
 </package>
</struts>

 

 ————————————Hongten———————————

第二个用的是  $.post()

 ————————————Hongten———————————

Html代码 
<%@ page language=”java”  pageEncoding=”utf-8″%> 
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”> 
<html> 
  <head>    
    <title>jquery ajax</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”> 
    <script src=”js/jquery-1.2.6.js”
type=”text/javascript”></script> 
    <script language=”javascript”> 
         $(function(){  
             $(‘.sumbit’).click(  
              function(){  
                if($(‘#account’).val().length==0){  
                    $(‘.hint’).text(“The account is cant’t be
null”).css({“color”:”red”,”background-color”:”yellow”});  
                }  
                else{  
               
$.post(“jqueryAjax”,”account=”+$(‘#account’).val(),function(data){  
                  
$(‘.hint’).text(data).css({“color”:”red”,”background-color”:”yellow”});  
                })  
                }  
             });  
         });             
    </script> 
  </head> 
    
  <body> 
                <h3 align=”center”>jquery Ajax</h3> 
                <hr> 
                <label>请输入用户名 :</label> 
                <input id=”account” name=”account” type=”text”> 
                <input class=”sumbit” type=”button”
value=”检测”> 
                <div class=”hint”> 
                </div> 
  </body> 
</html> 

在这里,我们没有去添加Teacher_edit.jsp和Teacher_find.jsp,要想说明的是,如果我们要添加的时候

<%@ page language=”java”  pageEncoding=”utf-8″%>
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
  <head> 
    <title>jquery ajax</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”>
 <script src=”js/jquery-1.2.6.js”
type=”text/javascript”></script>
 <script language=”javascript”>
      $(function(){
          $(‘.sumbit’).click(
           function(){
             if($(‘#account’).val().length==0){
                 $(‘.hint’).text(“The account is cant’t be
null”).css({“color”:”red”,”background-color”:”yellow”});
             }
             else{
            
$.post(“jqueryAjax”,”account=”+$(‘#account’).val(),function(data){
               
$(‘.hint’).text(data).css({“color”:”red”,”background-color”:”yellow”});
             })
             }
          });
      });       
 </script>
  </head>
 
  <body>
                <h3 align=”center”>jquery Ajax</h3>
                <hr>
                <label>请输入用户名 :</label>
                <input id=”account” name=”account” type=”text”>
                <input class=”sumbit” type=”button”
value=”检测”>
                <div class=”hint”>
                </div>
  </body>
</html>

直接添加即可,不会因为我们又添加了新的的文件,而影响整个程序的运行。但是添加的时候

 

一定要遵守”约定优于配置”的原则。如:Teacher的首字母一定要大写,Teacher_edit.jsp就得一定要以

第三个是用的$.get()

这种形式去写。不然我们还是免不了去修改配置文件;

Html代码 
<%@ page  pageEncoding=”utf-8″%> 
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”> 
<html> 
  <head>     
    <title>jquery get</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”> 
    <script src=”js/jquery-1.2.6.js”
type=”text/javascript”></script> 
    <script type=”text/javascript”> 
         $(function(){  
                $(‘.sumbit’).click(function(){  
                      if($(‘#account’).val().length==0){  
                        
$(‘.hint’).html(“用户名不能位空!!!”).css({“color”:”#ffoo11″,”background”:”blue”});  
                      }  
                      else{  
                         
$.get(“jqueryAjax”,”account=”+$(‘#account’).val(),  
                               function(data){  
                               
$(‘.hint’).html(data).css({“color”:”#ffoo11″,”background”:”green”});  
                          });  
                      }  
                });  
         });  
    </script> 
 
  </head> 
    
  <body> 
        <h3 align=”center”>jquery AjaX</h3> 
                <hr> 
                <label>请输入用户名 :</label> 
                <input id=”account” name=”account” type=”text”> 
                <input class=”sumbit” type=”button”
value=”检测”> 
                <div class=”hint”> 
                </div> 
  </body> 
</html> 

还有一个就是,我们看到struts.xml文件中有两个action,其实这里只是为了做一个小测试二用的:

 

我们的程序中只用:

$(
    function(){
        // Get a reference to the content div (into which we will load content).
        var jContent = $( "#content" );

        // Hook up link click events to load content.
        $( "a" ).click(
            function( objEvent ){
                var jLink = $( this );

                // Clear status list.
                $( "#ajax-status" ).empty();

                // Launch AJAX request.
                $.ajax(
                    {
                        // The link we are accessing.
                        url: jLink.attr( "href" ),

                        // The type of request.
                        type: "get",

                        // The type of data that is getting returned.
                        dataType: "html",

                        error: function(){
                            ShowStatus( "AJAX - error()" );

                            // Load the content in to the page.
                            jContent.html( "<p>Page Not Found!!</p>" );
                        },

                        beforeSend: function(){
                            ShowStatus( "AJAX - beforeSend()" );
                        },

                        complete: function(){
                            ShowStatus( "AJAX - complete()" );
                        },

                        success: function( strData ){
                            ShowStatus( "AJAX - success()" );

                            // Load the content in to the page.
                            jContent.html( strData );
                        }
                    }                           
                    );

                // Prevent default click.
                return( false );                    
            }
            );

    }
    );

  <action name=”*_*” class=”com.b510.hongten.{1}Action”>
   <result>/{1}_{2}.jsp</result>
    </action>

就足可以使我们的程序很好的运行起来,但是添加了第二个action后:

  <action name=”Student_add”
class=”com.b510.hongten.StudentAction”
   method=”add”>
   <result>/Student_delete.jsp</result>
   </action>

这时候就会出现我们访问一个url:

的时候,是去的是:Student_delete.jsp
这个页面,而不是我们的Student_add.jsp页面,这是为什么呢?

原因是:在struts2中,当我们访问的url来到的时候,服务器就会在struts.xml文件中找最接近这个url的action(如果

是同一个包中),我们很容易发现:

  ”*_*”和”Student_add”
和url相比较,显然是后者要接近,所以选择了Student_delete.jsp,而非Student_add.jsp
 

 ————————————Hongten——————————— 

 ————————————Hongten———————————

StudentAction.java

代码:

package com.b510.hongten;

import com.opensymphony.xwork2.ActionSupport;

/**
 *
 * @author XHW
 *
 * @date 2011-7-30
 *
 */
public class StudentAction extends ActionSupport {
 private static final long serialVersionUID = -5023520095036169842L;

 public String add() {
  return SUCCESS;
 }

 public String delete() {
  return SUCCESS;
 }

 public String edit() {
  return SUCCESS;
 }

 public String find() {
  return SUCCESS;
 }
}

 ————————————Hongten———————————

TeacherAction.java

代码;

package com.b510.hongten;

import com.opensymphony.xwork2.ActionSupport;

/**
 *
 * @author XHW
 *
 * @date 2011-7-30
 *
 */
public class TeacherAction extends ActionSupport {
 private static final long serialVersionUID = -5023520095036169843L;

 public String add() {
  return SUCCESS;
 }

 public String delete() {
  return SUCCESS;
 }

 public String edit() {
  return SUCCESS;
 }

 public String find() {
  return SUCCESS;
 }
}

 ————————————Hongten———————————


 index.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 ‘index.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>
    My JSP ‘index.jsp’ starting page<br>
    <a href=”<%=basePath
%>Student_add”>增加学生</a>
    <a href=”<%=basePath
%>Student_delete”>删除学生</a><br>
    <a href=”<%=basePath
%>Student_edit”>编辑学生</a>
    <a href=”<%=basePath
%>Student_find”>查看学生</a><br>
    <a href=”<%=basePath
%>Teacher_add”>增加老师</a>
    <a href=”<%=basePath
%>Teacher_delete”>删除老师</a><br>
    <a href=”<%=basePath
%>Teacher_edit”>编辑老师</a>
    <a href=”<%=basePath
%>Teacher_find”>查看老师</a><br>
  </body>
</html>

 ————————————Hongten———————————

Student_add.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 ‘Student_add.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>
   My JSP ‘Student_add.jsp’ starting page <br>
   <a href=”<%=basePath%20%>index.jsp”>home</a>
  </body>
</html>

 ————————————Hongten———————————

Student_delete.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 ‘Student_delete.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>
    My JSP ‘Student_delete.jsp’ starting page <br>
   <a href=”<%=basePath%20%>index.jsp”>home</a>
  </body>
</html>

 ————————————Hongten———————————

Student_edit.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 ‘Student_edit.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>
    My JSP ‘Student_edit.jsp’ starting page <br>
    <a href=”<%=basePath%20%>index.jsp”>home</a>
  </body>
</html>

 ————————————Hongten———————————

Student_find.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 ‘Student_find.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>
    My JSP ‘Student_find.jsp’ starting page <br>
  <a href=”<%=basePath%20%>index.jsp”>home</a>
  </body>
</html>

 ————————————Hongten———————————

Teacher_add.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 ‘Teacher_add.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>
   My JSP ‘Teacher_add.jsp’ starting page<br>
   <a href=”<%=basePath%20%>index.jsp”>home</a>
  </body>
</html>

 

 ————————————Hongten———————————

Teacher_delete.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 ‘Teacher_delete.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>
   My JSP ‘Teacher_delete.jsp’ starting page <br>
  <a href=”<%=basePath%20%>index.jsp”>home</a>
  </body>
</html>

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图