如何在JSP中设置Input默认值为空?

新手上路,请多包涵

我的网页中有这么一段代码:

<c:choose>
    <c:when test="${article.author != null}">
        value="${article.author}"
    </c:when>                                               
    <c:otherwise>
        value=""                                                                   
    </c:otherwise>
</c:choose>

但是当${article.author}为空时,页面输出的结果总是value,而不是value="",这个问题有什么办法解决吗?

阅读 13.8k
1 个回答

去掉value=

修改后代码:

<c:choose>
<c:when test="${article.author != null}">
    ${article.author}
</c:when>                                               
<c:otherwise>                                                          
</c:otherwise>

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题