简体   繁体   中英

JSP: Why do I get 0 instead of null in EL variable?

In servlet I do:

request.setAttribute("field-message", "Message");

In JSP I do:

<p>${field-message}</p>

I see 0 instead of "Message" in result HTML file.

What should I do to get "Message" shown there?

<p>${field-message}</p>

This is the difference between two attributes: "field" and "message". Both are nulls, so the difference is zero...

Either you choose another name for your attribute, or you use the construct <p>${requestScope['field-message']}</p>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM