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.
分享到:
相关推荐
<br>Interactive animation: Sliders<br>Control the motion of a beetle using sliders.<br> <br>Basics: Radians and degrees<br>Compare the difference between radians and degrees.<br> <br>Basics: Movie ...
Input/Output Using Stream Classes<br/><br/>13.1 Common Background of I/O Streams<br/><br/>13.2 Fundamental Stream Classes and Objects<br/><br/>13.3 Standard Stream Operators << and >><br/><br/>13.4 ...
as shown by the experts.<br><br>Understand how to work through the different implementation phases of a Cisco IP telephony solution<br>Plan your implementation with tools and guides from the most ...
Scripts: DIHtmlParser returns the contents between the <SCRIPT> and </SCRIPT> tags as simple text. The surrounding HTML tags are reported separately. Styles: DIHtmlParser returns the contents between ...
You can also create your own policy files that define arbitrary permission sets.<br/><br/>Comparison of the sample security policy file <br/><br/> <br/>Permissions/Resource Setting Admin Default ...
2000 by CRC Press LLC<br><br> <br> <br>5.1.1 Coding an Information Source<br>5.1.2 Some Desired Characteristics<br>5.1.3 Discrete Memoryless Sources<br>5.1.4 Extensions of a Discrete Memoryless Source...
The directory verify/ contains<br>a small set of verification pictures, a small bitstream, and Unix <br>shell script to automatically test the output of the encoder and decoder.<br><br>A precompiled ...
Some Final Comments on the MOV Instructions<br><br>4.9 Laboratory ...and CodeView'<br>4.9.5.1 A Quick Look at CodeView<br>4.9.5.2 The Source Window<br>4.9.5.3 The Memory Window<br>4.9.5.4 The Register ...
- `<ESC>A`: Starts a new label. - `<ESC>~A`: Cuts the current label. - `<ESC>~a`: Cuts the current job. - `<ESC>~B`: Cuts the last label. - `<ESC>AO`: Enables auto-online mode. - `<ESC>A1`: Sets...
Version Global Assemblies<br><br>Attributes<br>Compile/Link and Load into GAC<br>Same Name but Different Versions<br>Correct Version Required<br><br>11. Appendix<br><br>Commandfile to Build Sample ...
Version Global Assemblies <br><br>Attributes<br>Compile/Link and Load into GAC<br>Same Name but Different Versions<br>Correct Version Required <br><br>11. Appendix <br><br>Commandfile to Build Sample...
November 19, 2007<br> The size of the release is: 03 disks x 2.88mb<br> And released on: 12/22/2007<br><br>===================================================<br> LINQ is the project name for a set ...
40.zip<br>Getting rid of Window List from MDI applications<br>在MDI应用中去掉窗口列表(5KB)<END><br>41,41.zip<br>Save and Restore<br>存储和恢复(7KB)<END><br>42,42.zip<br>A Quick Start<br>使用微软本地化...
you should be familiar a bit with manual unpacking first (some tutorials are easy to find on internet).<br><br>Features:<br><br>- Imports<br>- An original tree view<br>- 2 different methods to find ...
and will provide Up and/or Dn graphics to enable navigation between the menu sections.<END><br>40 , CoolExplorer2.zip<br>The new and improved Cool Explorer: Many new functions.<END><br>41,...
1,01.zip<br>3D Text<br>显示3D文字(6KB)<END><br>2,02.zip<br>A button within a button<br>按纽中的按纽(13KB)<END><br>3,03.zip<br>Flat Owner Drawn Buttons<br>浮动的自画按纽(13KB)<END><br>4,04.zip<br>Flat-...
27.zip<br>Simple way to change dialog's background and text colors<br>改变对话框背景颜色和文字颜色的简单途径(11KB)<END><br>28,28.zip<br>A Simple Dialog Layout Manager<br>一个简单的对话框设计管理器(19...
Sync.zip<br>Synchronizing worker threads using 3 different methods(61KB)<END><br>56,PStat_src.zip<br>A Freeware generalized framework for executing a lengthy operation in a thread.(20KB)<END><br>57,...