开发者

Use jsf within jsp (change portion of jsp to use jsf)

I need help about converting a portion of jsp page to jsf. My old jsp page is big, and I am trying to change a portion of it (CountryDropdown List) to JSF. So I created a countryDropdown.jsf, I tested to run it directly, it loaded the country-list/works fine.

In my old jsp page (company.jsp), I removed the countryList's portion and try to call/include the new jsf "countryDropdown.jsf" something like this:

<jsp:include page="/web/Test/countryDropDown.jsf" flush="true" />

But I get the errors: 开发者_如何学运维java.lang.RuntimeException: Cannot find FacesContext

I am not sure what I was missing, if I directly run the new jsf page http://.../web/Test/countryDropDown.jsf it works fine.


It's not possible to include a JSF page in a regular JSP called directly. If you want to use JSF components, your request must be dispatched by the FacesServlet.

It might be possible to get your setup to work if company.jsp is itself called as a JSF page. But you'll probably keep running into problems; JSF is not really meant to be introduced in bots and pieces into an existing application. At the very least, each page should be either completely JSF or completely classic JSP.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜