SlideShare una empresa de Scribd logo
1 de 89
Descargar para leer sin conexión
Lincoln Baxter III
http://ocpsoft.com
PrettyFaces
  Simplified JSF Navigation,
  Actions, and URL-rewriting.




                                 Lincoln Baxter III
                                http://ocpsoft.com
#jaxconf #prettyfaces
         ( At this time, the audience
         is encouraged to use PDAs,
         cell phones, and other
         portable electronic
         devices... )


                                    Lincoln Baxter III
                                   http://ocpsoft.com
My Life Story.
  yawn...




                  Lincoln Baxter III
                 http://ocpsoft.com
me




      Lincoln Baxter III
     http://ocpsoft.com
/ PrettyFaces
     /   background
     /   basics
     /   navigation
     /   demos
     /   wrap-up




                       Lincoln Baxter III
                      http://ocpsoft.com
PrettyFaces is...




                     Lincoln Baxter III
                    http://ocpsoft.com
URL-rewriting.
   wtf?




                  Lincoln Baxter III
                 http://ocpsoft.com
“A URL rewriting extension for Servlet containers,
 Java EE, with optional tight-integration for JSF and
                 other frameworks.”




                                                 Lincoln Baxter III
                                                http://ocpsoft.com
http://example.com/faces/store.jsf


    http://example.com/store




                                      Lincoln Baxter III
                                     http://ocpsoft.com
URL Parameterization.
      (p14n)




                         Lincoln Baxter III
                        http://ocpsoft.com
http://example.com/store/item/Z34SD498


http://example.com/faces/item.xhtml?item=Z34SD498




                                                Lincoln Baxter III
                                               http://ocpsoft.com
Page Actions.
  w0rd!




                 Lincoln Baxter III
                http://ocpsoft.com
<action> #{storeBean.loadItem} </action>




                                            Lincoln Baxter III
                                           http://ocpsoft.com
Simplified Navigation.
      Woot.




                          Lincoln Baxter III
                         http://ocpsoft.com
“store” → http://example.com/store




                                      Lincoln Baxter III
                                     http://ocpsoft.com
Non-invasive.
  Seriously...




                  Lincoln Baxter III
                 http://ocpsoft.com
And I'll prove it...




                        Lincoln Baxter III
                       http://ocpsoft.com
/ PrettyFaces
     /   background
     /   basics
     /   navigation
     /   demos
     /   wrap-up




                       Lincoln Baxter III
                      http://ocpsoft.com
The PrettyFaces Story.
      ...again?




                          Lincoln Baxter III
                         http://ocpsoft.com
Initially
a bookmarking extension for JSF 1.2


              Grown
a feature-rich URL-rewriting solution


              Evolved
supports pure Servlet and Java EE


              Future
a JSR for URL-rewriting in Java EE
                                         Lincoln Baxter III
                                        http://ocpsoft.com
Life is good.
  :) but...




                 Lincoln Baxter III
                http://ocpsoft.com
Why Pretty URLs?
  •Build trust

  •Enhance user experience

  •Self-promote




                              Lincoln Baxter III
                             http://ocpsoft.com
/ PrettyFaces
     /   background
     /   basics
     /   navigation
     /   demos
     /   wrap-up




                       Lincoln Baxter III
                      http://ocpsoft.com
The Basics.




               Lincoln Baxter III
              http://ocpsoft.com
/ PrettyFaces
     /   background   / clean
     /   basics       / parameterize
     /   navigation   / load
     /   demos
     /   wrap-up




                                        Lincoln Baxter III
                                       http://ocpsoft.com
Clean that URL.




                   Lincoln Baxter III
                  http://ocpsoft.com
Build trust by reducing clutter.


Before:
http://example.com/news.xhtml?p=my-new-post

After:
http://example.com/news/my-new-post/




                                               Lincoln Baxter III
                                              http://ocpsoft.com
Vulnerable!
wtf?
                         Real-life:       wtf?
http://www.llbean.com/webapp/wcs/stores/servlet/CategoryDispl
   ay?categoryId=28&storeId=1&catalogId=1&langId=-
   1&nav=hp-gndp




Cluttered!                                             Lincoln Baxter III
                                                      http://ocpsoft.com
Should have been:
 http://llbean.com/kids




                           Lincoln Baxter III
                          http://ocpsoft.com
<url-mapping>
   <pattern value=”/kids” />
   <view-id value=”/webapp/wcs/stores/servlet/CategoryDisplay?categoryId=28“ />
</url-mapping>




                                                                      Lincoln Baxter III
                                                                     http://ocpsoft.com
$$$$!!!
                          or... $#@!



        A fictitious, malicious example:
http://acme.com/store
        & catCode=ZfSd41
        & lang=en_US
        & account=lincolnthree
        & autoLoginCd=S3fds94Zd03
        & oneClickPurchase=true
        & item=veryExpensive
        & redirectAfter=www.google.com?q=Have+a+nice+day+sucker!

                                                            Lincoln Baxter III
                                                           http://ocpsoft.com
Clean that URL.
   Why do you think people are afraid of buying
   used cars?




                                            Lincoln Baxter III
                                           http://ocpsoft.com
Lack of trust.




                  Lincoln Baxter III
                 http://ocpsoft.com
Every website is a “car dealership.”




                                        Lincoln Baxter III
                                       http://ocpsoft.com
Trust Me?
http://www.youtube.com/watch?v=dQw4w9WgXcQ




                                              Lincoln Baxter III
                                             http://ocpsoft.com
Trust Me.
http://www.linkedin.com/in/lincolnthree
http://twitter.com/lincolnthree
http://ocpsoft.com/prettyfaces/




                                           Lincoln Baxter III
                                          http://ocpsoft.com
A clean, readable URL:
    •Builds trust

    •Is self-promoting, benefits SEO

    •Reduces vulnerability




                                        Lincoln Baxter III
                                       http://ocpsoft.com
/ PrettyFaces
     /   background   / clean
     /   basics       / parameterize
     /   navigation   / load
     /   demos
     /   wrap-up




                                        Lincoln Baxter III
                                       http://ocpsoft.com
Parameterization.
    (p14n)




                     Lincoln Baxter III
                    http://ocpsoft.com
/ root / the / user
 •Be consistent, always.

 •Be general, progress to specific.

 •Think hard about using a query string.




                                            Lincoln Baxter III
                                           http://ocpsoft.com
The URL and p14n are:
   •Where you are, what you're looking at.

   •In the “request” scope; relevant.

   •User accessible!




                                              Lincoln Baxter III
                                             http://ocpsoft.com
Examples:
       Good :)
http://example.com/store
http://example.com/store/item/12
http://example.com/store/item/12/reviews
http://example.com/store/item/12/reviews/34



                                              Bad :(
                              http://example.com/store/12/reviews/23/item




                                                                    Lincoln Baxter III
                                                                   http://ocpsoft.com
Problem solved.
   - PrettyFaces -




                      Lincoln Baxter III
                     http://ocpsoft.com
Inject directly.


<url-mapping>
   <pattern value=”/store/item/#{ itemBean.number }” />
   <view-id value=”/faces/item.xhtml“ >
</url-mapping>




                                                           Lincoln Baxter III
                                                          http://ocpsoft.com
Add a request parameter.

                                       item.xhtml?number=#{...}
<url-mapping>
   <pattern value=”/store/item/#{ number }” />
   <view-id value=”/faces/item.xhtml” />
</url-mapping>




                                                           Lincoln Baxter III
                                                          http://ocpsoft.com
Both.


<url-mapping>
   <pattern value=”/store/item/#{ number : itemBean.number }” />
   <view-id value=”/faces/item.xhtml” />
</url-mapping>




                                                           Lincoln Baxter III
                                                          http://ocpsoft.com
/ PrettyFaces
     /   background   / clean
     /   basics       / parameterize
     /   navigation   / load
     /   demos
     /   wrap-up




                                        Lincoln Baxter III
                                       http://ocpsoft.com
Loading your data.
  •Eagerly (On construction)

  •Lazily (On access)

  •Declaratively (On event, or request)




                                           Lincoln Baxter III
                                          http://ocpsoft.com
Load declaratively!




                       Lincoln Baxter III
                      http://ocpsoft.com
Nothing fancy.


<url-mapping>
     <pattern value=”/store/item/#{itemBean.number}” />
     <view-id value=”/faces/store/view.xhtml” />
     <action> #{ currentProjectBean.load } </action>
</url-mapping>




                                                           Lincoln Baxter III
                                                          http://ocpsoft.com
You decide.


<url-mapping>
     <pattern value=”/store/item/#{itemBean.number}” />
     <view-id value=”/faces/store/view.xhtml” />
     <action phaseId=”RENDER_RESPONSE”>
         #{ currentProjectBean.load }
     </action>
</url-mapping>




                                                           Lincoln Baxter III
                                                          http://ocpsoft.com
Alternatives.
More Configuration

  2.0 view      Url Rewrite      2.0 event       1.x: requires
  params           Filter        listeners      seam or other


Lines:   +3              +8              +1+n              +4

                                                           = ~17!
PrettyFaces

                     pretty-config.xml


                                                           = ~4 :)


                                                                  Lincoln Baxter III
                                                                 http://ocpsoft.com
Annotations


@Named
@RequestScoped
@URLMapping(
              id = "barcode",
              pattern = "/#{ /[0-9]+/ barcodeBean.value }.png",
              viewId = "/barcode.jsf")

public class BarcodeBean
{
   private String value;

    @URLAction(phaseId=PhaseId.RENDER_RESPONSE)
    public void load() throws IOException
    {
        // do the work
    }
}

                                                                   Lincoln Baxter III
                                                                  http://ocpsoft.com
SeamFaces @ViewConfig
  @ViewConfig
  public interface MyAppViewConfig {

      static enum Pages {

          @ViewPattern("/admin.xhtml")
          @Admin
          ADMIN,

          @ViewPattern("/item.xhtml")
          @UrlMapping(pattern="/item/#{id}/")
          @Owner
          ITEM,

          @ViewPattern("/*")
          @FacesRedirect
          @AccessDeniedView("/denied.xhtml")
          @LoginView("/login.xhtml")
          ALL;

      }
  }

                                                 Lincoln Baxter III
                                                http://ocpsoft.com
Your own source!



com.ocpsoft.pretty.faces.spi.ConfigurationProvider




                                                      Lincoln Baxter III
                                                     http://ocpsoft.com
The Basics.
•Clean that URL! - build trust, self promote.

•Parameterize logically, in order – root the user

•Load data declaratively (Validate everything)

•You choose the configuration!

                                                     Lincoln Baxter III
                                                    http://ocpsoft.com
/ PrettyFaces
     /   background
     /   basics
     /   navigation
     /   demos
     /   wrap-up




                       Lincoln Baxter III
                      http://ocpsoft.com
History, the old
   school, JSF 1.x.




                       Lincoln Baxter III
                      http://ocpsoft.com
<navigation-rule>
   <from-view-id> * </from-view-id>
   <navigation-case>
      <from-action> * </from-action>
      <from-outcome> viewStore </from-outcome>
      <to-view-id> /faces/store/view.xhtml </to-view-id>
      <redirect />
   </navigation-case>
</navigation-rule>




<h:commandLink action=”viewStore” value=”Go to store>
   <f:setPropertyActionListener target=”#{itemBean.name}”
       value=”prettyfaces” />
</h:commandLink>




                                                        Lincoln Baxter III
                                                       http://ocpsoft.com
The new
JSF 2.0 way.




                Lincoln Baxter III
               http://ocpsoft.com
<f:metadata>
   <f:viewParam name=”item” value=”#{itemBean.number}” />
</f:metadata>




<h:link action=”/faces/item.xhtml”>
    <f:param name=”item” value=”prettyfaces”/>
</h:link>




                                                        Lincoln Baxter III
                                                       http://ocpsoft.com
The pretty
way to get around.




                      Lincoln Baxter III
                     http://ocpsoft.com
That Same Configuration.
                   The Mapping ID:



<url-mapping id=”viewStore”>
     <pattern value=”/store/item/#{ item : itemBean.number }” />
     <view-id value=”/faces/item.xhtml” />
</url-mapping>




                  <pretty:link mappingId=”viewStore”>
                      <f:param value=”prettyfaces”/>
                  </pretty:link>
                         Renders: /store/item/prettyfaces


                                                              Lincoln Baxter III
                                                             http://ocpsoft.com
Go where you want.

private String createItem()
{
    if(dao.createItem(newitem))
    {
        itemBean.setItem(newitem.getId());
        return “pretty:viewItem”;
    }
    FacesUtils.addError(“Something went wrong! Try again.”);
    return “pretty:”;
}




                                                     Lincoln Baxter III
                                                    http://ocpsoft.com
Take only what you need.
       from me




                        Lincoln Baxter III
                       http://ocpsoft.com
Or... do “nothing.”
  •Write a normal Java EE / JSF 2.0 application.

  •Add PrettyFaces outbound URL-rewriting.

  •Request-parameter mapping #{name} is power.




                                                    Lincoln Baxter III
                                                   http://ocpsoft.com
Look familiar?


<h:link outcome=”/item.xhtml”>
    <f:param name=”item” value=”prettyfaces”/>
</h:link>

                 Renders: /store/item/prettyfaces




                                                     Lincoln Baxter III
                                                    http://ocpsoft.com
http://example.com/store/item/23


 inbound                                         outbound



    <url-mapping id=”viewStore”>
         <pattern value=”/item/#{ item }” />
         <view-id value=”/faces/item.xhtml” />
    </url-mapping>




http://example.com/faces/item.xhtml ? item=23

                                                  Lincoln Baxter III
                                                 http://ocpsoft.com
In summary.
•You do not need to use pretty-navigation or links.

•But they're there if you want them

•PrettyFaces is non-invasive... seriously.




                                                 Lincoln Baxter III
                                                http://ocpsoft.com
And I'll prove it...




                        Lincoln Baxter III
                       http://ocpsoft.com
/ PrettyFaces
     /   background
     /   basics
     /   navigation
     /   demos
     /   wrap-up




                       Lincoln Baxter III
                      http://ocpsoft.com
Awesome demos!
   Yayayayayay!!!




                     Lincoln Baxter III
                    http://ocpsoft.com
/ PrettyFaces
     / background
     / basics
     / navigation
     / demos ? plan for
         change=true
     / wrap-up



                           Lincoln Baxter III
                          http://ocpsoft.com
Plan for Change



                   Lincoln Baxter III
                  http://ocpsoft.com
.xhtml
  .do
 .asp
  .jsp

  /
 .php
  .cgi
  .jsf
   .rb
/ PrettyFaces
     /   background
     /   basics
     /   navigation
     /   demos
     /   wrap-up




                       Lincoln Baxter III
                      http://ocpsoft.com
PrettyFaces in two minutes.
         “A masterpiece.” ~non-fictional user.




                                                  Lincoln Baxter III
                                                 http://ocpsoft.com
Add PrettyFaces
            via Maven.


<dependency>
   <groupId>com.ocpsoft</groupId>
   <artifactId>prettyfaces-jsf2</artifactId>
   <version>${most-recent-version}</version>
</dependency>



                       Yeah this works with pure Servlets,
                       too. I know...


                                                     Lincoln Baxter III
                                                    http://ocpsoft.com
Add PrettyFaces
                 via Seam Forge.
$ forge git-plugin
   git://github.com/ocpsoft/prettyfaces-forge-plugin.git

$ setup prettyfaces

$ prettyfaces mapping –pattern {...} --resource {...}




                                                    Lincoln Baxter III
                                                   http://ocpsoft.com
Map something.
Create /WEB-INF/pretty-config.xml

  <pretty-config>

    <!-- Begin Mappings -->
    <url-mapping id="home">
       <pattern value="/home" />
       <view-id value="/faces/home.jsf" >
    </url-mapping>

    <url-mapping id="viewComment">
       <pattern value="/story/#{myBean.currentStoryId}/#{myBean.commentId}" />
       <view-id value="/faces/story/comment.jsf" >
    </url-mapping>

  </pretty-config>




                                                                                  Lincoln Baxter III
                                                                                 http://ocpsoft.com
Make it work.
                   Take action ;)

<pretty-config>

  <!-- Begin Mappings -->
  <url-mapping id="home">
     <pattern value="/home" />
     <view-id value="/faces/home.jsf”>
     <action> #{homeBean.loadUserLayout} </action>
  </url-mapping>

  <url-mapping id="viewComment">
     <pattern value="/story/#{myBean.currentStoryId}/#{myBean.commentId}" />
     <view-id value="/faces/story/comment.jsf” />
  </url-mapping>

</pretty-config>




                                                                                Lincoln Baxter III
                                                                               http://ocpsoft.com
Navigate.
         ../viewComment.jsf

<html xmlns:pretty="http://ocpsoft.com/prettyfaces" >

<pretty:link mappingId="comment">
        <f:param value="23" />
        <f:param value="5" />
        Go to Comment. (This is Link Text)
</pretty:link>

<h:link outcome="pretty:comment">
        <f:param name="sid" value="#{myBean.storyId}" />
        <f:param name="cid" value="#{myBean.nextCommentId}" />
        View next comment. (This is Link Text)
</h:link>




                                                                  Lincoln Baxter III
                                                                 http://ocpsoft.com
The Site-map.
 If this presentation were a website...
<pretty-config>

      <url-mapping id="home">
              <pattern value=”/prettyfaces” />
              <view-id value=”faces/home.jsf” />
      </url-mapping>

      <url-mapping id="levelOne">
              <pattern value=”/prettyfaces/#{presBean.levelOne}” />
              <view-id value=”/faces/present.jsf” />
      </url-mapping>

      <url-mapping id="levelTwo">
              <pattern value=”/prettyfaces/#{presBean.levelOne}/#{presBean.levelTwo}” />
              <view-id value=”/faces/present.jsf” />
      </url-mapping>

</pretty-config>




                                                                                    Lincoln Baxter III
                                                                                   http://ocpsoft.com
/ PrettyFaces
     /   background
     /   basics
     /   navigation
     /   demo
     /   wrap-up




                       Lincoln Baxter III
                      http://ocpsoft.com
PrettyFaces is...

●
    URL-rewriting
●
    URL-parameterization
●
    Action-framework for JSF (Servlet soon)
●
    Navigation framework for JSF (Servlet soon)
●
    Extendable, configurable (SPI is growing!)
●
    Waiting for your ideas!


                                                   Lincoln Baxter III
                                                  http://ocpsoft.com
Get Involved!
            Get Started
   http://ocpsoft.com/prettyfaces/


             Get Help
    http://ocpsoft.com/support/


           Get the code!
http://github.com/ocpsoft/prettyfaces


                                         Lincoln Baxter III
                                        http://ocpsoft.com
PrettyFaces is...



“Beautiful Java EE: URL-rewriting for the next
              generation web-user”




                                          Lincoln Baxter III
                                         http://ocpsoft.com
“wtf?”
Questions.
 I've been talking for nearly an hour; please,
somebody say something.




                                           Lincoln Baxter III
                                          http://ocpsoft.com

Más contenido relacionado

Último

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 

Último (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Destacado

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destacado (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

PrettyFaces: Simplified JSF Navigation, Actions, and URL-rewriting: Lincoln Baxter III

  • 2. PrettyFaces Simplified JSF Navigation, Actions, and URL-rewriting. Lincoln Baxter III http://ocpsoft.com
  • 3. #jaxconf #prettyfaces ( At this time, the audience is encouraged to use PDAs, cell phones, and other portable electronic devices... ) Lincoln Baxter III http://ocpsoft.com
  • 4. My Life Story. yawn... Lincoln Baxter III http://ocpsoft.com
  • 5. me Lincoln Baxter III http://ocpsoft.com
  • 6. / PrettyFaces / background / basics / navigation / demos / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 7. PrettyFaces is... Lincoln Baxter III http://ocpsoft.com
  • 8. URL-rewriting. wtf? Lincoln Baxter III http://ocpsoft.com
  • 9. “A URL rewriting extension for Servlet containers, Java EE, with optional tight-integration for JSF and other frameworks.” Lincoln Baxter III http://ocpsoft.com
  • 10. http://example.com/faces/store.jsf http://example.com/store Lincoln Baxter III http://ocpsoft.com
  • 11. URL Parameterization. (p14n) Lincoln Baxter III http://ocpsoft.com
  • 13. Page Actions. w0rd! Lincoln Baxter III http://ocpsoft.com
  • 14. <action> #{storeBean.loadItem} </action> Lincoln Baxter III http://ocpsoft.com
  • 15. Simplified Navigation. Woot. Lincoln Baxter III http://ocpsoft.com
  • 16. “store” → http://example.com/store Lincoln Baxter III http://ocpsoft.com
  • 17. Non-invasive. Seriously... Lincoln Baxter III http://ocpsoft.com
  • 18. And I'll prove it... Lincoln Baxter III http://ocpsoft.com
  • 19. / PrettyFaces / background / basics / navigation / demos / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 20. The PrettyFaces Story. ...again? Lincoln Baxter III http://ocpsoft.com
  • 21. Initially a bookmarking extension for JSF 1.2 Grown a feature-rich URL-rewriting solution Evolved supports pure Servlet and Java EE Future a JSR for URL-rewriting in Java EE Lincoln Baxter III http://ocpsoft.com
  • 22. Life is good. :) but... Lincoln Baxter III http://ocpsoft.com
  • 23. Why Pretty URLs? •Build trust •Enhance user experience •Self-promote Lincoln Baxter III http://ocpsoft.com
  • 24. / PrettyFaces / background / basics / navigation / demos / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 25. The Basics. Lincoln Baxter III http://ocpsoft.com
  • 26. / PrettyFaces / background / clean / basics / parameterize / navigation / load / demos / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 27. Clean that URL. Lincoln Baxter III http://ocpsoft.com
  • 28. Build trust by reducing clutter. Before: http://example.com/news.xhtml?p=my-new-post After: http://example.com/news/my-new-post/ Lincoln Baxter III http://ocpsoft.com
  • 29. Vulnerable! wtf? Real-life: wtf? http://www.llbean.com/webapp/wcs/stores/servlet/CategoryDispl ay?categoryId=28&storeId=1&catalogId=1&langId=- 1&nav=hp-gndp Cluttered! Lincoln Baxter III http://ocpsoft.com
  • 30. Should have been: http://llbean.com/kids Lincoln Baxter III http://ocpsoft.com
  • 31. <url-mapping> <pattern value=”/kids” /> <view-id value=”/webapp/wcs/stores/servlet/CategoryDisplay?categoryId=28“ /> </url-mapping> Lincoln Baxter III http://ocpsoft.com
  • 32. $$$$!!! or... $#@! A fictitious, malicious example: http://acme.com/store & catCode=ZfSd41 & lang=en_US & account=lincolnthree & autoLoginCd=S3fds94Zd03 & oneClickPurchase=true & item=veryExpensive & redirectAfter=www.google.com?q=Have+a+nice+day+sucker! Lincoln Baxter III http://ocpsoft.com
  • 33. Clean that URL. Why do you think people are afraid of buying used cars? Lincoln Baxter III http://ocpsoft.com
  • 34. Lack of trust. Lincoln Baxter III http://ocpsoft.com
  • 35. Every website is a “car dealership.” Lincoln Baxter III http://ocpsoft.com
  • 36. Trust Me? http://www.youtube.com/watch?v=dQw4w9WgXcQ Lincoln Baxter III http://ocpsoft.com
  • 38. A clean, readable URL: •Builds trust •Is self-promoting, benefits SEO •Reduces vulnerability Lincoln Baxter III http://ocpsoft.com
  • 39. / PrettyFaces / background / clean / basics / parameterize / navigation / load / demos / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 40. Parameterization. (p14n) Lincoln Baxter III http://ocpsoft.com
  • 41. / root / the / user •Be consistent, always. •Be general, progress to specific. •Think hard about using a query string. Lincoln Baxter III http://ocpsoft.com
  • 42. The URL and p14n are: •Where you are, what you're looking at. •In the “request” scope; relevant. •User accessible! Lincoln Baxter III http://ocpsoft.com
  • 43. Examples: Good :) http://example.com/store http://example.com/store/item/12 http://example.com/store/item/12/reviews http://example.com/store/item/12/reviews/34 Bad :( http://example.com/store/12/reviews/23/item Lincoln Baxter III http://ocpsoft.com
  • 44. Problem solved. - PrettyFaces - Lincoln Baxter III http://ocpsoft.com
  • 45. Inject directly. <url-mapping> <pattern value=”/store/item/#{ itemBean.number }” /> <view-id value=”/faces/item.xhtml“ > </url-mapping> Lincoln Baxter III http://ocpsoft.com
  • 46. Add a request parameter. item.xhtml?number=#{...} <url-mapping> <pattern value=”/store/item/#{ number }” /> <view-id value=”/faces/item.xhtml” /> </url-mapping> Lincoln Baxter III http://ocpsoft.com
  • 47. Both. <url-mapping> <pattern value=”/store/item/#{ number : itemBean.number }” /> <view-id value=”/faces/item.xhtml” /> </url-mapping> Lincoln Baxter III http://ocpsoft.com
  • 48. / PrettyFaces / background / clean / basics / parameterize / navigation / load / demos / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 49. Loading your data. •Eagerly (On construction) •Lazily (On access) •Declaratively (On event, or request) Lincoln Baxter III http://ocpsoft.com
  • 50. Load declaratively! Lincoln Baxter III http://ocpsoft.com
  • 51. Nothing fancy. <url-mapping> <pattern value=”/store/item/#{itemBean.number}” /> <view-id value=”/faces/store/view.xhtml” /> <action> #{ currentProjectBean.load } </action> </url-mapping> Lincoln Baxter III http://ocpsoft.com
  • 52. You decide. <url-mapping> <pattern value=”/store/item/#{itemBean.number}” /> <view-id value=”/faces/store/view.xhtml” /> <action phaseId=”RENDER_RESPONSE”> #{ currentProjectBean.load } </action> </url-mapping> Lincoln Baxter III http://ocpsoft.com
  • 53. Alternatives. More Configuration 2.0 view Url Rewrite 2.0 event 1.x: requires params Filter listeners seam or other Lines: +3 +8 +1+n +4 = ~17! PrettyFaces pretty-config.xml = ~4 :) Lincoln Baxter III http://ocpsoft.com
  • 54. Annotations @Named @RequestScoped @URLMapping( id = "barcode", pattern = "/#{ /[0-9]+/ barcodeBean.value }.png", viewId = "/barcode.jsf") public class BarcodeBean { private String value; @URLAction(phaseId=PhaseId.RENDER_RESPONSE) public void load() throws IOException { // do the work } } Lincoln Baxter III http://ocpsoft.com
  • 55. SeamFaces @ViewConfig @ViewConfig public interface MyAppViewConfig { static enum Pages { @ViewPattern("/admin.xhtml") @Admin ADMIN, @ViewPattern("/item.xhtml") @UrlMapping(pattern="/item/#{id}/") @Owner ITEM, @ViewPattern("/*") @FacesRedirect @AccessDeniedView("/denied.xhtml") @LoginView("/login.xhtml") ALL; } } Lincoln Baxter III http://ocpsoft.com
  • 57. The Basics. •Clean that URL! - build trust, self promote. •Parameterize logically, in order – root the user •Load data declaratively (Validate everything) •You choose the configuration! Lincoln Baxter III http://ocpsoft.com
  • 58. / PrettyFaces / background / basics / navigation / demos / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 59. History, the old school, JSF 1.x. Lincoln Baxter III http://ocpsoft.com
  • 60. <navigation-rule> <from-view-id> * </from-view-id> <navigation-case> <from-action> * </from-action> <from-outcome> viewStore </from-outcome> <to-view-id> /faces/store/view.xhtml </to-view-id> <redirect /> </navigation-case> </navigation-rule> <h:commandLink action=”viewStore” value=”Go to store> <f:setPropertyActionListener target=”#{itemBean.name}” value=”prettyfaces” /> </h:commandLink> Lincoln Baxter III http://ocpsoft.com
  • 61. The new JSF 2.0 way. Lincoln Baxter III http://ocpsoft.com
  • 62. <f:metadata> <f:viewParam name=”item” value=”#{itemBean.number}” /> </f:metadata> <h:link action=”/faces/item.xhtml”> <f:param name=”item” value=”prettyfaces”/> </h:link> Lincoln Baxter III http://ocpsoft.com
  • 63. The pretty way to get around. Lincoln Baxter III http://ocpsoft.com
  • 64. That Same Configuration. The Mapping ID: <url-mapping id=”viewStore”> <pattern value=”/store/item/#{ item : itemBean.number }” /> <view-id value=”/faces/item.xhtml” /> </url-mapping> <pretty:link mappingId=”viewStore”> <f:param value=”prettyfaces”/> </pretty:link> Renders: /store/item/prettyfaces Lincoln Baxter III http://ocpsoft.com
  • 65. Go where you want. private String createItem() { if(dao.createItem(newitem)) { itemBean.setItem(newitem.getId()); return “pretty:viewItem”; } FacesUtils.addError(“Something went wrong! Try again.”); return “pretty:”; } Lincoln Baxter III http://ocpsoft.com
  • 66. Take only what you need. from me Lincoln Baxter III http://ocpsoft.com
  • 67. Or... do “nothing.” •Write a normal Java EE / JSF 2.0 application. •Add PrettyFaces outbound URL-rewriting. •Request-parameter mapping #{name} is power. Lincoln Baxter III http://ocpsoft.com
  • 68. Look familiar? <h:link outcome=”/item.xhtml”> <f:param name=”item” value=”prettyfaces”/> </h:link> Renders: /store/item/prettyfaces Lincoln Baxter III http://ocpsoft.com
  • 69. http://example.com/store/item/23 inbound outbound <url-mapping id=”viewStore”> <pattern value=”/item/#{ item }” /> <view-id value=”/faces/item.xhtml” /> </url-mapping> http://example.com/faces/item.xhtml ? item=23 Lincoln Baxter III http://ocpsoft.com
  • 70. In summary. •You do not need to use pretty-navigation or links. •But they're there if you want them •PrettyFaces is non-invasive... seriously. Lincoln Baxter III http://ocpsoft.com
  • 71. And I'll prove it... Lincoln Baxter III http://ocpsoft.com
  • 72. / PrettyFaces / background / basics / navigation / demos / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 73. Awesome demos! Yayayayayay!!! Lincoln Baxter III http://ocpsoft.com
  • 74. / PrettyFaces / background / basics / navigation / demos ? plan for change=true / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 75. Plan for Change Lincoln Baxter III http://ocpsoft.com
  • 76. .xhtml .do .asp .jsp / .php .cgi .jsf .rb
  • 77. / PrettyFaces / background / basics / navigation / demos / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 78. PrettyFaces in two minutes. “A masterpiece.” ~non-fictional user. Lincoln Baxter III http://ocpsoft.com
  • 79. Add PrettyFaces via Maven. <dependency> <groupId>com.ocpsoft</groupId> <artifactId>prettyfaces-jsf2</artifactId> <version>${most-recent-version}</version> </dependency> Yeah this works with pure Servlets, too. I know... Lincoln Baxter III http://ocpsoft.com
  • 80. Add PrettyFaces via Seam Forge. $ forge git-plugin git://github.com/ocpsoft/prettyfaces-forge-plugin.git $ setup prettyfaces $ prettyfaces mapping –pattern {...} --resource {...} Lincoln Baxter III http://ocpsoft.com
  • 81. Map something. Create /WEB-INF/pretty-config.xml <pretty-config> <!-- Begin Mappings --> <url-mapping id="home"> <pattern value="/home" /> <view-id value="/faces/home.jsf" > </url-mapping> <url-mapping id="viewComment"> <pattern value="/story/#{myBean.currentStoryId}/#{myBean.commentId}" /> <view-id value="/faces/story/comment.jsf" > </url-mapping> </pretty-config> Lincoln Baxter III http://ocpsoft.com
  • 82. Make it work. Take action ;) <pretty-config> <!-- Begin Mappings --> <url-mapping id="home"> <pattern value="/home" /> <view-id value="/faces/home.jsf”> <action> #{homeBean.loadUserLayout} </action> </url-mapping> <url-mapping id="viewComment"> <pattern value="/story/#{myBean.currentStoryId}/#{myBean.commentId}" /> <view-id value="/faces/story/comment.jsf” /> </url-mapping> </pretty-config> Lincoln Baxter III http://ocpsoft.com
  • 83. Navigate. ../viewComment.jsf <html xmlns:pretty="http://ocpsoft.com/prettyfaces" > <pretty:link mappingId="comment"> <f:param value="23" /> <f:param value="5" /> Go to Comment. (This is Link Text) </pretty:link> <h:link outcome="pretty:comment"> <f:param name="sid" value="#{myBean.storyId}" /> <f:param name="cid" value="#{myBean.nextCommentId}" /> View next comment. (This is Link Text) </h:link> Lincoln Baxter III http://ocpsoft.com
  • 84. The Site-map. If this presentation were a website... <pretty-config> <url-mapping id="home"> <pattern value=”/prettyfaces” /> <view-id value=”faces/home.jsf” /> </url-mapping> <url-mapping id="levelOne"> <pattern value=”/prettyfaces/#{presBean.levelOne}” /> <view-id value=”/faces/present.jsf” /> </url-mapping> <url-mapping id="levelTwo"> <pattern value=”/prettyfaces/#{presBean.levelOne}/#{presBean.levelTwo}” /> <view-id value=”/faces/present.jsf” /> </url-mapping> </pretty-config> Lincoln Baxter III http://ocpsoft.com
  • 85. / PrettyFaces / background / basics / navigation / demo / wrap-up Lincoln Baxter III http://ocpsoft.com
  • 86. PrettyFaces is... ● URL-rewriting ● URL-parameterization ● Action-framework for JSF (Servlet soon) ● Navigation framework for JSF (Servlet soon) ● Extendable, configurable (SPI is growing!) ● Waiting for your ideas! Lincoln Baxter III http://ocpsoft.com
  • 87. Get Involved! Get Started http://ocpsoft.com/prettyfaces/ Get Help http://ocpsoft.com/support/ Get the code! http://github.com/ocpsoft/prettyfaces Lincoln Baxter III http://ocpsoft.com
  • 88. PrettyFaces is... “Beautiful Java EE: URL-rewriting for the next generation web-user” Lincoln Baxter III http://ocpsoft.com
  • 89. “wtf?” Questions. I've been talking for nearly an hour; please, somebody say something. Lincoln Baxter III http://ocpsoft.com