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

如何在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="",这个问题有什么办法解决吗?


去掉value=

修改后代码:

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

【热门文章】
【热门文章】