gaurih
asked on
concatenate string in jstl
<c:forEach var="address" items="${addressList}" varStatus="status">
<c:set var="firstaddress" value="${address.streetAdd ress} ${address.extendedAddress} ${address.city } ${address.city } ${address.zipcode }," />
</c:forEach>
Will the firstaddress have the concatenated address separated by comma? What is the right way to concatenate?
<c:set var="firstaddress" value="${address.streetAdd
</c:forEach>
Will the firstaddress have the concatenated address separated by comma? What is the right way to concatenate?
ASKER
I need to concatenate different variables in a single variable, I would like to know the method of concatenation of strings
The way you did it above here(in the <c:set> tag) is fine.
Are you trying to concatenate all the addresses in the addressList into one variable ?
Or are you trying to create a new variable for each address ?
Are you trying to concatenate all the addresses in the addressList into one variable ?
Or are you trying to create a new variable for each address ?
ASKER
Concatenate all the address in one variable
If you want to concatenate all the addresses into one variable, then you might have to do it in a scriptlet.
What do you want to do with the variable once all the data is in it ?
What is addressList ? Is it an ArrayList ? Does it contain Address objects that are javabeans?
What do you want to do with the variable once all the data is in it ?
What is addressList ? Is it an ArrayList ? Does it contain Address objects that are javabeans?
ASKER
I will have data in a array like
<address>
<streetadreess>abc</street address>
<zipcode>66788</zipcode>
</address>
In this case I need to concatenate street address and zip code to concatenate and check the length of the complete address
<address>
<streetadreess>abc</street
<zipcode>66788</zipcode>
</address>
In this case I need to concatenate street address and zip code to concatenate and check the length of the complete address
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Please give us more details.
What is addressList ? A javabean ?
How do want the data displayed ? Show us what it should look like in the browser.