jsp - EL expression not evaluated -
here test servlet ;
public class eventlistservlet extends javax.servlet.http.httpservlet { protected void dopost(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { process(request, response); } protected void doget(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { process(request, response); } private void process(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { request.setattribute("name", "test1"); request.getrequestdispatcher("index.jsp").forward(request, response); } }
and test jsp ;
<html> <body> <h2>hello world!</h2> <p>${name}</p> </body> </html>
and output ${name}
it should write test1 :/ what's wrong ???
earlier versions of jsp disable el default. see: http://docs.oracle.com/cd/e19316-01/819-3669/bnajh/index.html
to enable el evaluation on page, try putting following directive @ top of jsp file:
<%@page iselignored="false" %>
Comments
Post a Comment