Questions tagged as 'java'

2
answers

Approve or decline a request through the HandlerInterceptorAdapter

It is known that all requests by @RequestMapping are "public", where any user can access them through the browser. The question is how to approve Requests where only the system can request and refuse such request if it is accessed by...
asked by 15.04.2016 / 15:54
1
answer

How to handle exception in a Webview?

I wanted to know how to handle exceptions in my Webview, because sometimes the site is off, and the page does not load, and sometimes crashes the application. I tried a try catch on load, but it does not enter the exception, I want it...
asked by 24.10.2014 / 22:15
2
answers

Why are floating-point primitives divided or multiplied by certain multiples of 10 displayed in scientific notation?

In this answer we can see that Java has a peculiarity when displaying the result in certain types of operations with types primitives that have a floating point, such as division by multiples of 10, which can be seen in the example taken from...
asked by 21.12.2017 / 20:00
3
answers

What is the difference between the match () and find () methods of the Matcher class?

I'm trying to understand the difference in use of these two class methods Matcher , but I could not quite understand the description of the documentation that says:    public boolean matches ()   Attempts to match the entire region agains...
asked by 02.10.2017 / 14:32
3
answers

How to use more than one separator character in the split () method?

I'd like to break String into several substrings, for this I'm using the split() method. It turns out, I'm not sure what characters can be in the variable I'll use. Exemplifying: String words[] = line.split(" "); This code...
asked by 26.11.2014 / 18:09
2
answers

How to get form data via "POST"?

Is there any way I can receive data coming from an external form using method="post" on my jsf page? I can already do this when data travels via GET . <f:metadata> <f:viewParam name="dados" value="#{testeMB.dadoExt...
asked by 08.01.2014 / 13:56
1
answer

Use the same entity in Hibernate to write to two tables

I am using Hibernate to persist in the database, and in a given case, for every update that a given Consultor ed entity has, it should update in the main table called TB_Consultor and insert a new line in the TB_ConsultorHistorico...
asked by 17.01.2014 / 18:45
4
answers

Switch / case very interesting in Swift - What other languages support this?

The Swift language has a very interesting and intuitive way to work with switch-case breaks, with partial-matching, pattern-matching, etc. techniques, see these examples: let age = 33 switch(age){ case let x where x >= 0 && x <=...
asked by 30.06.2016 / 02:44
3
answers

Is it wrong to use multiple cases for the same action on the switch?

Is it wrong to do this with switch ? I programmed it like that, is it wrong? switch(estado){ case "AL": case "BA": case "CE": case "MA": case "PB": case "PE": case "PI": case "RN": case "SE": //FAZ ALGO AQUI PARA TODOS OS CASES DO NORDES...
asked by 25.09.2017 / 21:22
2
answers

What does this () alone do in the constructor?

In the code: public Livro(Autor autor) { this(); this.autor = autor; } public Livro() { this.isbn = "000-00-00000-00-0"; }     
asked by 23.01.2016 / 17:07