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>的更多相关文章

  1. jsp - forward指令

    forward指令 既可以指向静态的html页面,也可以转发到动态的jsp页面,并可以保留先前请求的参数. 例如,在web中新建一个Jsp_src.jsp的jsp页面: <%@ page lan ...

  2. jsp:forward动作功能

    jsp:forward动作:引导请求者进入新的页面 例子:login.jsp <center><p>用户登录 </p> <form name="fo ...

  3. jsp forward跟redirect区别

    forward 相当于php的 require/include 属于服务器包含/跳转 request.getRequestDispatcher("result.jsp").forw ...

  4. jsp:forward response.sendRedirect

    jsp中<jsp:forward page=""/>和response.sendRedirect("")两种跳转的区别 一.response.sen ...

  5. Struts2中<jsp:forward page="xxx.action"></jsp:forward>失效

    问题:在Struts2中<jsp:forward page="xxx.action"></jsp:forward>失效了,不但调转不过去还报404错误.不知 ...

  6. jsp forward 动作标签

    forward 动作标签: <jsp:forward page="要转向的页面"> </jsp:forward> 或 <jsp:forward pag ...

  7. jsp:forward与缓冲区

    jsp:forward的作用是在服务器端进行页面跳转.通常有<jsp:forward page="NewPage.jsp">语句的页面的在执行时会提前执行跳转,而不输出 ...

  8. Struts2.x jsp页面无法使用jsp:forward跳转到action

    问题:使用<jsp:forward page="test"></jsp:forward>语句无法跳转到test所对应的action. 解决办法:在web.x ...

  9. <jsp:forward>、requestDispatcher和sendRedirect()的区别

    1.会话信息保存在服务器内存上,可以断续访问,和cookie相比,其保存在服务器上. 2.男人就像蓝牙:只有在你接近时,他才会找上你.当你离开后,他便又去找其他的"设备"了.女人就 ...

随机推荐

  1. windows c++ 错误汇总

    1.fatal error C1900 错误:fatal error C1900: “P1”(第“20081201”版)和“P2”(第“20080116”版)之间 Il 不匹配 检查之后发现jepgl ...

  2. js基础查漏补缺(更新)

    js基础查漏补缺: 1. NaN != NaN: 复制数组可以用slice: 数组的sort.reverse等方法都会改变自身: Map是一组键值对的结构,Set是key的集合: Array.Map. ...

  3. Python day 7(1) 模块

    一:模块 1 在Python中,一个.py文件就称之为一个模块(Module) 2 Python的好处,优点: a  提高了代码的可维护性 b  当一个模块编写完毕,就可以被其他地方引用.我们在编写程 ...

  4. AutoMapper 使用总结

    初识AutoMapper 在开始本篇文章之前,先来思考一个问题:一个项目分多层架构,如显示层.业务逻辑层.服务层.数据访问层.层与层访问需要数据载体,也就是类.如果多层通用一个类,一则会暴露出每层的字 ...

  5. File API文件操作之FileReader

    近来研究点对点的文件传输,想到一种方案FileReader+WebRtc. 当我看到FileReader的时候,哎呀,不错的东西啊,仔细一看属于File API,或者叫做Web API. File A ...

  6. checkbox对齐-复选框图标

    checkbox对齐-复选框图标 一般开发过程中,我们直接使用<input type="checkbox"/>这样出现的复选框,设计师一般都说不好看 而让我们按照设计稿 ...

  7. linux下centos6.8相关配置,以及音频相关配置

    一:安装上传下载命令 1:cd /tmp 2:wget http://www.ohse.de/uwe/releases/lrzsz-0.12.20.tar.gz 3:tar zxvf lrzsz-0. ...

  8. iOS 应用全部添加滑动返回

    if ([self  class] == [HomeViewController class]||[self  class] == [ComprehensivefinanceViewControlle ...

  9. 如何转换MySQL表的引擎

    有很多种方法可以将表的存储引擎转换成另一种引擎.每种方法都有其优缺点,在这里介绍四种方法: 选择优先级(pt-online-schema-change > 创建与查询 > 导出和导入 &g ...

  10. ogg-oracle to sqlserver

    环境: source:  54     Centos7  oracle12.2           ogg12.3 target  :    52 Windows sqlserver2012      ...