我一直有这个麻烦了几天。希望这是更清洁的,以前做过这个的人可以帮助我!如何从xhtml中的commandButton重定向到Servlet
我在tomcat 7.0服务器上运行的Eclipse中构建一个带有JSF 2.0的webApp。并做了一个servlet我想去,但我不知道如何thandle导航规则带我去那里:
在我的项目中的路径是src/com/servlets/PdfServlet,所以当我运行在服务器上的这个servlet项目可以通过url localhost:8080/miloWeb/PdfServlet来访问。 servlet actualy为我创建一个Pdf文件并显示它。
反正我XHTML有这样的:
<h:commandButton id="reportButton" action="reportPdf" styleClass="button" value="get Report" ></h:commandButton>
我的脸,配置导航规则是这样的:
<navigation-rule>
<navigation-case>
<from-outcome>reportPdf</from-outcome>
<to-view-id>/miloWeb/PdfServlet</to-view-id>
<redirect />
</navigation-case>
</navigation-rule>
,但它需要我miloWeb /面/ miloWeb/PDFServlet中,我需要它把我带到了miloWeb/PdfServlet。
关于如何完成这个或其他路线或做到这一点的任何想法?
我这样做了,但是使用context.getExternalContext()。dispatch(url);非常感谢Hlep Bhesh – Myy 2012-01-06 03:11:49
欢迎您。 – 2012-01-06 05:15:15