jsp+sevlet怎么运行

RootCoCo 2012-06-05 09:20:40
我把html上传到了服务器,想把htm再显示出来,网上找了代码:
jsp显示服务端返回的html文件及图片问题

显示html 文件:

sevlet 代码:

String htmlFilePath = "./file" + htmlName;request.getSession().setAttribute("htmlFilePath", htmlFilePath );

jsp 代码:

String htmlFilePath= (String)session.getAttribute("htmlFilePath");<jsp:include page="<%=htmlFilePath %>"></jsp:include>

该怎么弄才能把他运行起来呀?
...全文
106 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
ttyyaabb 2012-06-05
  • 打赏
  • 举报
回复
在web.xml中加入serverlet的配置文件

<servlet>
<servlet-name>SnapShot</servlet-name><!--serverlet名 -->
<servlet-class>cn.GTPW.payment.action.system.SnapShot</servlet-class><!--类的地址 -->
</servlet>
<servlet-mapping>
<servlet-name>SnapShot</servlet-name><!--serverlet名 -->
<url-pattern>/ss</url-pattern><!--触发请求的关键字 -->
</servlet-mapping>

然后在你写serverlet的类里继承 httpserverlet
cxw3152 2012-06-05
  • 打赏
  • 举报
回复
在JSP中直接调用你配置的SERVLET就可以了。。

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧