How to concatenate 2 Strings with Java in HTML

Asked

Viewed 587 times

0

I am using the following input with 2 pre-set values.

<input type="text" class="read-only" value="${FORM.dataAgendamento + FORM.horaAgendamento}" readonly="readonly" size="40"/>

If they are integers, it works perfectly, but for strings I’m getting java.lang.Numberformatexception:

I wanted to know how to perform this string concatenation in this same input.

  • 3

    Will this value be analyzed by Java or Javascript? The error is in Java, but the tags are Javascript.

  • Are you using JSP? What are the values of these variables?

1 answer

2

In case you tried to sum two objects that are not numbers. Try the following:

<input type="text" class="read-only" value="${FORM.dataAgendamento} ${FORM.horaAgendamento}" readonly="readonly" size="40"/>

Browser other questions tagged

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