Home  >  Q&A  >  body text

java - An object is set in the session, but cannot be retrieved in Jsp

Inside session

session.setAttribute("user",user);

Then get

in jsp
${user.reader_name}

I have never been able to get it, but I can get his toString return value directly from ${user}

getset has been written
HELP

我想大声告诉你我想大声告诉你2699 days ago982

reply all(4)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-06-23 09:16:28

    What you get from jsp are all strings. How can strings have attributes?
    var obj=JSON.parse("${user}")

    reply
    0
  • 滿天的星座

    滿天的星座2017-06-23 09:16:28

    Requires serialization and deserialization

    reply
    0
  • 世界只因有你

    世界只因有你2017-06-23 09:16:28

    Sorry. . . I made a strange mistake in one place
    The reader_name attribute of the object was not assigned a value at all, so its default value was used

    reply
    0
  • 欧阳克

    欧阳克2017-06-23 09:16:28

    spring and springMVC seem to work

    reply
    0
  • Cancelreply