JQuery的AJAX的JSF / JSF标签都没有确定。找不到的FacesContext [英] JQuery AJAX JSF / jsf tags are not identified. Cannot find FacesContext
问题描述
我在使用jQuery的Ajax和JSF组合面临的一个问题。我不是pretty的知道这是一个平常的问题,并且可以处理,但希望能得到解决。
下面是该方案。我们正在开发一个门户项目使用JSF。所以在页面上,我们需要加载行方面巨大的表中的数据(APPX 300-400有时)和每一行都会有一个链接,需要打开一个弹出窗口。所以为了不要打了页面的表现,我计划延迟加载的JSP(弹出内容)。所以想到了去了阿贾克斯。该JSP是一种具有不认识的AJAX负载的JSF标签。我明白当JSP负载阿贾克斯这将是一个普通的/独立(非jsf'tified)版本。
所以我的问题是:我怎么能在这情况下jsf'tified使JSF标签可以是可见的JSP(弹出内容)
。目前我得到找不到FacesContext中。
我用下面的code:
jQuery.ajax({
键入:GET,
缓存:假的,
的contentType:text / html的;字符集= ISP-8859-1,
网址:'<%= renderResponse.en $ C $卷曲(renderRequest.getContextPath()+/tempfolder/tempLoader.jsp)%>',
数据:{参数1:66,参数2:88},
成功:函数(MSG){
jQuery的(loadContent。)的HTML(MSG)。
jQuery的(#viewpopupdiv)儿童()显示()。
}
});
和我的jsp:
<%@标签库的uri =http://java.sun.com/jsf/corepreFIX =F%>
<%@标签库的uri =http://java.sun.com/portletpreFIX =portlet的%>
<%@标签库的uri =http://www.ibm.com/jsf/html_extendedpreFIX =HX%>
<%@标签库的uri =http://java.sun.com/jsf/htmlpreFIX =H%>
< DIV ID =视图的风格=文本对齐:左>
<表类=viewpopupdiv的风格=宽度:480px;背景色:#efedea;边框宽度:薄;边框颜色:#FF6633;边境风格:固体;的cellpadding =0CELLSPACING =0的边界=0>
&其中; TR>
< TD>
<表格样式=宽度:100%>
&其中; TR>
< TD>
<表格样式=宽度:100%;背景颜色:#424341;>
&其中; TR>
< TD类=editLineHeaderDarkLeft>
&LT;跨度类=&GT;线路ID&LT; / SPAN&GT; :功放; NBSP;&LT;跨度class="headerValueForPopup"><%=lineDetails.getDisplayableOrderLineId()%></span></td>
&LT; TD类=editLineHeaderDarkCenter&GT;
&LT;跨度类=&GT;订单号&LT; / SPAN&GT; :功放; NBSP;&LT;跨度class="orderNumberHeaderValueForPopup"><%=lineDetails.getDisplayableOrderHeaderId()%></span></td>
&LT; TD类=editLineHeaderDarkRight&GT;&LT; DIV HREF =#的onclick =closePopupForEditLine('closepopupdiv')&GT;&LT; IMG类=关闭SRC ='&LT;%= imgUrl的%&GT;边境=0&GT;&LT; / DIV&GT;
&LT; / TD&GT;
&LT; / TR&GT;
&LT; /表&gt;
&LT; TD类=editLineHeaderDarkLeft&GT;
&LT; DIV CLASS =chargeTypeDropListJQ&GT;
&LT; H:selectOneMenu用于值=#{popupBean.chargeTypeId}的styleClass =selectOneMenu用于&GT;
&LT; F:selectItems的值=#{popupBean.chargeType}/&GT;
&LT; / H:selectOneMenu用于&GT;
&LT; / DIV&GT;
&LT; / TD&GT;
&LT; / TR&GT;
&LT; /表&gt;
&LT; / TD&GT;&LT; / TR&GT;&LT; /表&gt;&LT; / DIV&GT;
找不到的FacesContext
当您运行使用JSF组件为纯香草JSP JSP页面,而不必调用 FacesServlet的
你会得到这个异常。这是一个负责创建 FacesContext中
。请求的URL需要匹配&LT; URL模式&GT;
的 FacesServlet的
,因为它是被definied在的web.xml
把所有的JSF标签才能正常运行。
假设URL模式是 *。JSF
,那么你需要更改
网址:'&LT;%= renderResponse.en $ C $卷曲(renderRequest.getContextPath()+/tempfolder/tempLoader.jsp)%&GT;',
到
网址:'&LT;%= renderResponse.en $ C $卷曲(renderRequest.getContextPath()+/tempfolder/tempLoader.jsf)%&GT;',
I am facing a problem while using jquery ajax and jsf combination. I am not pretty sure if this is a usual problem and can be handled, but hoping to get a solution.
here is the scenario. we are developing a portal project with jsf. so on a page we have to load huge data in terms of rows in a table(appx 300-400 sometimes) and each row will have a Link which needs to open a popup. so in order not to hit the performance of the page, i am planning to lazy load the jsp(popup content). so thought to go for ajax. the jsp is having the jsf tags which are not recognizing by the ajax load. I understand when the jsp loads by ajax it will be a plain/independent (un jsf'tified) version.
so my question is : how can i make the jsp(popup content) in this scenario jsf'tified so that jsf tags can be visible.
currently i am getting cannot find FacesContext.
i am using the following code:
jQuery.ajax({
type: "GET",
cache: false,
contentType: "text/html; charset=ISP-8859-1" ,
url: '<%=renderResponse.encodeURL(renderRequest.getContextPath()+ "/tempfolder/tempLoader.jsp") %>',
data:{param1:66, param2:88},
success:function(msg) {
jQuery(".loadContent").html(msg);
jQuery("#viewpopupdiv").children().show();
}
});
And my jsp:
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/jsf/html_extended" prefix="hx"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<div id="view" style="text-align:left">
<table class="viewpopupdiv" style="width:480px;background-color:#efedea;border-width: thin; border-color: #ff6633; border-style:solid;" cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table style="width:100%">
<tr>
<td>
<table style="width:100%;background-color:#424341;">
<tr>
<td class="editLineHeaderDarkLeft">
<span class="">Line ID</span> : <span class="headerValueForPopup"><%=lineDetails.getDisplayableOrderLineId()%></span></td>
<td class="editLineHeaderDarkCenter">
<span class="">Order Number</span> : <span class="orderNumberHeaderValueForPopup"><%=lineDetails.getDisplayableOrderHeaderId()%></span></td>
<td class="editLineHeaderDarkRight"><div href="#" onclick="closePopupForEditLine('closepopupdiv')"><img class="close" src='<%=imgURL%>' border="0"></div>
</td>
</tr>
</table>
<td class="editLineHeaderDarkLeft">
<div class="chargeTypeDropListJQ">
<h:selectOneMenu value="#{popupBean.chargeTypeId}" styleClass="selectOneMenu">
<f:selectItems value="#{popupBean.chargeType}" />
</h:selectOneMenu>
</div>
</td>
</tr>
</table>
</td></tr></table></div>
cannot find FacesContext
You will get this exception when you run a JSP page with JSF components as "plain vanilla" JSP without invoking the FacesServlet
. It's the one responsible for creating the FacesContext
. The request URL needs to match the <url-pattern>
of the FacesServlet
as it is been definied in web.xml
to get all the JSF tags to run properly.
Assuming that the URL pattern is *.jsf
, then you need to change the
url: '<%=renderResponse.encodeURL(renderRequest.getContextPath()+ "/tempfolder/tempLoader.jsp") %>',
to
url: '<%=renderResponse.encodeURL(renderRequest.getContextPath()+ "/tempfolder/tempLoader.jsf") %>',
这篇关于JQuery的AJAX的JSF / JSF标签都没有确定。找不到的FacesContext的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!