Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove a session variable in jstl

Tags:

jsp

jstl

I want to remove a session variable or set it to null in JSTL. Please help me with it. If I have tried using

<c:set var="varialbleName" value=null scope="session" /> 

But it gives me the following server error.

Server Error
Caused by:

org.apache.jasper.JasperException: /WEB-INF/jsps/forum.jsp (line: 78, column: 71) quote symbol expected
at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:276)
at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:92)
at org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:223)
at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:163)
at org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:154)
at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1231)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1453)
at org.apache.jasper.compiler.Parser.parseBody(Parser.java:1666)
at org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:996)
at org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1271)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1453)
at org.apache.jasper.compiler.Parser.parse(Parser.java:139)
at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:227)
at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:199)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:336)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:323)
like image 762
warrior107 Avatar asked Feb 25 '16 04:02

warrior107


2 Answers

You can remove session variable by using following line of code:

<c:remove var="variableName"/>
like image 115
yash Avatar answered Nov 10 '22 23:11

yash


Under Session Scope use c remove tag of Jstl

<c:remove var="var_name" scope="session" />
like image 29
Zigri2612 Avatar answered Nov 10 '22 21:11

Zigri2612