different between<A Href> and <jsp: forward>
i want to access Servelt by hyperlink in a jsp web site connection.jsp
<%@ page contentType="text/html;charset=GB2312" %>
<HTML>
<BODY bgcolor=cyan><Font size=1>
<A Href="/myjsp/Hello" >Accessing servlet<A>
</BODY>
</HTML
i put the bean in the dir(/myjsp/WEB-INF/classes/hello(package)/Hello) and modify the file web.xml like this:
><servlet>
<servlet-name>Hello</servlet-name>
<servlet-class>hello.Hello</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Hello</servlet-name>
<url-pattern>/Hello</url-pattern>
</servlet-mapping>
it works! but if i use <jsp:forward>
<html>
<body bgcolor="green" > <jsp:forward page="/myjsp/Hello" />
<body>
</html>
it causes an Exception The requested resource (/myjsp/myjsp/SimpleServlet) is not available.
but if you rewrite the path like this <jasp:forward page="/Hello"/> it will be ok. why? in my opinion, if you use <A Href=..> the default path is http://localhost:8080 so you need the rest path is /myjsp/Hello. but if you use <jsp:forward> the default path is http://localhost:8080/myjsp/,so you just need write the rest part"/Hello". i don't know my explaination is right or not. but i think this is a try.
different between<A Href> and <jsp: forward>的更多相关文章
- jsp - forward指令
forward指令 既可以指向静态的html页面,也可以转发到动态的jsp页面,并可以保留先前请求的参数. 例如,在web中新建一个Jsp_src.jsp的jsp页面: <%@ page lan ...
- jsp:forward动作功能
jsp:forward动作:引导请求者进入新的页面 例子:login.jsp <center><p>用户登录 </p> <form name="fo ...
- jsp forward跟redirect区别
forward 相当于php的 require/include 属于服务器包含/跳转 request.getRequestDispatcher("result.jsp").forw ...
- jsp:forward response.sendRedirect
jsp中<jsp:forward page=""/>和response.sendRedirect("")两种跳转的区别 一.response.sen ...
- Struts2中<jsp:forward page="xxx.action"></jsp:forward>失效
问题:在Struts2中<jsp:forward page="xxx.action"></jsp:forward>失效了,不但调转不过去还报404错误.不知 ...
- jsp forward 动作标签
forward 动作标签: <jsp:forward page="要转向的页面"> </jsp:forward> 或 <jsp:forward pag ...
- jsp:forward与缓冲区
jsp:forward的作用是在服务器端进行页面跳转.通常有<jsp:forward page="NewPage.jsp">语句的页面的在执行时会提前执行跳转,而不输出 ...
- Struts2.x jsp页面无法使用jsp:forward跳转到action
问题:使用<jsp:forward page="test"></jsp:forward>语句无法跳转到test所对应的action. 解决办法:在web.x ...
- <jsp:forward>、requestDispatcher和sendRedirect()的区别
1.会话信息保存在服务器内存上,可以断续访问,和cookie相比,其保存在服务器上. 2.男人就像蓝牙:只有在你接近时,他才会找上你.当你离开后,他便又去找其他的"设备"了.女人就 ...
随机推荐
- c#中不同类中变量的引用方法
(1)如果两个类没有继承关系,存取另一个类中变量的方法如下: public class A { // 注意: // Count是静态变量(static),称为类变量.类变量无需实例化即可使用 publ ...
- 抽象方法为什么不能被private与static修饰
private private访问修饰符修饰的方法只能在本类当中使用.所以,必然不能用private去修饰抽象方法.抽象方法一定是要被子类去重写的. static Java中用static修饰符修饰的 ...
- nodejs 之 nvm和pm2
说道 node不得不提到nodejs的版本管理nvm和Node应用的进程管理器pm2. 当然,关于这两个的介绍的文章那么多,随意baidu,bing,google就可以. 我这里是给自己打一个标签,方 ...
- 最新版solr7.2集群搭建详细步骤
集群:高可用,备份,数据可分片 需要运行4个tomcat 1.tomcat端口号(默认占用8005,8009,8080三个端口) tomcat服务 占用端口 tomcat1 6005.6060.600 ...
- C#串口发送数据
使用指定的端口名.波特率.奇偶校验位.数据位和停止位初始化 SerialPort 类的新实例 SerialPort serialPort = new SerialPort("COM3&quo ...
- 自学Aruba3.1-Aruba配置架构
点击返回:自学Aruba之路 自学Aruba3.1-Aruba配置架构 WLAN配置架构 1. AP group : Aruba无线控制器通过AP Group来构建无线网络配置参数模版.并通过 ...
- [转载]MySQL UUID() 函数
目录 目录 一 引子 二 MySQL UUID() 函数 三 复制中的 UUID()四 UUID_SHORT() 函数 3.1 实验环境介绍 3.2 搭建复制环境 3.3 基于 STATEMENT 模 ...
- LevelDB的源码阅读(三) Put操作
在Linux上leveldb的安装和使用中我们写了这么一段测试代码,内容以及输出结果如下: #include <iostream> #include <string> #inc ...
- Android权限管理知识学习记录
一.Android权限背景知识 在Android 6.0之前,所申请的权限只需要在AndroidManifest.xml列举就可以了,从而容易导致一些安全隐患,因此,在Android 6.0时,Goo ...
- JavaScript基础知识(正则表达式、字符串)
23.正则表达式 作用:定义一个特定的验证字符串内容规则的表达式 注:正则表达式并不是JavaScript独有的:JavaScript支持正则表达式 var a = { }; // 定义一个空对象 ...