在我的一个JSF应用程序中,我顶部的标题部分包含selectOneMenu,底部的内容部分显示为"过滤器组件".默认情况下,应用程序首先在顶部显示selectOneMenu数据,在底部显示相应的Filter信息.如果用户选择不同的selectOneMenu数据,则应在底部内容部分上加载相应的过滤器信息.
Filter组件具有CommandButton,用户填充Filter信息.单击该按钮,并且过滤器被批准,应用程序应加载另一个组件 - Report.xhtml代替Filter组件.那就是Filter组件应该由底部内容部分的Report替换.
单击selectOneMenu项应该重复该过程.那就是显示过滤器屏幕等.
问题区域1.无法显示过滤器表单并隐藏内容部分2上的报表.过滤器的后台bean - commandButton确定应该返回值.根据结果,应显示报告以代替过滤器.
我不确定设计是否准确,如果这不能按预期工作,请提出建议,我们将非常感谢您的宝贵答案.我想保持应用程序基于ajax,我不想在按钮事件上重新加载整个页面.
GDK
<h:form id="form1">
<h:selectOneMenu value="#{states.stateName}">
<f:selectItems value="#{states.stateChoices}"/>
<f:ajax render=":Filter"/>
</h:selectOneMenu>
</h:form>
<h:form id="Filter">
<div id="content">
<h:panelGroup id="one" rendered="Need a condition from form1 to display this">
#{states.stateName}
<br/>Report
<h:inputText id="report" value="#{Counties.report}" style="width:150px"/>
<h:commandButton id="OK" value="OK" actionListener="#{Counties.getReports}">
<f:param name="CatName" value="Dekalb" />
</h:commandButton>
</h:panelGroup>
</div>
</h:form>
<h:form id="Report">
<div id="content">
<h:panelGroup id="two" rendered="#{should be rendered on acceptance from OK command button}">
<ui:include src="Report.xhtml"/>
</h:panelGroup>
</div>
</h:form>
Run Code Online (Sandbox Code Playgroud) 我创建了一个映射到MyBean.beansField的表单.我使用了javax.validation.NotNull anotation来确保它必须输入.到目前为止一切正常但错误消息如下所示:
beansField:不能为null.
无论我到目前为止尝试了什么,我都无法删除消息前面的"beansField:".
任何人都可以告诉我这个前缀来自哪里以及如何摆脱它?
需要捕获具有基于复选框的行选择的dataTable的rowSelect事件.代码如下:
<p:ajax event="rowSelect" listener="#{articleBean.onRowSelect}"
oncomplete="articleBean.onSelection" />
<p:ajax event="rowUnselect" listener="#{articleBean.onRowUnselect}"
oncomplete="articleBean.onSelection" />
<p:column id="name" headerText="Select" selectionMode="multiple"
style="width:18px" />
Run Code Online (Sandbox Code Playgroud)
我无法理解这种行为.当我第一次单击复选框时,将调用方法"onRowSelect".当我取消选择时,"onRowUnselect"不会被调用.而且,"onRowSelect"方法只为网格调用一次,如果我单击任何其他复选框,则事件不会被触发.我错过了什么吗?无法理解这种行为.
我正在以下网站上尝试示例应用程序:
JSF 2,PrimeFaces 3,Spring 3和Hibernate 4集成项目
但我发现在运行项目时,我得到:
严重:异常发送上下文初始化事件监听器类org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException的实例:错误创建名为"UserService"在ServletContext的资源定义[/ WEB-INF /的applicationContext豆.xml]:设置bean属性'userDAO'时无法解析bean'UserDAO'的引用; 嵌套异常是org.springframework.beans.factory.BeanCreationException:错误创建具有名称豆"的UserDAO"在ServletContext的资源定义[/WEB-INF/applicationContext.xml的]
但是,在applicationContext.xml文件中,相关代码如下:
<!-- Beans Declaration -->
<bean id="User" class="com.otv.model.User"/>
<!-- User Service Declaration -->
<bean id="UserService" class="com.otv.user.service.UserService">
<property name="userDAO" ref="UserDAO" />
</bean>
<!-- User DAO Declaration -->
<bean id="UserDAO" class="com.otv.user.dao.UserDAO">
<property name="sessionFactory" ref="SessionFactory" />
</bean>
<!-- Session Factory Declaration -->
<bean id="SessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="DataSource" />
<property name="annotatedClasses">
<list>
<value>com.otv.model.User</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop>
<prop key="hibernate.show_sql">true</prop>
</props>
Run Code Online (Sandbox Code Playgroud)
这些类确实存在于相关的包中,并且可以在下面看到各种配置文件的位置.

我在教程和我的实现之间看到的唯一区别是我使用的是NetBeans 7.2而不是Eclipse.
谁有任何想法为什么这是?
我正在使用twitter bootstrap css来设计风格.要在其中制作图标按钮,标准方法是使用"i"标签.
<button type="submit"><i class="icon-search"></i></button>.
但我不能在其中输入
<h:commandButton id="myid"><i class="icon-search"></i></h:commandButton>
如何在渲染中添加HTML <h:commandButton>?
我想在导出表格时将PDF页面大小更改为A4 格局.但无论我做什么,我都无法完成它.
这是我的代码:
<h:commandLink title="Export">
<p:graphicImage value="/resources/theme-main/images/export/pdf.png"
style="border:0"/>
<p:dataExporter target="myTable" type="pdf" fileName="name"
encoding="windows-1250" preProcessor="#{fileExportProcessor.preProcessPDF}"/>
</h:commandLink>
Run Code Online (Sandbox Code Playgroud)
托管bean的方法非常简单:
public void preProcessPDF(Object document) {
Document pdf = (Document) document;
pdf.open();
pdf.setPageSize(PageSize.A4.rotate());
}
Run Code Online (Sandbox Code Playgroud)
我也尝试将尺寸设置为A0或我的自定义尺寸,只是为了看它工作,但没有改变...... PDF导出仅在A4纵向模式下导出.
你能帮我,怎么做这个工作(A4横向模式)?
我的代码非常简单.但是在运行executeBatch()之后,只有1行进入数据库.
代码如下:
//INSIDE LOOP:
{
ps = conn.prepareStatement("INSERT INTO NK_EVENT_DATA VALUES(?,?,?,?,?,?,?);
// setting bind variable values
ps.setLong(1, ed_fi_uid);
ps.setString(2 , ed_date);
ps.setString(3, ed_hash_key);
ps.setLong(4 , ed_et_uid);
ps.setLong(5, ed_etn_uid);
ps.addBatch();
}
//LOOP ENDS
ps.executeBatch();
Run Code Online (Sandbox Code Playgroud)
但是,只插入一条记录而不是5条记录.
我想更新驻留在iframe外部的组件.我将从iframe内部的组件调用更新,并更新iframe外部的组件.我怎么能这样做?
<p:tabView id="tab_view" dynamic="true" cache="true" scrollable="true">
<p:tab id="tab_1" title="Test">
<iframe id="tab_frame"
src="#{request.contextPath}/xxx/xxx.xhtml"
width="100%" height="285px" style="border-width: 0px;" />
</p:tab>
</p:tabView>
Run Code Online (Sandbox Code Playgroud)
xxx.xhtml
<h:form id="testform">
<p:commandLink value="Click here" action="#{controller.methodY()}" style="color:blue;" update="tab_view"/>
</h:form>
Run Code Online (Sandbox Code Playgroud)
commandlink中的更新不起作用.如何更新我的tabview?
我在Angular 2.4上,我正在尝试使用PrimeNG的时间表,但我遇到了错误.如果您转到以下链接,您将看到计划的示例,如果向下滚动页面,还会看到文档:
http://www.primefaces.org/primeng/#/schedule
我遵循该文档(唯一的区别是我将"MyModel"更改为"CalendarComponent"),但是出现以下错误:
calendar.component.html:0:0引起的错误:this.schedule.fullCalendar不是函数
这是因为我需要安装和导入FullCalendar吗?我想可能是这种情况,但当我尝试导入它时,我得到了以下404:
https:// localhost:44301/node_modules/fullcalendar/fullcalendar 404()
尝试导入FullCalendar后,这是我的代码...
app.module.ts:
...
import { FullCalendar } from 'fullcalendar/fullcalendar';
import { ScheduleModule } from 'primeng/primeng';
import { CalendarComponent } from './calendar.component';
...
imports: [
...
FullCalendar,
ScheduleModule
],
declarations: [
...
CalendarComponent
],
...
Run Code Online (Sandbox Code Playgroud)
calendar.component.ts:
...
export class CalendarComponent implements OnInit {
events: any[];
headerConfig: any;
public constructor(
...
) { }
ngOnInit(): void {
this.events = [
{
"title": "All Day Event",
"start": "2016-01-01"
},
{
"title": "Long Event",
"start": …Run Code Online (Sandbox Code Playgroud) JSF 2.2和Primefaces 6.0
我正在尝试使用过滤器类进行身份验证会话控制。但是过滤器类运行21次,并且浏览器设置了错误消息ERR_TOO_MANY_REDIRECTS。
Web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<display-name>maintenancemonitoring</display-name>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>
<context-param>
<description>State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
</context-param>
<context-param>
<param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
<param-value>resources.application</param-value>
</context-param>
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
<filter>
<filter-name>authFilter</filter-name>
<filter-class>view.filters.AuthenticationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>authFilter</filter-name>
<url-pattern>*.xhtml</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>primefaces.THEME</param-name>
<param-value>cupertino</param-value>
</context-param>
<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>
Run Code Online (Sandbox Code Playgroud)
过滤器类别:
public void
doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException,
ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest; …Run Code Online (Sandbox Code Playgroud) jsf ×6
primefaces ×4
java ×2
angular ×1
export ×1
fullcalendar ×1
html ×1
iframe ×1
javascript ×1
jdbc ×1
pdf ×1
primeng ×1