且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Java servlet:request.getattribute总是重新返回null。

更新时间:2023-12-03 14:20:28

        String Message = "msg";
        /*Set attribute msg of Message*/
        request.setAttribute(Message, "msg"); // so the attribute name is "msg"

...

    String s = "msg";
    if (s == request.getAttribute("Message")) // but the attribute name is not "Message"



您的属性名称不同。使用匹配的名称和更有意义的内容。


Your attribute names are different. Use names that match, and content that is more meaningful.