Posts by Marcus Martins • 737 points
40 posts
-
0
votes2
answers83
viewsA: selectOneMenu with convert does not work
you are using the variable manutencaoBean.veiculo as source list and output value. Try using the manutencaoBean.manutencao.veiculo for the output (example below). <h:outputLabel value="Veiculo: "…
-
1
votes1
answer45
viewsA: Null arrives attribute in Managedbean
In Commandbutton to insert the online document analysis you are setting the process="@this" and processing only Button. Try changing to process="@form".
-
0
votes1
answer177
viewsA: JSF and Javascript
If you need to control the style of a component, try using EL. The example below displays a grayscale div if it is awaiting termination (the controlador.aguardandoEncerramento is a boolean):…
-
0
votes2
answers92
viewsA: Query with Hibernate error could not get a field value by Reflection
Try changing the setParameter from Profissaodao to: String sql = "from Especialidade e WHERE e.idProfissao = :id"; listaEspecialidade = session.createQuery(sql).setParameter("id", profissao).list();…
hibernateanswered Marcus Martins 737 -
0
votes1
answer162
viewsA: Primefaces, p:fileDownload ajax="false" nullPointerException
It may be that Listener is being called after running the getStreamedContentAnexoLancamento(), therefore do not create streamed content. Try to make these modifications: In XHTML:…
-
1
votes1
answer1530
viewsA: How to make a Criteria Join for this query
If the criteria you presented is returning the entity you want, just do the setProjection: Criteria c = session.createCriteria(Entidade.class, "C"); c.createAlias("C.entidades1", "e");…
criteriaanswered Marcus Martins 737 -
0
votes1
answer179
viewsA: Autocomplete with New Registration option - JAVA
Autocomplete does not have a Facet for emptyMessage, such as Datatable (which could make the job easier). To do what you want, you can try to create a Person with the id null and return in search.…
-
0
votes1
answer699
viewsA: Update JSF only works in the whole form (Primefaces)
The update will only work if the component lblSexo is rendered. Try making the following change: (...) <p:ajax update="pnlSexo" event="change" /> (...) <h:panelGroup id="pnlSexo">…
-
0
votes1
answer46
viewsA: Lock send button when no file has been uploaded
You can try enabling the upload button only if there is a successful file upload. I think the simplest is to use a flag, initially set as true: In XHTML: <p:commandButton value="Enviar…
-
1
votes1
answer40
viewsA: Error when trying to display the information of an object in a <p: dialog/>
The datatable has the parameter selectionMode="single", so you can select only one record from the table. The problem is that you are setting the selected record in a Listdatamodel, at:…
primefacesanswered Marcus Martins 737 -
2
votes1
answer244
viewsA: Message is not being displayed
Try to put the autoupdate="true" in the messages.
-
1
votes3
answers7156
viewsA: generate a json file with java
You can use the Jsonobject of Java EE 7: String nome = "Joao"; Integer idade = 30; JsonObject json = Json.createObjectBuilder() .add("nome", nome) .add("idade", idade) .build(); String jsonString =…
-
0
votes1
answer365
viewsA: Insert 1000 concurrent users into Jmeter
Mariana, without knowing your application is a little difficult to detail, but I can provide general lines. I think the most practical way is to record a complete test using Jmeter and just edit…
jmeteranswered Marcus Martins 737 -
0
votes1
answer115
viewsA: Calculate Difference between Hours
From what I understand, you need to display the duration of a period in format String. If so, test the following: 1) Insert the getDescricaoDuracao() in XHTML: <p:outputText…
-
1
votes1
answer390
viewsA: Dynamic query using JPQL
I’ll leave you an idea that you can try to improve. Hibernate has a feature that allows you to create a query from an instance: org.hibernate.Criterion.Example. Since you already have the entities,…
-
1
votes1
answer81
viewsA: Use of flex in sub-items with different parent elements
I tried to reproduce your need only with div’s and flex to make a very lean and easy to understand code. Has a very good website to better understand how flex works: Flexy Boxes <html>…
-
0
votes1
answer18
viewsA: Place of message display
Tried to include a message for inputText? <h:inputText id="txt" value="#{bean.text}" /> <p:message for="txt" />
-
0
votes2
answers836
viewsA: JSF - How to pass a Bean function as an argument to a Javascript function?
I don’t know how you do the passing of function by parameters, but I needed to do something to manage dialogs in a standardized way similar to what you want and worked by another way, see if it…
-
1
votes1
answer271
viewsA: selectonemenu and dialog of primefaces
Try modifying the line <f:selectItems value="#{LoginBean.listEstados}" var="estado" itemValue="#{estado}" itemLabel="#{estado.estado_sigla}" /> for <f:selectItems…
-
1
votes1
answer56
viewsA: Create selects with Hibernate criteria Generico
There is the uaiCriteria, a Framework for JPA. I don’t think it’s a complete solution to your problem, but it’s an alternative to simplify the code. For example, to get a list of Pessoa with the…
-
0
votes2
answers599
viewsA: Update primefaces table
Sometimes the first faces cannot locate the component when it is inside a dialog or a tab, for example. Try changing the update of your commandButton. It would look like this: <p:commandButton…
-
0
votes1
answer35
viewsA: Show itemLabel instead of ivemValue in Datatable - JSF, Primefaces
If I understand correctly, you want to save the value of the itemLabel in typeTreatmentCB. If so, try to change the following: <f:selectItem itemLabel="Hospitalização Diurna - HD"…
-
1
votes1
answer226
viewsA: Horizontal Scroll Bar, selectOneMenu - Primefaces
I suggest you run some tests with the primefaces CSS. I got some similar results here using the classes ui-selectonemenu-items and ui-selectonemenu-items. For a simple test, add this to your XHTML:…
-
1
votes2
answers644
viewsA: Line break in data from a list
Since you did not specify what you are going to do with the list (I think it is only for display, but the same logic applies to other structures - checkboxes, for example), there are several…
-
2
votes2
answers1427
viewsA: Mark or uncheck selectBooleanCheckbox when clicking another
Another solution, using the enable/disable implementation in groups. In XHTML: <p:toolbar id="colunas" style="margin-top: 20px"> <p:toolbarGroup> <h:selectBooleanCheckbox…
-
1
votes1
answer177
viewsA: Show text while hovering on autocomplete
Can you try the Tooltip of the Primefaces: <p:autoComplete id="meuId" label="#{messages['mesage']}:" completeMethod="#{metodo}" var="bean" itemValue="#{bean.id}" itemLabel="#{bean.descritivo}"…
primefacesanswered Marcus Martins 737 -
0
votes1
answer298
viewsA: Ui:repeat - taking Description from the bank
Well... I don’t know if I understood your difficulty correctly, but I tried to run a simulation. I think placing checkboxes horizontally and vertically as your needs get a little difficult without…
-
2
votes2
answers1427
viewsA: Mark or uncheck selectBooleanCheckbox when clicking another
Maybe the component Radio may be an alternative, but if you need a more personalized control, you can try doing it as follows: Upshot: In XHTML: <h:panelGroup id="pnlOpcoes">…
-
1
votes1
answer252
viewsA: Show suggestions while typing autocomplete
You can try the following: public List<Geracao> listarGeracoes(String query) throws Exception { /* * 1a. Opção: fazer um método no seu dao para buscar por nome diretamente no banco */ //return…
-
1
votes1
answer91
viewsA: How to scan a signature with java
Can you try the Signature. It is very easy to use.
-
2
votes1
answer126
viewsA: Inheritance problem with HIBERNATE
I believe that the implementation will depend a lot on the type of the project. I recommend a very didactic reading of the JPA Mini Book.I’m using in the example below the Single Table strategy:…
-
0
votes1
answer91
viewsA: Enum me returning null Pointer
To use a Map in an Enum, I could only use the Immutablemap of Guava, in your example, would be as below: private static final Map<Disciplina, DefinicaoSCM> definicaoSCMPorDisciplina =…
-
2
votes3
answers109
viewsA: Value is not being written to the bank
I will also leave an implementation of a very good generic converter. We use a similar one in the company. The advantage is that it is not necessary to search in a BD, the object is saved in the…
-
-1
votes3
answers109
viewsA: Value is not being written to the bank
Did not miss the @Inject of GeracaoDAO in Convert? Try debugging the convert to see if the returns are correct.
-
1
votes1
answer1211
viewsA: Centralize components
Method 1 (without changing the CSS): I don’t know if it is possible to center the title without touching the CSS, but the buttons can do: <p:confirmDialog global="true" showEffect="explode"…
-
0
votes2
answers899
viewsA: Apache POI - Error opening file generated in MS Excel
Try to make a out.flush() before doing the out.close().
-
1
votes2
answers260
viewsA: Primefaces Dialog Tabview
You can try as follows: create a method to open the dialog and set the value of activeIndex directly by the bean. public void abrirDialog() { UIViewRoot viewRoot =…
primefacesanswered Marcus Martins 737 -
2
votes1
answer116
viewsA: Primefaces does not locate Panel and Datatable components
Sometimes the first faces cannot locate the component when it is inside a dialog or a tab, for example. Try changing the update to: <p:commandLink value="Novo Cliente"…
-
4
votes1
answer934
viewsA: Modify String object value passed as parameter
I think it would be better to use function return to define the ipAddress and the dnsAddress. Leaves the passage by parameter only to input the necessary data to the function. According to your…
javaanswered Marcus Martins 737 -
2
votes3
answers3802
viewsA: Load a list of Enums
If you already have an Enum, you can use it without creating a String list. It’s better because it makes reuse easier. In your example, just do: public List<Atributos> carregarAtributos() {…