回 帖 发 新 帖 刷新版面

主题:为什么运行tomcat上自带的jsp可以执行,而我照书上写的就不执行?

求救!

回复列表 (共7个回复)

沙发

看你要运行什么样的JSP 了
比如用到javabean

板凳

谢谢您!

  《jsp应用开发详解〉上说把.jsp保存到\tomcat\webapps\目录下就可以,可是拷过去说:
xxx.jsp is invalible .
结果拷在\tomcat\webapps\root就可以,到底怎么回事啊?要是做项目也把所有的.jsp 都拷在\tomcat\webapps\root吗?

3 楼

在webapps文件夹里建一个project文件夹,把编好的页面文件例如example.jsp放进去,访问时,ie地址栏里写入../project/example.jsp就可以了

4 楼

用写字板打开Tomcat/conf/Server.xml文件,在最后一个</Context>和</Host>之间加入如下代码:
<Context path="/xxxx" docBase="d:/yyyy" debug="0" reloadable="true">
</Context>
即可,将文件存放在"d:/yyyy"目录下,在IE浏览器的地址栏中输入:
http://localHost:8080/xxxx/ffff.jsp
即可运行你的JSP程序,其中:"xxxx"是JSP的虚拟目录,你可以随意设置;"d:/yyyy"是你的JSP网页文件存放的任意目录,你也可以随意设置;"ffff.jsp"就更是你亲手编写的最令你得意的JSP网页程序了.

5 楼

不对呀?我用了可是出现这个问题
HTTP Status 404 - /jsp/index.jsp

--------------------------------------------------------------------------------

type Status report

message /jsp/index.jsp

description The requested resource (/jsp/index.jsp) is not available.


--------------------------------------------------------------------------------

Apache Tomcat/4.1.31



还有就是我第一次运行输入http://localhost:8080/index.jsp进去后按书上说按
JSP Examples

然后看到
JSP Samples
This is a collection of samples demonstrating the usage of different parts of the Java Server Pages (JSP) specification.

These examples will only work when these pages are being served by a servlet engine; of course, we recommend Tomcat. They will not work if you are viewing these pages via a "file://..." URL.

To navigate your way through the examples, the following icons will help:
   Execute the example
Look at the source code for the example
Return to this screen


Tip: For session scoped beans to work, the cookies must be enabled. This can be done using browser options.
  Numberguess  Execute Source
Date  Execute Source
Snoop Execute Source
ErrorPage  Execute Source
Carts  Execute Source
Checkbox  Execute Source
Color  Execute Source
Calendar  Execute Source
Include  Execute Source
Forward  Execute Source
Plugin  Execute Source
JSP-Servlet-JSP  Execute Source
Simple custom tag example Execute Source
Send mail example Execute Source
XML syntax example Execute Source

6 楼

我按了date 的连接
出现问题
HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 9 in the jsp file: /jsp/dates/date.jsp

Generated servlet error:
    [javac] Compiling 1 source file

E:\JSP工具\jakarta-tomcat-4.1.31\work\Standalone\localhost\examples\jsp\dates\date_jsp.java:43: package dates does not exist
      dates.JspCalendar clock = null;
           ^

...

7 楼

记住:在你对系统配置做的任何改动以后,不要忘记关闭Tomcat服务器并重新启动,否则不会生效.

我来回复

您尚未登录,请登录后再回复。点此登录或注册