el expression and ognl expression (el invalidation)

 

When there is a problem with the framework, it may be due to version compatibility, etc., you can directly download the framework source code demo from the official website and run it, and test it in a pure environment. When the framework is large, the reference configuration should also be the same

 

 

 

The two have the same effect in sturts2, el will first go from the web resource object (quest, session, etc.), but not from the valuestack,

 

The original search order of EL expressions is:

 page, request, session, application, find and return.

The value stack is not within the scope of the EL expression and therefore cannot be used. However, struts2 has enhanced the request object, that is, the StrutsRequestWrapper object, which rewrites the getAttribute() method: after the request cannot be found, it is found in the value stack, so

The search order of EL expressions becomes: page, request, valueStack.findValue(), session, application.

Value stack:

root:action object

context:map---"web resource

 

 

But the el expression only needs jsp servlet version 2.4 to parse the el, (the sign that the el expression cannot be parsed is the original string display, and no value is blank if it can be parsed)

<web-app version="2.4" 

       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 

       http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

 

 

 

The jstl tag requires jstl,standar.jar

 

 

 

Sometimes el cannot be obtained due to filter problems during upgrade, only struts tags can be obtained

 

2.3.xx use this

 

<!-- Struts2 configuration-->

<filter>

        <filter-name>struts2</filter-name>

        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>

    </filter>

 

    <filter-mapping>

        <filter-name>struts2</filter-name>

        <url-pattern>/*</url-pattern>

        <dispatcher>REQUEST</dispatcher>

<dispatcher>FORWARD</dispatcher>

    </filter-mapping>

 

 

 

 

The ____ does not work:

 

This can only be used in versions lower than 2.0

 

<filter>

        <filter-name>struts2</filter-name>

        <filter-class>

           org.apache.struts2.dispatcher.FilterDispatcher

        </filter-class>

    </filter>

    <filter-mapping>

        <filter-name>struts2</filter-name>

        <url-pattern>/*</url-pattern>

<dispatcher>REQUEST</dispatcher>

<dispatcher>FORWARD</dispatcher>

    </filter-mapping>

 

 

 

There is also the need to change the tag library of sturts when upgrading, from 2.0 to 2.3

 

<?xml version="1.0" encoding="UTF-8" ?>

<!DOCTYPE struts PUBLIC

    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"

    "http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>

 

</struts>

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326174163&siteId=291194637