按钮可用的时候显示一张彩色图片,按钮禁用时显示一张灰色图片是怎样实现的?struts2

解决方案 »

  1.   

    if(可用)
       <input type="botton".....
    if(不可用)
       <input type="botton".....
      

  2.   

    <c:choose>
         <c:when test="${可用}">
               <button bgimage="彩色">
         </c:when>     <c:otherwise>
                <button bgimage="灰色">
         </c:otherwise>
    </c:choose>
      

  3.   

    <s:if test="判断条件">
       <s:submit type="images" src="彩色图片" title=""/> 
    </s:if>
    <s:else>
       <s:submit type="images" src="灰色图片" title=""/>
    </s:else>注:title设置是按钮提示信息,不设置title="",鼠标放在图片按钮上会显示"submit"提示信息。