dreamwever游览jsp问题

发布时间:2024-06-13 22:50 发布:上海旅游网

问题描述:

我在dreamwever写jsp,预览的时候出来的全是代码,是不是设置什么有问题?如何才能正确预览jsp.
能把配置虚拟目录的步骤说下吗?

问题解答:

jsp其实是要编译成java的servlet源码的,必须要应用服务器(如tomcat)启动后,再打开你的路径(http://localhost:8080/webroot)才可以看到实际的页面

安装JDK,再安装TOMCAT,再配置虚拟目录,然后就可以预览了
补充:在tomcat安装目录下,有一个conf目录,在里面找到server.xml
打开,在<host>这里加下面的代码(这里面还有很多别的代码,可以不用管)</host>
如:
<host>
......这里省略系统自带的代码

<Context path="/proName" reloadable="true" docBase="E:\test" debug="0">
</Context>
</host>
说明:其中proName是虚拟目录名称,后面有路径;
如果你想连接数据库也可以这边配置:
<Context path="/proName" reloadable="true" docBase="E:\test" debug="0">
<Resource name="jdbc/test" auth="Container" type="javax.sql.DataSource" factory="org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory"
username="enterprise" password="helloenterprise" driverClassName="com.microsoft.jdbc.sqlserver.SQLServerDriver" url="jdbc:microsoft:sqlserver://127.0.0.1:1433;selectMethod=cursor;DatabaseName=数据库名称"
maxWait="1000" removeAbandoned="true" maxActive="100" maxIdle="30" removeAbandonedTimeout="60" logAbandoned="true"/>
</Context>

热点新闻