我没有TimerServiceDispatcher在我的应用程序中创建spring bean名称.但是,JBoss抛出异常因为TimerServiceDispatcher已在此模块中定义.我不知道是什么问题.我错过了什么?我需要做什么?
我的应用程序使用Seam 2.3,Spring 3.0和JPA 2.0.我不用EJB.
11:29:01,531 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBAS015876: Starting deployment of "MRBS.war"
11:29:04,217 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC00001: Failed to start service jboss.deployment.unit."MRBS.war".PARSE: org.jboss.msc.service.StartExcept
ion in service jboss.deployment.unit."MRBS.war".PARSE: Failed to process phase PARSE of deployment "MRBS.war"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:119) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source) [rt.jar:1.6.0_23]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [rt.jar:1.6.0_23]
at java.lang.Thread.run(Unknown Source) [rt.jar:1.6.0_23]
Caused by: java.lang.IllegalArgumentException: JBAS011046: A component named …Run Code Online (Sandbox Code Playgroud) 在我的例子,Employee有一个OneToOne以关系Department与CascadeType.PERSIST.当我坚持多次Employee,
为什么EntityManager持续Department记录所有Employee记录?
我的期望是,如果我们使用CascadeType.PERSIST,当一个Employee被持久化时,Department将为每个Employee记录重新创建一条记录.
Employee.java
@Entity
public class Employee {
private String id;
private String name;
@OneToOne(cascade = CascadeType.PERSIST)
@JoinColumn(name = "DEP_ID", referencedColumnName = "ID")
private Department department;
-----
}
Run Code Online (Sandbox Code Playgroud)
Department.java
@Entity
public class Department implements Serializable {
private String id;
private String name;
}
Run Code Online (Sandbox Code Playgroud)
Test.java
public void insert() {
em = emf.createEntityManager();
em.getTransaction().begin();
Department department = …Run Code Online (Sandbox Code Playgroud) 我有一个表,其中包含No,Name,Address,Phone,Email列.我想在No列中设置自动编号而不通过我的java类传递参数.是否存在EL或需要解决的问题JasperReport.我使用的是5.1版.
注意:作为简单的表,我没有提供源和模板.
我有以下带有enum集合的实体.我想用enum参数搜索用户.
用户可能拥有多个权限.当我使用参数搜索用户时Permission.APPROVE,可能有一个或多个用户拥有该权限.我怎么写JPQL查询?
User.java
@Entity
....
public class User implements Serializable {
@ElementCollection(targetClass = Permission.class)
@Enumerated(EnumType.STRING)
@CollectionTable(name = "USER_PERMISSION", joinColumns = @JoinColumn(name = "PERMISSION", referencedColumnName = "ID"))
private List<Permission> permisssionList;
}
Run Code Online (Sandbox Code Playgroud)
Permission.java
public enum Permission {
REGISTER, APPROVE, REJECT, CONFIRM;
}
Run Code Online (Sandbox Code Playgroud)
怎么写 ?
public List<User> findUserList(Permission permission) {
Query q = em.createQuery(.....);
result = q.getResultList();
}
Run Code Online (Sandbox Code Playgroud) 如何JSF在eclipse中格式化代码?
我已经尝试如下:
我的XML Editor配置设置是:
如果我这样做Ctrl + Shif + F,eclipse格式化代码如下.
<tr>
<td><h:outputText value="#{label['MANAGE_USER_TITLE']}"
styleClass="table-title" /></td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我的期望格式是,之后 Ctrl + Shif + F
<tr>
<td>
<h:outputText value="#{label['MANAGE_USER_TITLE']}" styleClass="table-title" />
?
This line may be wrap base on line size.
</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
我该怎么做?有插件吗?我已经尝试了HTML Tidy,我只能格式化HTML,而不是JSF代码.
更新
图片1

图片1的Eclipse设置

图片 - 2(我想要)

在我AuthenticationFilter重定向到登录页面后,我想退出给用户.
这就是为什么,我把identity.logout();我的预渲染方法checkPermission(...)的login.xhtml.
但是,我得到ViewExpiredException了用户再次登录的时间.
我的问题是
1:如果我不这样做identity.logout();,用户再次重新登录,因为旧的用户会话仍然存在.
2:如果我这样做identity.logout();,我会ViewExpiredException在用户再次登录时获得.
AuthenticationFilter.java
public class AuthenticationFilter implements Filter {
.....
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
HttpServletRequest httpRequest = (HttpServletRequest) servletRequest;
HttpServletResponse httpResponse = (HttpServletResponse) servletResponse;
HttpSession session = httpRequest.getSession();
User user = (User) session.getAttribute(Constants.LOGIN_USER);
if (user == null) {
session.setAttribute(Constants.MESSAGE_ID, MessageId.REQUIRED_TO_LOGIN);
String loginView = httpRequest.getContextPath() + Constants.LOGIN_PAGE;
httpResponse.sendRedirect(loginView);
} else if …Run Code Online (Sandbox Code Playgroud) 想拥有以下数据表结构:
+--------------------------------------------------------------+
| dynamic | dynamic | dynamic |
|--------------------------------------------------------------|
| col1 | col2 | col3 | col1 | col2 | col3 | col1 | col2 | col3 |
|--------------------------------------------------------------|
| data | data | data | data | data | data | data | data | data |
Run Code Online (Sandbox Code Playgroud)
原因是,我不知道在我请求数据库之前必须显示多少列.col1,col2,col3中的列始终相同.
我尝试使用以下数据表:
<h:form id="form">
<h:panelGrid columns="3" style="margin:10px 0">
<p:outputLabel for="template" value="Adid:" style="font-weight:bold"/>
<p:inputText id="template" value="#{reportingView.adId}" size="50"/>
<p:commandButton update="kpi_table" actionListener="#{reportingView.updateColumns}" value="Create Data" process="@parent" icon="ui-icon-refresh" oncomplete="PF('carsTable').clearFilters()"/>
</h:panelGrid>
<p:dataTable id="reportingTable" var="pi" value="#{reportingView.indicators}" widgetVar="indicatorTable" filteredValue="#{reportingView.filteredValues}"> …Run Code Online (Sandbox Code Playgroud) 如果我使用如下,我没有错误,没有输出.为什么p:panelGrid不用ui:repeat?
注意:我不想使用c:forEach因为我已经面临很多JSF问题.
<p:panelGrid>
<ui:repeat value="#{MyBean.dataList}" var="data">
<p:row>
<p:column>
<h:outputText value="#{data.name}"/>
</p:column>
<p:column>
<h:outputText value="#{data.description}"/>
</p:column>
</p:row>
</ui:repeat>
</p:panelGrid>
Run Code Online (Sandbox Code Playgroud)
MyBean.java
public List<Data> getDataList(){
List<Data> result = new ArrayList<Data>();
result.add(new Data("Name 1", "Description 1"));
result.add(new Data("Name 2", "Description 2"));
result.add(new Data("Name 3", "Description 3"));
result.add(new Data("Name 4", "Description 4"));
return result;
}
Run Code Online (Sandbox Code Playgroud)
带有primefaces的预期输出

我想在jasper报告中使用自定义字体.Myanmar3是缅甸的标准字体.一切都很好,但ReportTitle必须Myanmar Font与Myanmar3.
Google也Myanmar3用于缅甸当地.
将报告导出为html文件时.它可以显示报告标题.但是,导出的PDF文件无法正确显示.
在浏览器中.

在PDF中

public void report() throws Exception {
List<SalesReport> saleReports = salesReportService.findSalesReport(new SalesReportCriteria());
InputStream inputStream = new FileInputStream("report-template/saleReportTemplate.jrxml");
String outputFilePdf = "D:/temp/BasicReport.pdf";
String outputFileHtml = "D:/temp/BasicReport.html";
Map paramMap = new HashMap();
paramMap.put("ReportTitle", "\u1005\u101B\u1004\u103A\u1038\u1021\u1004\u103A\u1038\u1019\u103B\u102C\u1038\u1011\u100A\u103A\u101E\u103D\u1004\u103A\u1038\u1001\u103C\u1004\u103A\u1038");
paramMap.put("TableDataSource", new JRBeanCollectionDataSource(saleReports));
JasperDesign jasperDesign = JRXmlLoader.load(inputStream);
JasperReport jasperReport = JasperCompileManager.compileReport(jasperDesign);
JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, paramMap, new JRBeanCollectionDataSource(saleReports));
JasperExportManager.exportReportToPdfFile(jasperPrint, outputFilePdf);
JasperExportManager.exportReportToHtmlFile(jasperPrint, outputFileHtml);
}
Run Code Online (Sandbox Code Playgroud)
saleReportTemplate.jrxml
<?xml version="1.0" encoding="UTF-8"?>
<jasperReport …Run Code Online (Sandbox Code Playgroud) 我想解决以下condtion字符串.因为我想在我的项目中支持动态条件.
a != 0 && b > 5
Run Code Online (Sandbox Code Playgroud)
我的预期计划是
public boolean resolve() {
String condition = "a != 0 && b > 5";
Map<String, Object> paramMap = new HashMap<String, Object>;
paramMap.put("a", 2);
paramMap.put("b", 6);
boolean result = ConditionResolver.resolve(condition, paramMap);
if(result) {
//do something
}
}
Run Code Online (Sandbox Code Playgroud)
更新:
我不是要解决数学等式,如下所示
((a + b) * y) /x
Run Code Online (Sandbox Code Playgroud)