2015年11月30日 星期一
Oracle Forms 的過去, 現在, 與未來
Oracle Form 產品經理 Michael Ferrante 介紹 Oracle Forms 的新功能及未來發展.
Demo 的新功能:
- Color Scheme
- 在 Oracle Forms 中使用 JavaScript
- Form 11gR2 的 guiMode 功能讓 Forms Applet 和 google map 在同個 browser 中顯示。
2015年11月21日 星期六
JSF 中的 UIInput Component 也是一種 UIOutput Component. 為什麼這樣設計呢?
UIInput
元件的被設計用來顯示資料給 User 並接受請求的參數, 所以 UIInput 是 UIOutput 元件的子類別之一。參考 [1] 的說明就會清楚了.
那麼, UIInput 元件如果有使用 Converter 或者 Validator,是在那個階段執行 Converter 或者 Validator 呢? 預設是在 Process Validators 階段套用 Converter 進行型別轉換及使用 Validator 進行資料驗證。
驗證通過後發生什麼事? 如果驗證通過,JSF 會 queue 一個 ValueChangeEvent 事件,並 Broadcast 到註冊的 Listener 去。
Reference:
JSF tag 中的 binding 屬性有什麼作用呢? 何時使用?
參考 StackOverflow 中的這篇文章, 瞭解 JSF 中的 Component Binding 的功能及使用時間。
What is component binding in JSF? When it is preferred to be used?
簡單來說, 當你要在 Backing Bean 中控制 UIComponent 時, 便要使用到 Component Binding 的功能。
延伸閱讀:
2015年11月20日 星期五
查詢常用的 regexp 表示式, 如 email 的 regexp 表示式
常常為了特定常用用途的 regexp 表示式傷腦筋嗎? 像是 email. 現在, 可以到 RegExLib.com 網站去查詢.
http://regexlib.com/Search.aspx?k=email&c=1&m=-1&ps=20
Java 語言的 Regexp:
^[_A-Za-z0-9-\\+]+(\\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\\.[A-Za-z0-9]+)*(\\.[A-Za-z]{2,})$;
Ref: <a href="http://emailregex.com/#comment-1900789300">http://emailregex.com/#comment-1900789300</a>
<br>
2015年11月11日 星期三
Oracle Forms Builder 11gR2 安裝手冊
使用 Bootstrap 3 – A short and Quick Guide
使用 Bootstrap 3 – A short and Quick Guide
1. 使用 CDN 方式在 Web Application 中使用 Bootstrp 3 CSS framework
rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" integrity="sha384-aUGj/X2zp5rLCbBxumKTCw2Z50WgIr1vs/PFN4praOTvYXWlVyh2UtNUU0KAUhAX" crossorigin="anonymous">
2. Using container and container-fluid
class
3. 切割版面
- · Extra Small (xs): < 768px
- · Small (sm): >=768, <992 span="">
- · Medium (md): >=992, <1200 span="">
- · Large (lg): >= 1200
- · col-xs-n: 指定在 Extra Small 寬度下區塊的寬度為 n columns
- · col-sm-n: 指定在 Small 寬度下區塊的寬度為 n columns
- · col-md-n: 指定在 Medium 寬度下區塊的寬度為 n columns
- · col-lg-n: 指定在Large寬度下區塊的寬度為 n columns
4. Jumbotron 大型看板
5. Menu 的製作
6. Button 的樣式
- · btn btn-defualt
- · btn btn-primary
- · btn btn-success
- · btn btn-warning
- · btn btn-danger
7. Navigation Bar 的製作
- · navbar navbar-default navbar-fixed-top: 固定在上方的 navigation bar
- · navbar navbar-default navbar-bottom: 固定在下方的navigation bar
- · navbar-header: Navigation bar 的最左邊的內容。
- · nav navbar-nav: 靠右對齊的導覽元素
- · nav navbar-nav navbar-right: 靠右對齊的導覽元素
8. 表單中的控制項及其說明資訊
- · Always use form role="form" (helps improve accessibility for people using screen readers)
- · Wrap labels and form controls in div class="form-group" (needed for optimum spacing) 把 label 和 control 用 div.form-group 包在一起。
- · Add class .form-control to all textual input, textarea, and select elements。Form 中的控制項元素使用 form-control 類別
9. ICON
10. 參考資料
2015年11月10日 星期二
在 JSF Page 中如何依條件顯示特定元件
在 JSF Page 中如何依條件顯示特定元件? 例如, 當 user login 後在 nav bar 上顯示 logout icon. 若尚未login 則顯示 login icon.
請參考 Stackoverflow 中的這則討論 How to use if, else condition in jsf to display image.
可以使用的選項:
- c:if
- c:choose
- render attribute for the UIComponent
2015年11月9日 星期一
Cookie Helper
對處理 Cookie 很煩嗎? 試試這個 Cookie Helper.
原作者: Vasil Lukach, 2014/01/05
Source: http://stackoverflow.com/questions/20934016/how-to-add-cookie-in-jsf
1: public class CookieHelper {
2: public void setCookie(String name, String value, int expiry) {
3: FacesContext facesContext = FacesContext.getCurrentInstance();
4: HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
5: Cookie cookie = null;
6: Cookie[] userCookies = request.getCookies();
7: if (userCookies != null &amp;&amp; userCookies.length &gt; 0 ) {
8: for (int i = 0; i &lt; userCookies.length; i++) {
9: if (userCookies[i].getName().equals(name)) {
10: cookie = userCookies[i];
11: break;
12: }
13: }
14: }
15: if (cookie != null) {
16: cookie.setValue(value);
17: } else {
18: cookie = new Cookie(name, value);
19: cookie.setPath(request.getContextPath());
20: }
21: cookie.setMaxAge(expiry);
22: HttpServletResponse response = (HttpServletResponse) facesContext.getExternalContext().getResponse();
23: response.addCookie(cookie);
24: }
25: public Cookie getCookie(String name) {
26: FacesContext facesContext = FacesContext.getCurrentInstance();
27: HttpServletRequest request = (HttpServletRequest) facesContext.getExternalContext().getRequest();
28: Cookie cookie = null;
29: Cookie[] userCookies = request.getCookies();
30: if (userCookies != null &amp;&amp; userCookies.length &gt; 0 ) {
31: for (int i = 0; i &lt; userCookies.length; i++) {
32: if (userCookies[i].getName().equals(name)) {
33: cookie = userCookies[i];
34: return cookie;
35: }
36: }
37: }
38: return null;
39: }
40: }