wood burning stoves 2.0*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes doubt in JSTL  set tag Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "doubt in JSTL  set tag" Watch "doubt in JSTL  set tag" New topic
Author

doubt in JSTL set tag

muthu kumaran
Ranch Hand

Joined: Oct 26, 2004
Posts: 56
I have a few doubts on c:set tag in JSTL

1) Can a <c:set> tag be used to assign an attribute List or Array as value
[i.e. <c:set var="list" value=some_array_or_list />

2) How does the container differentiate between an EL expression and a normal Java String
in the value attribute of the <c:set> tag

For instance,
<c:set var="name" value="${person.name}" />

Here how does the container knows that ${person.name} is to be evaluated
even though ${person.name} is a valid Java String

3) In page 445 of HFSJ under the "With Body" topic of <c:set> tag

we have
<c:set var="userLevel" scope="session">
Sheriff,Bartender,Cowgirl
</c:set>

should the values be taken as an "Array" Object or a "String" Object
with comma separated values


Could someone throw some light to get my doubts cleared

Thanks
Muthu
Umakanth Godavarthy
Ranch Hand

Joined: Nov 10, 2005
Posts: 37
1.This version of <c:set> is only used to set scoped attributes.
2.EL will always treat '.' as the delimitter for:
{left-side}.{right-side}
where,
{left-side} - bean-name/map
{right-side} - property/key
3.'Sheriff,Bartender,Cowgirl' is the value of the attributte 'userLevel'
muthu kumaran
Ranch Hand

Joined: Oct 26, 2004
Posts: 56
hi
my doubts still remain uncleared..

1) Can a <c:set> tag be used to assign an attribute List or Array as value
[i.e. <c:set var="list" value=some_array_or_list />

Of course, <c:set> is used to set scoped attributes..
but my doubt was whether the "var" version of <c:set>
can hold a list/array.

2) My second question was how does the conatiner differentiate
between a normal String and an EL expression..since the characters

"{","}","." can be part of a normal String too..

3)'Sheriff,Bartender,Cowgirl' is the value of the attributte 'userLevel'

But is it an "Array" or a "String with comma separated values"


muthu
Umakanth Godavarthy
Ranch Hand

Joined: Nov 10, 2005
Posts: 37
1.It can hold anything that is of type java.lang.Object, that is the law of 'scoped attributes', so it can definitely hold array/list object

2.The right side of '.' operator should be a valid java identifier. So it should follow the same rules like 'starting letter should be a letter, _ or $...etc'. if any attribute identifier contains say, '.' then you should use requestScope, sessionScope etc. implicit objects to retreive the value.

3.Its ofcourse a string.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doubt in JSTL set tag
 
Similar Threads
Accessing nested info via html:text
This week's giveaway
cset doubt??
JSTL (c:set)
c:set in jstl