Which variables can be accessed with the ${…} syntax in a Struts tag in a JSP page?

前端 未结 1 2074
-上瘾入骨i
-上瘾入骨i 2021-01-20 16:22

I\'m getting a little bit frustrated since I can\'t find out which variables I can access with the ${...} syntax in a Struts tag, placed in a JSP page.

相关标签:
1条回答
  • 2021-01-20 16:49

    It should be placed in any of the page, request, session or application scopes using respectively JspContext#setAttribute(), ServletRequest#setAttribute(), HttpSession#setAttribute() or ServletContext#setAttribute(). You normally do that either directly or indirectly inside a Servlet. MVC frameworks do that indirectly, usually configureable by giving the model object a "request", "session" or "application" scope.

    The Expression Language (EL) will access them using JspContext#findAttribute().

    This all is by the way unrelated to Struts. It's just a legacy MVC framework which is built on top of the JSP/Servlet API. The <c:set> is not a Struts tag as well, it's a JSTL tag.

    0 讨论(0)
提交回复
热议问题