The getMessageData function should be used with a prefix if no default namespace is specified

I get this error

/WEB-INF/jsp/account/index.jsp(6.0) The getMessageData function should use with a prefix if no default namespace is specified

<c:set var="messageData" scope="session" value="${usermap.getMessageData()}"/> <c:set var="scheduleData" scope="session" value="${usermap.getScheduleData()}"/> <c:set var="meetingData" scope="session" value="${usermap.getMeetingData()}"/> 

Please note that I can run the same project on the local Tomcat without errors.

The version of Tomcat on the server is "Tomcat 6.0"

+6
source share
2 answers

The problem with your code is that the local code runs on Tomcat 7, and the code runs on the server on Tomcat 6.

As soon as calling methods with parameters (those () ) is a feature of EL 2.2 (and above), and it is accompanied by containers compatible with Servlet 3.0 (thus Tomcat 7), your code runs normally locally.

As soon as this code runs on the Servlet 2.5 container (thus Tomcat 6), you get the indicated error.

However, "property-like" access (without () ) is supported by both servlet containers.

+12
source

Try the following:

 <c:set var="messageData" scope="session" value="${usermap.messageData}"/> <c:set var="scheduleData" scope="session" value="${usermap.scheduleData}"/> <c:set var="meetingData" scope="session" value="${usermap.meetingData}"/> 

The reason is that EL removes “get” and makes the first letter lowercase from your getter methods. Usually there is a field that matches the modified name of the recipient, but this is optional.

(Actually, the opposite: when you do usermap.messageData, EL will automatically convert it to usermap.getMessageData (). If this method does not exist, you will get an exception.)

+5
source

Source: https://habr.com/ru/post/954425/


All Articles