JSP中的EL停止评估 [英] EL in a JSP stopped evaluating

查看:115
本文介绍了JSP中的EL停止评估的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JSP页面(index.jsp)中:

In a JSP page(index.jsp):

${requestContext.requestURL} is the URL

仅显示表达式本身.它曾经被评估为" http://.../somerset/"

just shows the expression itself. It used to be evaluated to something like "http://.../somerset/"

我在Eclipse中使用maven-archetype-webapp原型创建了Maven项目. Jetty版本是jetty-6.1.14.

I created the Maven project with maven-archetype-webapp archetype in Eclipse. The Jetty version is jetty-6.1.14.

我的web.xml很简单:

My web.xml is simple:

<web-app>
    <display-name>Archetype Created Web Application</display-name>
    <servlet>
      <servlet-name>SomersetServlet</servlet-name>
      <display-name>SomersetServlet</display-name>
      <description></description>
      <servlet-class>com.foo.somerset.SomersetServlet</servlet-class>
    </servlet>
    <servlet-mapping>
      <servlet-name>SomersetServlet</servlet-name>
      <url-pattern>/som.do</url-pattern>
    </servlet-mapping>
</web-app>

推荐答案

请参见您的web.xml应该包含对web-app_2_4.xsd模式的引用,例如

Your web.xml should contain reference to web-app_2_4.xsd schema, like

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
      version="2.4">

这将启用Servlet 2.4和jsp 2.0处理,其中包括EL.

This enables servlet 2.4 and jsp 2.0 processing, which includes EL.

顺便说一句requestContext无效的隐式对象.

Btw requestContext is not valid implicit object.

这篇关于JSP中的EL停止评估的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆