Home  >  Q&A  >  body text

java - jsp页面中这个地方得到的是null,可是为什么显示null的字符串?不应该是什么都没有吗?

item.getAccount是得到null,为什么会显示出来,不是应该是什么都没有吗?

PHP中文网PHP中文网2741 days ago226

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-04-17 17:55:57

    el expression can solve your problem.
    As for why null is displayed, I personally think it’s because of the double quotes

    reply
    0
  • 高洛峰

    高洛峰2017-04-17 17:55:57

    I don’t know the syntax of jsp. If you convert it to a string, it will be displayed naturally, or you can use || to judge it

    reply
    0
  • PHPz

    PHPz2017-04-17 17:55:57

    <%=item.getAccount() == null ? "" : item.getAccount()%>

    reply
    0
  • 怪我咯

    怪我咯2017-04-17 17:55:57

    This is the java code written in jsp. If it is null, it will definitely be displayed as null
    Shouldn’t it be done using scope${}?

    reply
    0
  • Cancelreply