<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    JSF學習日志2

    各種數據類型的轉換
    <h:inputText value="#{payment.amount}">
    <f:convertNumber minFractionDigits="2"/>
    </h:inputText>

    <h:inputText value="#{payment.date}">
    <f:convertDateTime pattern="MM/yyyy"/>
    </h:inputText>


    <h:outputText value="#{payment.amount}">
    <f:convertNumber type="currency"/>
    </h:outputText>


    The converter Attribute
    An alternate syntax for attaching a converter to a component is to add the converter
    attribute to the component tag. You specify the ID of the converter like this:
    <h:outputText value="#{payment.date}" converter="javax.faces.DateTime"/>
    This is equivalent to using f:convertDateTime with no attributes:
    <h:outputText value="#{payment.date}">
    <f:convertDateTime/>
    </h:outputText>
    A third way of specifying the converter would be as follows:
    <h:outputText value="#{payment.date}">
    <f:converter converterId="javax.faces.DateTime"/>
    </h:outputText>
    All JSF implementations must define a set of converters with predefined IDs:
    • javax.faces.DateTime (used by f:convertDateTime)
    • javax.faces.Number (used by f:convertNumber)
    • javax.faces.Boolean, javax.faces.Byte, javax.faces.Character, javax.faces.Double,
    javax.faces.Float, javax.faces.Integer, javax.faces.Long, javax.faces.Short (automatically
    used for primitive types and their wrapper classes)
    • javax.faces.BigDecimal, javax.faces.BigInteger (automatically used for
    BigDecimal/BigInteger)



    顯示錯誤消息,有兩種,一種是,把所有信息直接就顯示在頁面的最上面。還一種可以顯示在當前位置,像這樣
    <h:inputText id="amount" label="#{msgs.amount}" value="#{payment.amount}"/>
    <h:message for="amount"/>

    驗證,這個也可以結合上面的message使用
    <h:inputText id="amount" value="#{payment.amount}">
    <f:validateLongRange minimum="10" maximum="10000"/>
    </h:inputText>
    還有一種方法就是把這驗證寫在Bean里,像這樣
    public class PaymentBean implements Serializable {
         @Min(10) @Max(10000)
         private double amount;


    眼鏡蛇

    posted on 2014-12-08 17:54 眼鏡蛇 閱讀(105) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發表評論。


    網站導航:
    博客園   IT新聞   Chat2DB   C++博客   博問  
     
    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    導航

    統計

    常用鏈接

    留言簿(6)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 抽搐一进一出gif免费视频| 亚洲av无码专区青青草原| 免费萌白酱国产一区二区三区 | 日产久久强奸免费的看| 亚洲av产在线精品亚洲第一站| 免费人成黄页在线观看日本| 国产亚洲综合色就色| 99热这里只有精品免费播放| 免费成人av电影| 特级aa**毛片免费观看| a毛片基地免费全部视频| 亚洲国产亚洲综合在线尤物| 91免费资源网站入口| 亚洲中文字幕无码av| 免费播放特黄特色毛片| 国产免费人成视频在线播放播 | 爱丫爱丫影院在线观看免费| 久久精品视频亚洲| 无套内谢孕妇毛片免费看看 | 亚洲人成网站影音先锋播放| 亚洲码和欧洲码一码二码三码| 国产青草视频在线观看免费影院| 免费看一级一级人妻片| 亚洲日韩精品A∨片无码| 亚洲美女免费视频| 妇女自拍偷自拍亚洲精品| 在线日韩日本国产亚洲| 18以下岁毛片在免费播放| 亚洲欧美日韩一区二区三区| 亚洲一区二区三区乱码A| 久久99国产乱子伦精品免费| 亚洲熟妇无码八V在线播放| 亚洲精品一级无码鲁丝片| 99久久免费精品视频| 老子影院午夜伦不卡亚洲| 亚洲AV无码一区二区乱子伦| 无码专区永久免费AV网站| ssswww日本免费网站片| 亚洲国产成人VA在线观看| 国产AV无码专区亚洲AV麻豆丫 | 亚洲av无码无线在线观看|