如何调试标签?
有没有办法调试
标记?
我有一个 container.jsp
,它是 jsp:include
sa servlet。 container.jsp
内有一个表单。当我通过 GET 请求获取 container.jsp
时,jsp:include
工作正常,并且目标 servlet 的输出显示在其中。但是,当我通过 POST 请求获取 container.jsp
时,目标 servlet 的输出不会显示在页面上。
问题是我无法弄清楚 jsp:include
究竟出了什么问题。为什么它在一种情况下运行良好,而在另一种情况下却悄然消失。我尝试在 TRACE
级别使用 log4j 打开 org.apache.jasper.runtime.JspWriterImpl 日志,但它没有显示任何内容。
有没有什么方法/技术/工具可以找出运行时 jsp:include
内部的内容?有没有比 jsp:include
更容易使用的替代方案?任何帮助将不胜感激。
Is there a way to debug <jsp:include>
tag?
I have a container.jsp
that jsp:include
s a servlet. container.jsp
has a form within. When I get container.jsp
by a GET request, jsp:include
works fine and output from the target servlet is shown within. But when I get the container.jsp
by a POST request, output from the target servlet isn't shown on the page.
The problem is that I can't figure out what exactly goes wrong with jsp:include
. Why would it work fine in one situation and vanish quietly in another. I tried to turn on org.apache.jasper.runtime.JspWriterImpl
logs with log4j at TRACE
level but it din't show anything.
Is there any way/technique/tool to find out what goes inside jsp:include
at runtime? Is there any alternative to jsp:include
that is easier to work with? Any help will be much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您向包含 Servlet1 的 page1.jsp 发出 XXX 请求时,将调用其
doXxx()
因此,对于您的情况,您将调用
doPost()
,但它不会执行任何操作正如你提到的When you make XXX request to page1.jsp which includes Servlet1 its
doXxx()
will be calledSo for your case youd
doPost()
is being called which doesn't do anything as you mentioned您正在使用
doGet()
生成输出,因此当您使用GET
请求获取 jsp 时,它可以正常工作。创建一个方法并从 servlet 中的
doGet()
和doPost()
调用它以生成输出。然后,它将适用于 POST 和 GET
you are generating your output using
doGet()
so it works fine when you get your jsp usingGET
request.Create a method and call it from
doGet()
anddoPost()
in your servlet which generates output.Then, It will work for POST as well as GET