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中数据库的使用时,遇到一个很奇怪的情况(至少现在看来是的)。jsp中连接mysql数据库,开启mysql数据库后,在jsp页面中嵌入的java连接mysql数据库的那几句代码。好像 Class.forName("org.gjt.mm.mysql.Driver");没起到作用,只需要Connection con=DriverManager.getConnection("jdbc:mysql://localhost/test? ......
其实就是创建普通文件, CreateFile() 和WriteFile. 然后用ShellExcuteEx()来打开就行了(会自动调用IE).
HANDLE handle;
handle=CreateFile(L"\\windows\\google.html",GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
if(INVALID_HANDLE_VALUE!= handle )
{
DWORD Num;
::WriteF ......
学无止境!!!
今天在论坛回答帖子,学到了一招,select原来可以使用optgroup 标签,对option进行分类!
特意从网上摘录了下面的文章...
在 html里,optgroup这个元素对于我来说很少用到。最近在公司做项目时使用了一下,感觉不错,可以对数据进行分类。但在使用JavaScript 添加optgroup时,在IE与Fire ......
当输入 》时自动补全 当输入《/时自动补全
“=================================
" File: closetag.vim
" Summary: Functions and mappings to close open HTML/XML tags
" Uses: <C-_> -- close matching open tag
" Author: Steven Mueller <di ......
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
Go
----截取字符串,并出去html
create FUNCTION [dbo].[CutString] (@str varchar(1000),@length int)
RETURNS varchar(1000) AS
BEGIN
declare @mainstr varchar(1000)
declare @substr varchar(1000)
if(@str is not null or @st ......