SlideShare uma empresa Scribd logo
1 de 89
Baixar para ler offline
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

Mais conteúdo relacionado

Último

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 

Último (20)

Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 

Destaque

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
 

Destaque (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