Explanation about a JSP command

Asked

Viewed 210 times

0

I have a command line in my JSP code that I can’t understand type StringUtils.isBlank

I know it’s a condition, what I don’t know is what’s inside. It follows part of the code:

if(StringUtils.isBlank(historicoProcedimento.getRestricoes()) && StringUtils.isBlank(historicoProcedimento.getErros())){
  • It means that according to the code, if(historicProceint.getRestricoes() and historicProcedimento.getErros()) are equal to null it will enter the function is that?

  • Man Thank you so much for your help!

1 answer

1


StringUtils.isBlank returns true if the string passed is empty (""), contain only spaces (or other characters considered whitespace), or for null. Otherwise, it returns false.

In your code, you have two such checks with a && in the medium (logical operator AND). That is, will only enter the if if both conditions are true.

  • "is blank" in the case of that method means to be "" or to contain only whitespace, as an example " "

  • Yes, I just upgraded after consulting the documentation

  • @Piovezan whitespace in this case includes n, r, t?

  • 1

    All that Character.isWhitespace() return true.

  • Thank you, I think now the answer is accurate. For me to learn not to meddle in answering language thing that I know superficially :)

  • @bfavaretto was actually thoughtful, because if you take it literally, it is the typical case for research or consultation of documentation.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.