Posts by Jose Anderson Pereira • 416 points
15 posts
-
1
votes1
answer112
viewsA: How to update an <h:form> every 30 seconds JAVA WEB
Try it Brother? <h:form id="formulario"> <p:poll interval="3" listener="#{bean.atualizaForm}" update="formulario" /> ... </h:form>
-
1
votes3
answers344
viewsA: Determine the page where the *.pdf file will open in the browser
Try to make the argument #page=[numPag] in the Response Header. Follow the example on page 2 below: response.setHeader("Content-Disposition","attachment;filename=\"teste.pdf#page=2\";"); Create a…
-
2
votes2
answers614
viewsA: How to get current directory of a web application?
It’s quite simple: String caminhoApp = new File("").getAbsolutePath();
javaanswered Jose Anderson Pereira 416 -
4
votes3
answers149
viewsA: Check two denials in an if expression
This is basic but can be tricky for those who are starting. Before invoking a method in any instance of the object always ask if it is null: teste == null teste != null If you try to invoke a method…
-
1
votes1
answer91
viewsA: JPQL Query for Data Insertion
Thus: String query = "insert into User values(?,?)"; EntityManager em = emf.createEntityManager(); em.createNativeQuery(query) .setParameter(1, "maria") .setParameter(2, "123456") .executeUpdate();…
-
2
votes1
answer527
viewsA: Use Date Field in Java with Mysql
You are missing in the parameters of Query SQL, each "query" represents a parameter to be set in the Statement, as there is no ? for the Client id so it doesn’t need to be set in your Statement the…
-
0
votes1
answer181
viewsA: About Selectoneradio
Put in your Search View ... <p:selectOneRadio id="id" value="#{pesquisaUsuarioBean.filtro.status}" > <f:selectItem itemLabel="Todos" itemValue="null" /> <f:selectItem…
-
1
votes1
answer213
viewsA: I’m trying to return the name but can only return the ID
You will have to create a method in the Bean ConsultaFuncionariosBean only to rescue the Funcionario by id as: No Bean @PostConstruct public void pesquisarFuncionario() { this.funcionario =…
-
1
votes1
answer57
viewsA: Difference between List and and Return in Entity
considering good practice, I believe that the first method is confusing and does not apply. Since you are passing a User parameter to list all users, I would use it like this: public…
-
2
votes1
answer726
viewsA: It is possible to create a list of generic Object
Yes it is possible. Class<?> clazz = Class.forName("com.teste.Endereco"); List<Class<?>> classes = new ArrayList<Class<?>>(); classes.add(clazz);…
-
4
votes4
answers209
viewsA: How to capture textarea tag with new line?
Hello friend I managed to do that way: <textarea\b[^>]*>((\n*|.)*)<\/textarea> Example: https://regex101.com/r/oJ0iP6/2 Explanation: <textarea\b[^>]*> Catch the first tag,…
regexanswered Jose Anderson Pereira 416 -
1
votes2
answers405
viewsA: Error sending email using Javamail
I think this is SMTP port problem, if I remember correctly operators blocked the door 25 in 2012 (correct me if I’m wrong). Try the door 587 props.put("mail.smtp.socketFactory.port", "587");…
javaanswered Jose Anderson Pereira 416 -
1
votes1
answer394
viewsA: Filling in automatic data - JSF
Hi, the attribute to render is the render of f:ajax ... <f:ajax listener="#{usuarioBean.popularProjeto}" render="formGeral" /> ... See more in:…
-
0
votes1
answer41
viewsA: Popular datatable jsf
If you are using JSF 2.0 or higher, you can use the component f:ajax <h:selectOneMenu value="#{bean.itemSelecionado}"> <f:selectItems value="#{bean.itens}" var="item"…
-
3
votes1
answer77
viewsA: I can’t carry fields
You are forgetting to pass employee CPF as query parameter. String sql = "select * from funcionario where cpf = '?'"; stmt = this.conn.prepareStatement(sql); stmt.setString(1, execute.getCpf());…