我有一个代码来显示员工的图表.
数据(名称,电话,照片等)存储在SQLServer中并通过JSP显示.除了图像.jpg(存储在IMAGE = BLOB列中)之外,显示数据是可以的.
顺便说一句,我已经显示了图像(参见下面的代码),但我不知道如何将它放在.css中定义的区域(参见下面的代码),因为图像通过了resultSet在浏览器的整个页面中加载.
有谁知道我怎么能'构图'图像?
<%
Connection con = FactoryConnection_SQL_SERVER.getConnection("empCHART");
Statement stSuper = con.createStatement();
Statement stSetor = con.createStatement();
Blob image = null;
byte[] imgData = null;
ResultSet rsSuper = stSuper.executeQuery("SELECT * FROM funChart WHERE dept = 'myDept'");
if (rsSuper.next()) {
image = rsSuper.getBlob(12);
imgData = image.getBytes(1, (int) image.length());
response.setContentType("image/gif");
OutputStream o = response.getOutputStream();
//o.write(imgData); // even here we got the same as below.
//o.flush();
//o.close();
--[...]
<table style="margin: 0px; margin-top: 15px;">
<tr>
<td id="photo">
<img title="<%=rsSuper.getString("empName").trim()%>" src="<%= o.wite(imageData); o.flush(); …Run Code Online (Sandbox Code Playgroud) 我想显示一个这样的蒙版数字:1.234.567,89.以下代码已经执行此操作:
<p:column>
<h:outputText value="#{item.value}">
<f:convertNumber locale="pt_BR"/>
</h:outputText>
</p:column>
Run Code Online (Sandbox Code Playgroud)
如何在footerText列中为Primefaces数据表应用相同的掩码,如下面的代码摘录?
<p:columnGroup type="footer">
<p:row>
<p:column colspan="8" footerText="Grand Total:" />
<p:column footerText="#{upbController.totalLosses}" />
</p:row>
</p:columnGroup>
Run Code Online (Sandbox Code Playgroud)
提前致谢.
我有一个CRUD,我想更改inputTexArea:
<p:inputTextarea id="tags" value="#{myController.selected.tags}" />
Run Code Online (Sandbox Code Playgroud)
到新的Primefaces 芯片组件:
<p:chips id="tags" value="#{myController.selected.tags}" />
Run Code Online (Sandbox Code Playgroud)
实体类摘录:
@Lob
@Size(max = 2147483647)
@Column(name = "tags")
private String tags;
//GETTER AND SETTER OMITTED
Run Code Online (Sandbox Code Playgroud)
该GET方法工作得很好,因为预期的标签显示领域:
public List<String> getTags() {
return Arrays.asList(tags.split(","));
}
Run Code Online (Sandbox Code Playgroud)
但是set方法不是,因为当我点击Save时,会发生异常:
public void setTags(List<String> tags) {
this.tags = String.join(",", tags);
}
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.CharSequence
at org.hibernate.validator.internal.constraintvalidators.SizeValidatorForCharSequence.isValid(SizeValidatorForCharSequence.java:33)
at org.hibernate.validator.internal.engine.constraintvalidation.ConstraintTree.validateSingleConstraint(ConstraintTree.java:281)
Run Code Online (Sandbox Code Playgroud)
有谁可以帮助我吗 ?
提前致谢.
ps.:我已经向Primefaces团队询问了这个问题(https://forum.primefaces.org/viewtopic.php?f=3&t=51091),Primefaces的核心开发人员(Thomas Andraschko)指导我去问Hibernate验证团队.
我有一个带浮点字段的数据库表,我想通过Primefaces显示它.我想显示格式为(例如一千)的数字:1.000,00我试过:
<p:column sortBy="#{item.value}" filterBy="#{item.value}">
<f:facet name="header">
<h:outputText value="#{epoBundle.ListUpbTitle_value}"/>
</f:facet>
<h:outputText value="#{item.value}"/>
<f:convertNumber pattern="#0.000" locale="pt_BR"/>
</p:column>
Run Code Online (Sandbox Code Playgroud)
但得到:/WEB-INF/include/entity/upb/List.xhtml @ 80,55 父不是 ValueHolder 的实例:org.primefaces.component.column.Column @ 13ec99d0
有人能帮我吗?
提前致谢.
在我的webapp中,当我单击登录链接时,Tomcat Web服务器会抛出以下异常:
exception
javax.servlet.ServletException: /aluno_jsf.xhtml: Property 'logout' not found on type
br.com.aluno.controller.LoginMB
javax.faces.webapp.FacesServlet.service(FacesServlet.java:422)
root cause
javax.el.ELException: /aluno_jsf.xhtml: Property 'logout' not found on type
br.com.aluno.controller.LoginMB
[...]
Run Code Online (Sandbox Code Playgroud)
这是我的@ManagedBean:
package br.com.aluno.controller;
import java.io.Serializable;
import java.util.Collection;
import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;
import br.com.aluno.dao.DaoFactory;
import br.com.aluno.entity.Usuario;
import br.com.aluno.util.JsfUtil;
@ManagedBean
public class LoginMB implements Serializable {
private static final long serialVersionUID = 6667329439219329074L;
private Usuario usuario;
@PostConstruct
public void init() {
usuario = new Usuario();
}
public void logar() {
try {
Collection<Usuario> …Run Code Online (Sandbox Code Playgroud) 在Primefaces 4中,我们可以配置轴刻度标签的旋转,如下所示:
<p:barChart id="idBars" value="#{chartBean.modelChart}"
[...]
style="xaxisAngle=-30"
>
</p:barChart>
Run Code Online (Sandbox Code Playgroud)
现在,如何使用Primefaces 5或更高版本配置轴刻度标签的旋转?
提前致谢.
我想加载从数据库列中读取的Primefaces 4 dataTable filterOptions.我使用Set接口存储选项的不同值,然后将这些不同的值放在ArrayList中,如上所示.
我不清楚为什么我得到java.lang.ArrayStoreException,因为它们都是整数值.
有人能帮我吗?
提前致谢.
摘录托管bean代码:
private ArrayList<Integer> filteredPrefDeps;
public ArrayList<Integer> getFilteredPrefDeps() {
return loadPrefDeps();
}
public void setFilteredPrefDeps(ArrayList<Integer> filteredPrefDeps) {
this.filteredPrefDeps = filteredPrefDeps;
}
private ArrayList<Integer> loadPrefDeps() {
Set<Integer> setList = new HashSet<>();
for (Upb id : getItems()) {
setList.add(Integer.valueOf(id.getPrefDep()));
}
ArrayList<Integer> list = new ArrayList<>(setList);
return list;
}
Run Code Online (Sandbox Code Playgroud)
jsf摘录:
<p:column filterBy="#{item.prefDep}" filterOptions="#{upbController.filteredPrefDeps}" filterMatchMode="exact" >
Run Code Online (Sandbox Code Playgroud) 我希望Primefaces 条形图中的数字应显示小数点(例如:102.456,00)。
是否可以在函数扩展器中设置数字格式:
function ext() {
this.cfg.axes.yaxis.tickOptions.formatString = "R$ %d ";
this.cfg.seriesDefaults.rendererOptions.dataLabelFormatString = "R$ %d";
}
Run Code Online (Sandbox Code Playgroud)
使用此功能,数字显示如下:R$10832 | R$10832 R$25476 等。但我希望它显示为:R$10.832 | R$10.832 R$25.476 等
是否可以在函数中设置它,还是需要使用Java 数字格式设置它?
我想基于这个例子为一些数据表行着色:http://www.primefaces.org/showcase/ui/datatableColoring.jsf.
如何在rowStyleClass中放置一个if-elseIf块,以便每个条件设置多个颜色?
说明性示例:
<p:dataTable value="#{myController.items}" var="item"
rowStyleClass="#{item.realizado le 29 ? 'yes' : null}"
rowStyleClass="#{item.status.id gt 1 ? 'unavailable' : null}"
</p:dataTable>
Run Code Online (Sandbox Code Playgroud)
我们的想法是"加入"上面rowStyleClass中的条件.
提前致谢.