Hayi
Hayi

Reputation: 6246

concatenation of 2 variable in EL

How to make this in El :

${'&edit='+edit+'id='+id}

I try it but it didn't work. he make addition instead of concatenation !

Upvotes: 2

Views: 1463

Answers (2)

fujy
fujy

Reputation: 5264

You can not concatenate Strings like this in EL, unless you are using EL 3.0, In previous EL versions you can call concatenate method of each string.

Like this

${'&edit='.concat(edit).concat('id=').concat(id)}

In EL 3.0, you can do it like this

${'&edit=' += edit += 'id=' += id}

The EL version is related to supported version of the Servlet implementation in your Servlet Container you are using (e.g., Tomcat, JBoss) and the Servlet version defined in your web.xml file, for example:

Servlet 3.0 supports EL 2.2

Servlet 2.5 supports EL 2.1

Servlet 2.4 supports EL 2.0

If you are using Tomcat as your servlet container, please check this page which gives information about supported Java EE specs implementations (e.g., Servlet, JSP, EL)

http://tomcat.apache.org/whichversion.html

Upvotes: 3

Alexey
Alexey

Reputation: 2582

Could you use two EL expressions instead of one?

&edit=${edit}id=${id}

Upvotes: 0

Related Questions