Some Java Guy
Some Java Guy

Reputation: 5118

JSP defining values

I have two values in JSP. For 1 I defined a=http:// and for 2nd I defined b=google.com Currently I am using concat_urls= "<%=a%><%=b%>" . Can I join them as concat_urls= "<%=ab%>"

Upvotes: 0

Views: 54

Answers (2)

Nishant
Nishant

Reputation: 55856

NO

ab will be interpreted as new variable. You can do this <%= a+b %>

Upvotes: 0

axtavt
axtavt

Reputation: 242686

No. However, expression in <%= ... %> is a normal Java expression, so you can write

<%= a + b %>

Also note that in general use of scriptlets is discouraged.

Upvotes: 2

Related Questions