primefaces DataExporter ignore columns that have h:link - primefaces

the primefaces DataExporter ignores the the column where I use to link the result.
<p:column>
<f:facet name="header">
<h:outputText value="Brand" />
</f:facet>
<h:link outcome="pretty:carBrand-page">
<h:outputText value="#{car.brand}" />
</h:link>
</p:column>
How can I get the brand also exported, without href ?
Thanks

Related

How to disable form while loading panel shows by p:ajaxstatus

I would like to disable form selection while loading panel appears. I have been using p:ajaxstatus for loading panel
<p:ajaxStatus style="width:32px;height:32px;position:fixed;top:50%;left:50%;display:block;z-in‌​dex:1004;" onstart="PF('statusDialog').show()" onsuccess="PF('statusDialog').hide()">
</p:ajaxStatus>
<p:dialog widgetVar="statusDialog" modal="true" draggable="false" closable="false" resizable="false" showHeader="false"> <p:graphicImage name="images/preloader.gif" library="modena-layout" />
</p:dialog>

Eclipse: format JSF/XHTML/HTML/... files with each attribute on same line, but column-wise

In Eclipse, I find no way to format code the way I need to for JSF, XHTML, HTML or XML files like can be configured for Java.
I have found the following part-solutions:
JSF Code formatter or Eclipse XML Editor, each tag for new line?
However, just placing attributes on the next line, indenting them by one is not enough:
<p:spinner
id="multi-trade-adjust-count"
value="#{bulkTradeManager.count}"
title="Number of trades to create"
maxlength="2"
size="1"
min="1"
max="50"
styleClass="bx-spinner mb-5px"
style="width: 60px;">
<p:ajax
listener="#{bulkTradeManager.onCountChange}"
process="#this"
update=":content-form:data-panel" />
</p:spinner>
I am so unhappy with it, that I end up using no JSF formatters at all. What I'm desparately looking for is a result like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:of="http://omnifaces.org/functions"
xmlns:p="http://primefaces.org/ui"
xmlns:pe="http://primefaces.org/ui/extensions">
<p:dataTable id="multi-data-add"
value="#{bulkTradeManager.dataModel}"
var="trd"
rowIndexVar="rowIndex"
rowKey="#{trd.id}"
editable="true"
editMode="cell"
rowStyleClass="#{bulkTradeManager.lastNonRemovableIndex le rowIndex ? 'ui-state-highlight' : ''}"
styleClass="mb-10px mr-10px">
<p:ajax event="cellEdit"
listener="#{bulkTradeManager.onCellEdit}"
update=":content-form:msgs" />
<p:ajax event="sort" />
<p:column headerText="#{msg['common.active.header']}"
rendered="#{bulkTradeManager.showingConstantColumns}"
styleClass="text-center">
<h:outputText value="#{trd.active ? msg['common.yes.label'] : msg['common.no.label']}" />
</p:column>
<p:column headerText="#{msg['entity.trade.transactionNbr.shortHeader']}"
rendered="#{bulkTradeManager.showingConstantColumns}">
<h:outputText value="#{trd.transactionNbr}" />
</p:column>
<p:column headerText="#{msg['entity.trade.referenceNbr.shortHeader']}"
sortBy="#{trd.referenceNbr}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{trd.referenceNbr}" />
</f:facet>
<f:facet name="input">
<p:inputText id="reference-number-input"
value="#{trd.referenceNbr}"
styleClass="width-190px" />
</f:facet>
</p:cellEditor>
</p:column>
<p:column headerText="#{msg['entity.trade.quantity.header']}/#{msg['common.nominal.header']}*"
sortBy="#{trd.quantity}">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{trd.quantity}">
<f:convertNumber maxIntegerDigits="126" pattern="#,###,##0.########" />
</h:outputText>
</f:facet>
<f:facet name="input">
<p:inputText id="quantity-input"
value="#{trd.quantity}"
required="false"
requiredMessage="#{msg['entity.trade.quantity.requiredMessage']}"
maxlength="50"
styleClass="width-190px">
<pe:keyFilter regEx="/[0-9,.]/i" />
<f:convertNumber maxIntegerDigits="126" pattern="#,###,##0.########" />
</p:inputText>
</f:facet>
</p:cellEditor>
</p:column>
...
This means, on top of the option "Split multiple attributes each on a new line", at least two sub options need to be present to produce this:
[✓] Split multiple attributes each on a new line
[✓] Leave first attribute on the same line as the opening tag
[✓] Align attributes column-wise
Q:
Does anything like this exist?
Maybe a JSF formatter plugin? Maybe there are some hacks via the config files?
Addendum:
As it stands now, JSF, XHTML, XML, HTML etc. formatting is a somewhat incomplete feature, at least the long-term solution would be to offer a configuration that is more like the Java code formatters where almost anything can be configured.
I'd even be tempted to contribute to the Eclipse community, if it's not overly hard to implement the two check boxes described. At least, leaving the first attribute on the same line and using the second character's column index after the opening tag and taking it for all subsequent attributes as indent seems doable to me...

JSF not showing data from database

I'm trying to show data from mysql database in JSF, but nothing show up. Getting page with table without data. I'm using http://www.devmanuals.com/tutorials/java/jsf/database/viewdata.html tutorial
index.xhtml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
>
<h:head>
<title>index.xhtml</title>
</h:head>
<h:body>
<h1>JSF 2.0 View Data From The Database Table Example</h1>
<h:dataTable value="#{UserBean.getUserList()}" var="u" border="1">
<h:column>
<f:facet name="header">
User ID
</f:facet>
#{u.userID}
</h:column>
<h:column>
<f:facet name="header">
Name
</f:facet>
#{u.name}
</h:column>
<h:column>
<f:facet name="header">
Address
</f:facet>
#{u.address}
</h:column>
<h:column>
<f:facet name="header">
Created Date
</f:facet>
#{u.created_date}
</h:column>
</h:dataTable>
</h:body>
</html>
It seems you've just mistyped the managed-bean's name in your view when using within the <h:dataTable>'s tag. You should render its first letter lowercase to enable the proper use, i.e from value="#{UserBean.getUserList()}" to value="#{userBean.getUserList()}".

Change the width of a primefaces picklist

I want to change the width of my picklist instead of having the default width in primefaces.css
I have tried this but it doesn't work.
<h:body>
<f:facet name="last">
<h:outputStylesheet library="default" name="mystyle.css" />
</f:facet>
<p:pickList ...>
...
</p:picklist>
</h:body>
And in my mystyle.css I've only this:
.ui-picklist .ui-picklist-list{
width:400px !important;
}
Your CSS is apparently never being loaded. If you have checked the generated HTML output and/or the HTTP traffic monitor, you should have noticed it. The culprit is the <f:facet name="last"> which isn't supported by <h:body>. It's only supported by <h:head> and even then only when PrimeFaces is installed.
This should do:
<h:body>
<h:outputStylesheet library="default" name="mystyle.css" />
<p:pickList ...>
...
</p:pickList>
</h:body>
See also:
How do I override default PrimeFaces CSS with custom styles?

Why a contact form make my footer disappear?

I build this contact form, which works perfectly if I run it alone, but if I put on my contact page make my footer disappear, I really don't know why this is happening, I really need help with this.
contact.xhtml
<!DOCTYPE html>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j">
<h:form id="contact">
<h:panelGrid columns="3">
<h:outputLabel for="name" value="Nome (Obrigatório)" />
<h:inputText id="name" value="#{contact.client.name}" />
<h:message for="name" />
<h:outputLabel for="email" value="E-Mail (Obrigatório)" />
<h:inputText id="email" value="#{contact.client.email}" />
<h:message for="email" />
<h:outputLabel for="website" value="Website (Opcional)" />
<h:inputText id="website" value="#{contact.client.website}" />
<h:message for="website" />
</h:panelGrid>
<h:outputLabel for="text" value="Mensagem (Obrigatório):" /> <br/>
<h:inputTextarea id="text" value="#{contact.client.text}" rows="20" cols="80" /><br/>
<h:message for="text" />
<br/>
<h:commandButton value="Enviar" action="#{contact.sendMessage}" >
<f:ajax execute="#form" render="#form" />
</h:commandButton>
<h:outputText value="#{contact.messageStatus}" id="out" />
<a4j:status>
<f:facet name="start">
<h:graphicImage name="loader.gif" library="image" />
<h:outputText value="Enviando ..." />
</f:facet>
</a4j:status>
</h:form>
</ui:composition>
Without the componet 'contact.xhtml' it looks like:
With the component (and without the footer):
Any idea why this is happening ?
Any help ?
UPDATE
I host the page here guys, so you could take a look at it.
I checked the HTML source of your page (rightclick page in browser, View Source), at the bottom I see unparsed JSF tags:
<a4j:status>
</a4j:status>
and then all the HTML stops there.
Apparently you forgot to declare the XML namespace for a4j and the HTML renderer got mad.
xmlns:a4j="http://richfaces.org/a4j"
This should in development stage however have issued a clear warning. Add the following context parameter to your web.xml to be notified sooner on this kind of future mistakes:
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
Since there is no code to look at, I can only guess: margins of the form or the footer.