|
Checking variable existance using JSTL
|
|
08-23-2008, 11:34 PM
Post: #1
|
|||
|
|||
|
Checking variable existance using JSTL
How can I check a variable's existance using JSTL? I am expecting an attribute in my session and if that attribute exist I need to display a block of code. How can I do that?
|
|||
|
08-24-2008, 12:27 AM
Post: #2
|
|||
|
|||
|
RE: Checking variable existance using JSTL
You can use <c:if> for that purpose.
Code: <c:if test='${not empty variableName}'>Where variable is your variable name. If you have a variable named var in your session and if you want to check whether that variable existence or not use the following code. Code: <c:if test='${not empty sessionScope.var}'> |
|||
|
08-24-2008, 12:33 AM
Post: #3
|
|||
|
|||
|
RE: Checking variable existance using JSTL
I need something like a if else . If the variable exist display some content else some other content. Please give me the code for that.
|
|||
|
08-24-2008, 12:34 AM
Post: #4
|
|||
|
|||
|
RE: Checking variable existance using JSTL
Here you go.
Code: <c:choose> |
|||
|
08-24-2008, 12:39 AM
(This post was last modified: 08-24-2008 12:40 AM by reena.)
Post: #5
|
|||
|
|||
|
RE: Checking variable existance using JSTL
Thank you.
|
|||
|
« Next Oldest | Next Newest »
|

Search
Member List
Calendar
Help




