Posts by Leonardo Villela • 1,620 points
61 posts
-
1
votes3
answers321
viewsA: Why give new in class attribute?
The use of new implies the creation of an instance for the class to the right of the reserved word new, about which constructor is being called in this case is the following, in java, when you do…
javaanswered Leonardo Villela 1,620 -
0
votes6
answers201
viewsA: How to remove 2 digits from each item in the list?
Complementing the @Renan response, it follows one of the forms of java using version 8: List<String> lista = Arrays.asList(new String[] {"01.um", "02.dois", "03.tres"}); List<String>…
-
1
votes1
answer68
viewsA: Error Spring MVC Rest Full
I believe it is related to the fact that your model does not have a public constructor,Serializable, performing these 2 steps, its class becomes a POJO(Plain Old Java Object), a pattern that Jackson…
-
2
votes2
answers55
viewsA: switch not recognizing ENUM as constant
It happens because you are trying to compare the Enum code with the Enum itself, because the getUpdateaction() returns the One in itself, but you try to make the case with the Enum code, thus…
javaanswered Leonardo Villela 1,620 -
0
votes2
answers264
viewsA: Session Hibernate, how to obtain instance
Instead of using the @Autowired try the @PersistenceContext.
-
0
votes1
answer1348
viewsA: Pass a List as parameter in Restful Java web services
The resolution for this is to use a class for the "wrap" of your list, follow an example below to help you: // Wrapper class Produtos { List<Produto> produtos } // JAX-RS…
-
1
votes1
answer529
viewsA: Installation webstorm in Ubuntu
Enters the Webstorm folder, then enters the bin folder, then executes the following command sudo ./webstorm.sh, after this it will open a Wizard in the graphical interface and it is only next, next…
-
1
votes4
answers277
viewsA: Start grails application
Just enter the project root and run the command grails run-app. If you need more help on the issue of visualization of the static features just talk.
-
1
votes2
answers1497
viewsA: How to remove decimal point
From what I saw, you want to return an integer value, I think the "problem" is in the return of the method getNumeroEleitores, that should actually be a long, I imagine you’re returned a double or…
javaanswered Leonardo Villela 1,620 -
1
votes1
answer131
viewsA: Foreign key recording as null
Hello, from what I saw in the comments you already managed to solve your problem, but another approach is to use the JPA so you don’t have to do this job of saving the Estudante then the Endereco,…
-
3
votes1
answer95
viewsA: Referencing variables in HTML
in fact there are two very common ways, usually this is done through a view engine of its language, of which it uses its own syntax, is one of the functionalities that it proves is precisely the…
-
0
votes2
answers7155
viewsA: Problem with Spring "No Qualifying bean of type found for dependency"
Hello, good morning, sir. Just to clarify the error, the reason why it works now and isn’t working before is quite simple, the <context:component-scan base-package="br.edu.infnet.controller"/>…
-
0
votes1
answer809
viewsA: How to map an html page in Spring MVC
No use adding the . html extension in the InternalResourceViewResolver of Spring, as it is used to render files that need rendering Engines as is the case with JSP, in which case the configuration…
-
1
votes1
answer180
viewsA: Persisting in Database from a file
I believe if you move the instruction ProdutoEntityManager mf = new ProdutoEntityManager(); out of the while, it will work, as there is no need to create several EntityManager to persist more than…
-
1
votes1
answer194
viewsA: Function to create buttons from an Object
Good night! I modified your button object to be an array, so it is easier to iterate on it, and each button becomes an object, being simpler to access its properties, also includes two versions of…
-
0
votes1
answer129
viewsA: Passing a variable to Annotation
Hello, what you can do is use a variable that was declared in some spring configuration file(.yml, .propertiers), so it would look something like this: @Scheduled(fixedDelayString =…
-
1
votes1
answer626
viewsA: How to pick up errors in AJAX requests?
Hello Renan already understood your mistake, It is the following, when you perform a request and is without internet, your request is interpreted as a request for another domain thus leading to this…
javascriptanswered Leonardo Villela 1,620 -
0
votes1
answer294
viewsA: Sum and mean sql table in java
It is quite simple just to carry out a projection, in code already with the criterion of the third column being greater than 0 is like this: select SUM(nome_coluna2) / COUNT(*) from Filmes where…
sqlanswered Leonardo Villela 1,620 -
1
votes1
answer71
viewsA: string comparison + linkedList
What you really want to test is the output of this method converterCamelCase, so I would do the following, test that for each item present in LinkedList returned this method is in accordance with…
-
1
votes1
answer38
viewsA: http get method called automatically
Hello, my suspicion is that using the relative path this being redirected to the same Serrvlet, try to use the absolute path to that your jsp page, follow an example:…
-
1
votes2
answers1288
viewsA: Execution cannot find 'org.junit.Assert' even if you have the Junit jar in classpath
Hello, the first problem I see is that Junit’s test methods should have the return type void and the method can not be Static, also modified your pom.xml to add the correct version of junit and the…
-
1
votes2
answers1330
viewsA: URL Forwarding With Spring MVC
I’ll put two methods of a controller containing the most common ways to do this. In code it would be something along those lines: @Controller public class MainController { @RequestMapping(value =…
-
1
votes1
answer396
viewsA: How to insert value into html attribute with javascript
just get the link and then set the value in the href attribute, follow an example of the code: <a href="#" id="link">Teste</a> var link = document.getElementById('link'); link.href =…
-
0
votes1
answer468
viewsA: Problem with Fetch Lazy [ Spring Boot ] [ Thymeleaf ]
Hello as we talked in the comments, a possible solution is to note down your method getList with @Transactional of Spring, because then your method will run inside a transaction avoiding this…
spring-bootanswered Leonardo Villela 1,620 -
1
votes1
answer417
viewsA: JPA error Hibernate = foreign key is returning null
Hello my suspicion about this error is as follows, when you will save the employee you do not arrow the person in it, then the person attribute in gets null, from what I understand you are filling…
-
1
votes1
answer483
viewsA: Spring/Jackson Json - Problem in deserialize
Hello your Deserialize would look like this: public class BloqueteDeserialize extends JsonDeserializer<Bloquete> { @Override public Bloquete deserialize(JsonParser jp, DeserializationContext…
-
1
votes1
answer41
viewsA: What is the right way to consume Blobs via JAVASCRIPTS, HTML5, etc?
Yes you can use with the HTML5 img tag, follow the example: <div> <img…
-
1
votes3
answers8611
viewsA: How to browse lists?
Only by complementing the Renan response, it is not necessary to use the.stream() list to use the foreach method, if the list you want to iterate implement the Collection interface you can use the…
-
0
votes1
answer62
viewsA: Loss of Encode when minimizing javascript in Grails
Victor this has already happened to me, is the following the encoding of the Answer of your request is different from UTF-8, which is the reason for this disorder, what you can do is to manually…
-
1
votes2
answers205
viewsA: Javascript function becomes "Undefined" in addeventlistener
Hello, from what we talked about in the comments of your question, I believe it is something related to the fact that you do not define dlg, within the Dialog function, so try to modify the code to…
javascriptanswered Leonardo Villela 1,620 -
2
votes1
answer255
viewsA: How to print information that is in json format but is printed in a way that allows the user to read?
the best way to do this would be to structure your JSON string, that is to include it in some data structure to be able to access/modify its values in a simpler way, so I would use a library to…
-
3
votes3
answers6169
viewsA: lock enter inside an input
You can add a function to your input that does nothing when enter is pressed. <input type='text' class='form_campos form_campos_nome' id='auto' name='verifica_nome3' onkeypress="doNothing()">…
-
2
votes1
answer94
viewsA: Object problems using java sockets
try to implement the interface Serializeble in your class Pessoa, when you implement this interface your class becomes "serializable".
-
5
votes1
answer323
viewsA: JPA, Hibernate, Spring MVC, Maven - Definition
good evening, we will clarify each of these points. JPA - That’s what you said. Hibernate - That’s what you said. Spring MVC - It is a framework, however not an ORM, in case your ORM would be the…
-
2
votes1
answer88
viewsA: Error returning Hashmap to Javascript
I believe that you are returning a JSON of this action from your controller, so Spring uses Jackson to serialize your object to the JSON format, however the same has to be configured in your…
-
1
votes1
answer222
viewsA: How to handle multiple inputs with the same name in Java?
I will take into account that you are sending this data to the backend using form-data, if that is so, you can receive a List phones in your controllers, and spring will give bind to you, however…
-
-1
votes1
answer690
viewsA: how to get javascript console request url
you can get the URL parameters through the object, window, follow an example below. Also follows another function to get the parameters in object format. function getQueryParams() { var…
-
2
votes1
answer61
viewsA: Take all elements that meet a condition
If you are using java 8, you can use the streams API and pass a predicate and return the elements that meet a certain condition, follow the code below: public List<String> obtemFotos(String…
-
1
votes2
answers3824
viewsA: Paging with Spring Framework
From what you said it seems to me that you use Spring Data, so Spring itself provides another interface that you can extend when you are declaring your repository, this being the…
-
3
votes1
answer1008
viewsA: Stackoverflow in bidirectional relationship at JPA
this problem happens, when Spring tries to serialize the object to JSON, and as there are circular references, it plays an Exception indicating that, for you to solve this problem, you usually have…
-
0
votes1
answer62
viewsQ: How to access an environment variable with .(dot) in the name
Hello, can anyone tell me how to access an environment variable with .(dot) in the name using linux terminal
-
1
votes1
answer641
viewsQ: There is a standard size for increasing Tomcat memory
Hello, there is a standard size for increasing Tomcat memory, through the Xmx and Xms parameters?
-
1
votes2
answers309
viewsQ: Why my $Scope. $watch doesn’t work
Does anyone have any idea why mine doesn’t work $scope.$watch, that model $scope.paciente.telefones is connected to a combobox. $scope.$watch('paciente.telefones', function(oldv, newv) { var…
angularjsasked Leonardo Villela 1,620 -
0
votes0
answers34
viewsQ: Redirecting data with mongodb
I was wondering if it is possible to direct an object/result to a specific collection using the command db.collection.find(), which would equal the $out in the aggregation operation.…
-
2
votes1
answer64
viewsQ: Error prompts Ajax(Get) Angularjs
I’m having a problem when I make a GET request to the server. My Factory always returns an empty object, when it should not. So mine server (localhost:8080/av1/listarCarroEstoque) upon request…
-
2
votes1
answer426
viewsQ: When to Use Factory Angularjs
Hello folks good night, I wanted to know two things the first is when I should use the Factory directive and the other is if for example within a Factory I can make an Ajax request and return the…
angularjsasked Leonardo Villela 1,620 -
4
votes1
answer2380
viewsQ: Doubt the $group mongodb
I need to use the grouping operator $group of mongodb, but every explanation I find is very confusing. How this works and what is the benefit of using this operator?
-
1
votes0
answers191
viewsQ: Error 404 Servlet
I have an error that is the following whenever I access the URL that my Servlet had to answer it presents me error 404, I am trying to access the Servlet by this url: localhost:8080/project/oa Here…
-
5
votes2
answers4683
viewsQ: AJAX post request with Angularjs
Hello, I wanted to know how I make a requisition POST for a url with Angularjs and also wanted to know how I transform a normal javascript object for a json, to send in this request.…
-
0
votes1
answer463
viewsQ: Doubt modifying HTML tags with Angularjs
Would someone like to tell me how I can change an html tag with angular, like if I added an ng-model tag and from that I could change the properties of the tag like class, id, text and etc...