English 中文(简体)
如何为评价人的范围提供变数? 如何补充我自己?
原标题:How are variables made available to expression evaluator scope? how to add my own?
  • 时间:2012-05-20 17:10:54
  •  标签:
  • java
  • jsp
  • el

我正试图更多地了解联合调查小组的表述评价。 如何确定哪些变数可以用于表达方式的获取?

我有一个简单的共同财产计划(平等者是一个方便的总结)。

<% String foo = "bar"; %>
<%= ELEvaluator.evaluate("${foo}", request, pageContext) %> //-> blank
<%= ELEvaluator.evaluate("${1 + 1}", request, pageContext %> // -> 2

这些var/objs是否需要在请求中存在? 或者在Context/Evaluator上登记?

Thanks

最佳回答

。 手段

  • find a page-scope attribute named "foo" and, if not found
  • find a request-scope attribute named "foo" and, if not found
  • find a session-scope attribute named "foo" and, if not found
  • find an application-scope attribute named "foo"

因此,如果你想要向EL提供某种反对,则将其储存在适当的范围内:

pageContext.setAttribute("foo", theObject);
// or
request.setAttribute("foo", theObject);
// or
session.setAttribute("foo", theObject);
// or
servletContext.setAttribute("foo", theObject);
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签