Marcos Sousa’s Blog

Blog sobre desenvolvimento de software
  • rss
  • Home
  • Sobre

GET em JSF é possível? É sim, com RestFaces

Marcos Sousa | November 14, 2007

É com muita alegria que eu venho informar que foi disponibilizada a primeira versão release do RestFaces. Com ele será possível fazer chamadas a ações via GET, e o melhor, para alguns casos nem precisa usar xml! É isto mesmo! Para os inimigos do xml, há algumas tags que substitui a declaração no xml, por sinal, muito parecida com Struts.

1
2
3
4
 <rest:link action="#{bean.metodo}">
Clique Aqui
<rest:param name="chave" value="JSF" property="#{bean.propriedade}"/>
</rest:link>

bom há ainda um xml para quem goste e para algums casos ele é necessário:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<ol>
    <li>&lt;rest-faces&gt;</li>
    <li>        &lt;!--</li>
    <li>        this is a filter for authentication. It work for url mapped on Faces Servlet</li>
    <li>        --&gt;</li>
    <li>    &lt;view pattern="/protected/*"&gt;</li>
    <li>        &lt;listener when="#{!authenticationBean.logged}" outcome="/login.jsp"/&gt;</li>
    <li>    &lt;/view&gt;</li>
    <li></li>
    <li>    &lt;!--</li>
    <li>    this is a on page load listener. The listener should load a category</li>
    <li>    list if it is null. This listener is a factory for the categoryList property.</li>
    <li>    --&gt;</li>
    <li>    &lt;view pattern="/home.jsp"&gt;</li>
    <li>        &lt;listener when="#{itemBean.categoryList eq null}"</li>
    <li>                  outcome="#{itemBean.categoryListFactory}"/&gt;</li>
    <li>    &lt;/view&gt;</li>
    <li></li>
    <li>    &lt;!--</li>
    <li>    this is a on page load listener. The listener should load a category</li>
    <li>     by its id and make it available on the page</li>
    <li>    --&gt;</li>
    <li>    &lt;view pattern="/items.jsp"&gt;</li>
    <li>        &lt;property param="categoryId" value="#{itemBean.categoryId}"/&gt;</li>
    <li>        &lt;listener outcome="#{itemBean.categoryLoader}"/&gt;</li>
    <li>    &lt;/view&gt;</li>
    <li></li>
    <li>    &lt;!--</li>
    <li>    this action is invoked when you call a URL like</li>
    <li>    /context/faces/search?text=hello. The rest:link component make</li>
    <li>    it easier to invoke the action: &lt;rest:link value="search"&gt;</li>
    <li>    The text property is setted to #{itemBean.text}</li>
    <li>    --&gt;</li>
    <li>    &lt;action name="search" value="#{itemBean.searchByText}"&gt;</li>
    <li>        &lt;property param="text"/&gt;</li>
    <li></li>
    <li>        &lt;navigation-case&gt;</li>
    <li>            &lt;from-outcome&gt;success&lt;/from-outcome&gt;</li>
    <li>            &lt;to-view-id&gt;/search.jsp&lt;/to-view-id&gt;</li>
    <li>        &lt;/navigation-case&gt;</li>
    <li></li>
    <li>    &lt;/action&gt;</li>
    <li></li>
    <li>&lt;/rest-faces&gt;</li>
</ol>

O RestFaces tem suporte a Facelets, JSF 1.1 e 1.2 (RI ou Myfaces), Tomcat ou Glashfish. Maiores informações visite o Site Oficial. Esta feature já havia sido anunciada para o JSF 2.0, agora o que resta a saber se este projeto será reconhecido no JCP para quando chegar a versão 2.0 não ser necessário fazer os famosos refactories!

Categories
Java, Java Server Faces
Comments rss
Comments rss
Trackback
Trackback

« JBoss Seam 2.0 released Adobe anuncia: em 10 anos 100% online »

Leave a Reply

Click here to cancel reply.

Núvens de tags

Agile Eventos Facelets GET Hibernate incompatiblidades Itext Java Java EE Java Magazine Java Server Faces JavaServer Faces Java Vídeo Magazine Jboss jboss-seam-itext Jboss Developer Studio Jboss Seam JDBC type: 7 JPA JSF linux mare marébh maré de agilidade Microsoft No Dialect mapping for JDBC type: 7 Page Actions PostGreSQL RHDS rich:fileUpload RichFaces Rich Faces RichFaces 3.2 Scrum Seam-gen Seam Framework Seam PDF Spring Spring Framework TDD URL Rewrite URL User Friendly Variable Resolver Vídeo Aula XP

Meus últimos tweets

  • Great article about the importance of sleeping. http://t.co/vfFyS1ri 15 hours ago
  • Aos participantes do Bhjs que gostariam de vir para a Globo.com, segue as outras vagas http://t.co/KjBinf4x #bhjs #beagajs 2 weeks ago
  • Se você precisa buscar dado no disco, prefira assíncrona @luciano #bhjs #beagajs http://t.co/5gCHp7P8 2 weeks ago
  • @DouglasAguiar @HerberthAmaral Porque na copa? 2 weeks ago
  • Slides da palestra 'Indo além com jQuery' #bhjs #beagajs http://t.co/wHbhaI75 2 weeks ago
  • @araujolucas na parte da frente a temperatura está melhor 2 weeks ago
  • Começando a palestra do @cmilfont no #bhjs #beagajs http://t.co/9DZt7MQj 2 weeks ago
  • @isaias_barroso @DeivissonBruno @cmilfont gula ao extremo:) 2 weeks ago
  • Palestra com insights do desenvolvimento do paparazzo #gcom #bhjs #beagajs http://t.co/7igVbtmS 2 weeks ago
  • @flavio1110 energético? 2 weeks ago

Anúcios

Categorias

  • .net
  • Agile
  • Agile Conference 2009
  • Artigos
  • Atualidades
  • c++
  • cinema
  • Django
  • DRY
  • Eventos
  • Flex
  • Formula 1
  • Hibernate
  • IDE
  • Inutilidades
  • Java
  • Java EE
  • Java Server Faces
  • Jboss Seam
  • linux
  • Mac OS
  • Microsoft
  • Open-source
  • Palestras
  • Python
  • RAD
  • RIA
  • RichFaces
  • Scrum
  • Software Livre
  • Spring
  • Spring Annotations
  • TDD
  • Testes
  • Uncategorized
  • Vídeo Aulas

Links recomendados

  • AJ Soluções
  • Ary Júnior
  • Erko Bridee
  • Fragmental
  • Fragmental TW
  • Guilherme Chapiewski
  • Handerson Frota
  • Jeveaux
  • Juliano Carniel
  • Onipresente
  • Passes de Letra
  • PortalJava.com
  • Rafael Carneiro
  • Rafael Pontes

DevMedia Post’s

Get Adobe Flash playerPlugin by wpburn.com wordpress themes
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox