Sunday, October 31, 2010
Alexandria Mills Miss World 2010
Pernikahan Okan Cornelius
“Kalau untuk resepsinya kayak pesta
Friday, October 29, 2010
Film Arwah Goyang Karawang Jupe Dewi Persik
Dewi
Thursday, October 28, 2010
Letusan Merapi, Tsunami Mentawai Duka Indonesia
Miyabi di Jakarta Syuting Film
Keberadaan Miyabi di Indonesia diakui oleh ody
Sunday, October 24, 2010
Profil Klantink Juara IMB 2010
Klantink adalah kelompok musik
Juara IMB | Pemenang Indonesia Mencari Bakat Klantink
Sebagai pemenang indonesia mencari bakat alias IMB 2010,
Nia Ramadhani Ganti Nama Ramadania Ardiansyah Bakrie
Thursday, October 21, 2010
JSF 2.0 - New features (part 3 of 3)
- working example from previous post as a basis
- support for Ajax
- support for GET and creating bookmarkable URLs
This is the third post about new features that could be found in JSF 2.0 comparing to JSF 1.x. In the previous post (part 1), I described templating mechanism and simplified navigation model. In the second post (part 2), I described resource loading mechanism. In this post I would like to focus on the built in Ajax support and on possibility to create bookmarkable URLs.
Ajax support.
Ajax is a very wide issue. I would like to show only one of the simplest example - refreshing part of the page after some action. The purpose of this example is to show that using simple Ajax does not require any additional configuration or libraries.
In the sample application I have a page bikesList.xhtml. This page shows the bikes list in selected category (category is chosen in main menu on left). Some of the bikes have discount price. I have two buttons (above the displayed bikes list) acting as bike list filters. Pressing those buttons causes filtering the list and reloading it on the view. For example: if I press a button "Discount bikes" (in red box), only one bike will be shown on a list (Magnum bike with doscount price, marked by red box). If I press "All bikes" - all bikes from the category will be shown:
The idea is to reload the bike list after pressing the button, without reloading the whole page. This is done by Ajax call which is "hooked" to the buttons:
<ui:define name="content">Ajax call defined by <f:ajax render="bikesTable" /> causes reloading the corresponding part of thw page with id=bikesTable. In our case this is the list <h:dataTable id="bikesTable" ... > which shows all or filtered bikes. Simple - isn't it?
<h:commandButton actionListener="#{bikesListBean.showAllBikes}" value="#{msg['bikes.filter.all']}">
<f:ajax render="bikesTable" />
</h:commandButton>
<h:commandButton actionListener="#{bikesListBean.showDiscountBikes}" value="#{msg['bikes.filter.discount']}">
<f:ajax render="bikesTable" />
</h:commandButton>
<h:dataTable id="bikesTable" value="#{bikesListBean.bikesList}" var="b">
...
</ui:define>
Creating bookmarkable URLs (GET support).
Why do I need GET? Consider this situation: I found interesting bike in the Bike Shop. I would like to get the URL and send it to someone in order to show what I found. Quite normal thing isn't it? Unfortunately not possible in JSF 1.x because of lack of GET support. JSF 1.x is POST-centric, so passing parameters in the URL wiht GET was not possible - so I have no way to save the URL.
JSF 2.0 provided GET support by introducing so-called "view parameters". A page which uses a special component for view parameters, is able to catch incoming view parameters (they are in the URL) and update page model (i.e. fields in managed bean) with their values. Moreover standard conversion and validation of the incoming parameters is possible - just like for the POST data.
How it work in real example? Let's go back to our sample application. We have a page named bikesList.xhtml which shows all bikes. We also have a page named bikeDetails.xhtml which shows the detail of selected bike. I would like to see the particular bike and take the URL with it and send it to someone. So the bikeDetails.xhtml page will contain view parameter component:
<f:metadata>Page expects the URL parameter named bikeId, then value of this parameter is copied into the model to the field #{bikeDetails.bikeId}. For now skip <f:event .../> component - I will back to it at the end.
<f:viewParam name="bikeId" value="#{bikeDetails.bikeId}"/>
<f:event type="preRenderView" listener="#{bikeDetails.loadBike}"/>
</f:metadata>
Where those parameters are created and passed to the URL? JSF 2.0 provides two components allowing to add GET parameters to the target URL: <h:button /> and <h:link />(they work similar to the POST-centric <h:commandButton /> and <h:commandLink). In our example bikesList.xhtml page uses <h:button /> for each presented bike to construct the button which navigates us to bikeDetails.xhtml and sets bikeId as a parameter:
<h:dataTable id="bikesTable" value="#{bikesListBean.bikesList}" var="b">Notice outcome attribute and its value - it points to the target page where view parameters component is used. Simplified navigation is used here. Generated URL looks like this:
...
<h:button outcome="bikeDetails" value="#{msg['bikes.list.seebike']}">
<f:param name="bikeId" value="#{b.id}"/>
</h:button>
...
</h:dataTable>
http://localhost:8080/JSF2Features/faces/bikeDetails.xhtml?bikeId=5
We have bokkmarkable URL which can be saved and sent to other people and used later.
Solution with view parameters on bikeDetails.xhtml uses another new feature in JSF 2.0: system events. We register a special listener using the tag
<f:event type="preRenderView" listener="#{bikeDetails.loadBike}"/>
The listener is executed before the view is rendered. What is the benefit? When a view is reached, view parameter is copied into the managed bean and listener is executed and after that the whole view (page) is rendered. Our listener uses passed bikeId to load the selected bike from repository like database. When the page is rendered, the proper bike is loaded from repository and ready to be displayed - we do not have to wait for loading the data.
That's all. We are ready to test the application. After deploying application on the server and starting the server, we have to open a browser and type in URL:
Note: make sure that Java, Eclipse and Tomcat are properly installed and configured for running the project (additional configuration may be required if different directories are used).
Eclipse complete sample project is here (with all required libraries). The sample project is a ready to run application which contains all described JSF 2.0 features in first, second and this (third) post. You can also download a war file located here (just copy it inside webapps folder in Your Tomcat and start Tomcat with the script startup.bat)
Jonas Rivano Profil Foto
Berikut Biografi
Wednesday, October 20, 2010
Foto Pre Wedding Kiki Amalia Markus Horizon
JSF 2.0 - New features (part 2 of 3)
- working example from previous post as a basis
- resource loading
<h:outputText value="#{msg['top.name']}" />
WebRoot is a root of web application - in the Eclipse generated web projects it is the directory named "WebContent". Part resourceIdentifier have this structure:
resourceIdentifier defines the subdirectory structure inside WebRoot/resources/directory. And the most important part: localePrefix means that resources can be localized based on the browser's language, like message bundles. Part libraryName can be use to group resources by their type in different directories, for example "css", "images", "scripts".
Let' see how it work in a sample application. As I wrote in previous post, we used shopTemplate.xhtml file as a template page for all pages in application. The second purpose of this file (next to defining reusable parts) is to separate the structure from the presentation - template page will include all CSS files and common images files. We will use new ResourceHandler in order to load some CSS and images suitable for current browser language:
- images: we have two pictures (bike_logo.jpg and flag.gif) in sample application visible in the header - they will change depending on current browser language
- CSS: depending on current browser language, different CSS will be loaded. The only difference between loaded CSS's is footer color (just to show that CSS is really changed)
How to load such resources on the page? First we have to perform additional configuration to enable loading resources using proper localePrefix ("pl" and "en" on the screenshot above). We have to create a special localized entry named javax.faces.resource.localePrefix in a resource-bundle file. This file must be configured as message-bundle in faces-config.xml - we can not use resource bundles (used for localized messages as shown above) to put entry there:
Now we can use the resources on the shopTemplate.xhtml page:
Please note that we use here a new JSF 2.0 tag:
<h:outputStylesheet library="css" name="layout.css" />Attributes library and name correspond to the libraryName and resourceName from <resourceIdentifier> respectively.
If we want to load JS scripts we have to use additional JSF 2.0 tag: <h:outputScript ... /> wich has additional attribute named target - specifying where to render script link.
Loading images with standard tag <h:graphicImage ... /> is possible in two ways:
- using attributes library and name correspond to the libraryName and resourceName from <resourceIdentifier> respectively (like for CSS)
- using special EL expression "#{resource['images:bike_logo.jpg']}" (wartch out for letters: EL has resource word but in the WebContent there is a resources directory!)
Note about testing: in order to test if images and CSS (footer color) changes when browser language is changed, I recommend clean the browser cache and restart it completely before testing (sometimes image cache prevents from changing the image). The test result should be:
PL version:
EN version:
-------------------------------------------
Monday, October 18, 2010
Mulan Jameela Hamil Gosip
Foto prewedding Julia Perez
"Itu memang foto-foto prewed gue, tapi acara nikahnya masih lama. Enggak
Sunday, October 17, 2010
JSF 2.0 - New features (part 1 of 3)
- working "Hello World" example in JSF 2.0 as a basis (from here)
- templating with Facelets
- simplified page navigation
- bikesShop.xhtml - start page presenting information about bike shop
- bikesList.xhtml - page presenting bikes of given type
- bikeDetails.xhtml - page presenting detailed information about bike displayed on bikesList.xhtml
- BikeDataProvider.java - singleton, acts as service which belongs to business logic. Responsible for loading bikes of certain type and loading single bike with its details. For simplicity all bikes instances are created and stored inside that class.
- Bike.java - a class from the model representing single bike instance. A list of bike instances is created and used inside BikeDataProvider.java.
- BikeDetails.java, BikesList.java - managed beans used for bikeDetails.xhtml and bikesList.xhtml respectively. They call BikeDataProvider.java for loading bikes list or single bike.
Web application will have popular and standard layout - header on top, menu on left, content on righ, footer on bottom. Header will have shop's logo and name, menu will have bike types listed, content will have some information about the shop and will display bikes list for given type, footer will be empty with some background color. The whole application will look like this:
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Bike Shop 2.0</title>
</h:head>
<h:body>
<div id="container">
<div id="top">
<!-- logo and name goes here -->
</div>
<div id="leftnav">
<h:form>
<!-- links goes here -->
</h:form>
</div>
<div id="content">
<ui:insert name="content" />
</div>
<div id="footer">
####
</div>
</div>
</h:body>
</html>
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core">
<ui:composition template="shopTemplate.xhtml">
<ui:define name="content">
Lorem ipsum dolor sit amet...
</ui:define>
</ui:composition>
</html>
<navigation-rule>
<description>Welcome page to message page</description>
<from-view-id>/index.jsp</from-view-id>
<navigation-case>
<from-outcome>helloMessage</from-outcome>
<to-view-id>/message.jsp</to-view-id>
</navigation-case>
</navigation-rule>
public String getBikes(){
bikesList = ... // load some bikes
return "bikesList";
}
Album Baru Dance Company
The Dance Company merilis album anak-anak baru-baru ini. Untuk album tersebut, mereka pun mengganti nama band
Zaskia Adya Mecca Melahirkan
"Alhamdulillah...Telah lahir anak kami: Kanna Sybilla Bramantyo. Pukul 5.10 wib. Terima kasih buat doanya," tulis Hanung dalam akun Twitter-nya @hanungbramantyo.
Friday, October 15, 2010
Pernikahan Kiki Amalia
Robby Tumewu Koma
"Betul dalam keadaan koma. Pembuluh darah otaknya
Thursday, October 14, 2010
Bea Alonzo Death Threats!
NMEDA Helping you to get your life back!
This is a Sponsored Post written by me on behalf of NMEDA. All opinions are 100% mine.
There was no help before like NMEDA. I had not known of it’s existence. What is NMEDA? It describes itself as a non profit trade association - an an Association of Mobility Dealers, Manufacturers and Rehabilitation Professionals that advocates providing safe, reliable vehicles and modifications to enhance accessibility for all people. Very useful indeed for people like my grandma because NMEDA promotes safe driving and equipment for disabled people.
NMEDA is a non profit association so it does not sell anything. But they provide information especially on the right equipment, that is wheelchair etc for disabled people. One’s needs may differ from another. Hence you can’t always get the same equipment others are using. Get one that fits you. There are many NMEDA dealers so there is not a problem.
So you will know as well NMEDA and their members are required to adhere to the safety standards of the National Highway Traffic Safety Administration. NMEDA dealers are the ones who sell handicap vans and vehicle modifications for disabled people. NMEDA has The Quality Assurance Program or QAP Dealers too. The Quality Assurance Program (QAP) is the only nationally recognized accreditation program for the Adaptive Mobility Equipment Industry.
If your loved ones suffer from immobility issues, help them get their life back by introducing NMEDA to them. Whichever State you may be, you can always find NMEDA dealers.
Tuesday, October 12, 2010
Ungu Seribu Kisah Satu Hati Album Baru Download
Monday, October 11, 2010
Kasus Wilson Idol
Lantaran diduga melakukan
Sunday, October 10, 2010
Aida Saskia Diperkosa Zainudin MZ
Gaby dan Lagunya Video Trailer Sinopsis
Masih ingat kan dengan kontroversi perebutan hak lagu ini kira kira setahun lalu? lagu gaby yang fenomenal ini
Saturday, October 9, 2010
Foto Pernikahan Indra Bekti Adilla Jelita
Acara akad nikah Bekti dan Dilla akan berlangsung di Masjid Departemen
Friday, October 8, 2010
Nadine Alexandra Dewi Ames Profil Foto Putri Indonesia 2010
Raffi Ahmad Desak Yuni Shara Menikah
Putri Indonesia 2010 Malam Final
Thursday, October 7, 2010
Citra Kirana Profil Foto
Presenter Dahsyat Baru Titi Kamal
Album Baru Sheila On 7
Tuesday, October 5, 2010
Aida Saskia Gossip Foto Profil
Deddy Corbuzier Raih Merlin Awards
"Merlin Awards diberikan kepada magician yang
Gossip Jenny Cortez "Pengakuan Sang Pelacur"
Honor Jenny untuk main dalam film tersebut masih ditahan oleh pihak manajemennya, Glow