Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem using Expression language in JSP page  RSS feed

 
Navkiran Kaur
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false" %>

<body bgcolor="#999966">
<%HttpSession session=request.getSession(false); %>
<div class="logo">Welcome
<%=session.getAttribute("userName")%></div>

</body>

if i use ${userName} in place of expression tag its not working..can sum explain it why??
 
Juanjo Cuadrado
Greenhorn
Posts: 18
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Try



I would recommend not to use scriptlets, but that's your choice.

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "not working"?
 
Ankit nShah
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Check the output html generated from this jsp.

might be the el is ignored. try setting isELIgnored="false" in jsp.

eg.

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" isELIgnored="false" %>

 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DisplayName AnkitShah wrote:try setting isELIgnored="false" in jsp.

There is no need to do so in a properly configure web application.
 
Ankit nShah
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

From what Navkiran has said

he is getting output for this:
<%=session.getAttribute("userName")%>

but when replacing this with EL he is not getting output.

So he is having value for this attribute in his session.

The only obvious reason becomes EL is not evaluated.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66142
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The EL will be evaluated if the deployment descriptor is properly configured. There is no need to put extra goop on each page to enable the EL.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!