易截截图软件、单文件、免安装、纯绿色、仅160KB

Html/Jsp常用的页面跳转方法

第一种:
<script language="javascript" type="text/javascript">
    window.location.href="login.jsp?backurl="+window.location.href;
</script>
第二种:
<script language="javascript">
    alert("返回");
    window.history.back(-1); 
</script>
第三种: 
<script language="javascript">
    window.navigate("top.jsp"); 
</script>
第四种: 
<script language="JavaScript">
    self.location="top.htm"; 
</script>
第五种: 
<script language="javascript">
    alert("非法访问!");
    top.location="xx.jsp";
</script>
第六种: 
servlet实现跳转-->request.getRequestDispatcher("/WEB-INF/pages/error.jsp").forward(request,response);
第七种: 
由于以上的跳转都是webRoot下的,或者已知完整url地址的跳转.如果html或者jsp是存放在WEB-INF下的,在使用struts的情况下,可以通过配置struts的路径获得完整的url地址,不使用struts实现WEB-INF下的页面跳转...
/**
* @author Vicky
* @emial eclipser@163.com
*/
public class NavigateTo extends HttpServlet {
private static final long serialVersionUID = 1L;
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
String url = request.getParameter("url");
request.getRequestDispatcher(url).forward(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException,
IOException {
doGet(request, response);
}
}
web.xml配置:
  <servlet>
    <servlet-name>NavigateTo</servlet-name>
    <servlet-class>cn.vicky.servlet.NavigateTo</servlet-class>
  </servlet>
使用的页面:
<%
String path = request.getContextPath();
%>
<script type="text/javascript">
  function playGame()
  {
   window.


相关文档:

转载 jsp速成精要

Servlet三个要素:
1.必须继承自HttpServlet
2.必须实现doGet()或者doPost()
3.必须在web.xml中配置Servlet
<servlet>
<servlet-name> </servlet-name>
<servlet-class> </servlet-class>
</servlet>
<servlet-mapping>
<servlet-name> </servlet-nam ......

jsp标签用法

el表达式分类
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>  
 
分 类   功能分类   标签名称    
Core   表达式操作   out
set
remove
catch    
流程控制   if ......

jsp连接MySQL数据库 2

●jsp连接MySQL数据库
testmysql.jsp如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<html>
<body>
<%Class.forName("org.gjt.mm.mysql.Driver").newInstance();
String url ="jdbc:mysql://localhost/softforum?
user=soft&pas ......

HTML显示日期时间代码 [js 特效代码]

一种:
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>兼容FireFox的当前时间的JS脚本</title>
</head>
<body>
<DIV id=time>当前时间
<SCRIPT>document.getElementById('time').innerHTML=new Date().toLo ......

vim html xml 自动补全(在closetag.vim 上作了点修改)

当输入 》时自动补全 当输入《/时自动补全
“=================================
" File: closetag.vim
" Summary: Functions and mappings to close open HTML/XML tags
" Uses: <C-_> -- close matching open tag
" Author: Steven Mueller <di ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号