![]() |
| ||
| is a variable set? I am in the process of learning JSP and my question is how do I check to see if a variable exists? The equivalent of this in php would be [php]if (isset($_POST['someVar']))[/php] or [php]if (isset($_GET['someVar']))[/php] any and all help would be appreciated! |
| ||
| Re: is a variable set? I'm pretty sure you can use defined in javascript. You can try: if (defined(somevariable)) {
I'm not sure, but I think that's accurate. |
| ||
| Re: is a variable set? that wont work because i need it to be serverside, otherwise i might as well do it in html/javascript instead of jsp |
| ||
| Re: is a variable set? You are talking about a regular variable right? Or are you talking about an evirionment variable? |
| ||
| Re: is a variable set? You mean a request or session attribute? It's easy. <c:if test="${not empty someVar}">
Actually if it's just to prevent errors when outputting something you don't need to check, JSTL is smart enough to ignore anything that's not there so <c:out value="${someVar}"/>
would just output nothing at all if someVar weren't there. |
| ||
| Re: is a variable set? i mean like a get (from url) or posted (client connection) variable |
| ||
| Re: is a variable set? Hmn, will this help any: http://www.experts-exchange.com/Web/...21299007.html? |
| All times are GMT -4. The time now is 9:14 am. |
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC