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

java jstl HTML JSP

wann. 10 years, 6 months ago

去掉value=

修改后代码:


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

某月某日某某人 answered 10 years, 6 months ago

Your Answer