Home direction and parameter problem

Splash Forums PrettyFaces Users Home direction and parameter problem

This topic contains 4 replies, has 3 voices, and was last updated by  darkside 2 years, 2 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #26209

    darkside
    Participant

    Hi,

    I need to do that, “www.domain.com” navigate => “www.domain.com/home/”
    and “www.domain.com/username” navigate => “www.domain.com/username”

    if username param is null, than navigate homepage otherwise check userisExist…etc.

    How can i do that with mappings?

    Sorry for my english.

    Help please.

    #26212

    You probably want to use Rewrite for something as specific as this:

    http://ocpsoft.org/rewrite/
    http://ocpsoft.org/rewrite/examples/

    #26215

    darkside
    Participant

    I couldn’t understand 🙁

    Can i use this with pretty-config.xml?

    I upgrade my project to 2.0.12.Final

    pom.xml

    <dependency>
    <groupId>org.ocpsoft.rewrite</groupId>
    <artifactId>rewrite-servlet</artifactId>
    <version>2.0.12.Final</version>
    </dependency>
    <dependency>
    <groupId>org.ocpsoft.rewrite</groupId>
    <artifactId>rewrite-config-prettyfaces</artifactId>
    <version>2.0.12.Final</version>
    </dependency>

    pretty-config.xml

    ******
    <url-mapping id=”home”>
    <pattern value=”/home/” />
    <view-id value=”/index.xhtml” />
    </url-mapping>
    <url-mapping id=”userProfile”>
    <pattern value=”/#{userCode:userBean.userCode}” />
    <view-id value=”/pages/publicpages/userProfile.xhtml” />
    </url-mapping>
    ********

    web.xml header
    *****
    <?xml version=”1.0″ encoding=”UTF-8″?>
    <web-app xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221;
    xmlns=”http://java.sun.com/xml/ns/javaee&#8221;
    xsi:schemaLocation=”http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd
    id=”WebApp_ID” version=”3.0″ >

    <filter>
    <filter-name>OCPsoft Rewrite Filter</filter-name>
    <filter-class>org.ocpsoft.rewrite.servlet.RewriteFilter</filter-class>
    <async-supported>true</async-supported>
    </filter>
    <filter-mapping>
    <filter-name>OCPsoft Rewrite Filter</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>FORWARD</dispatcher>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>INCLUDE</dispatcher>
    <dispatcher>ASYNC</dispatcher>
    <dispatcher>ERROR</dispatcher>
    </filter-mapping>
    *****

    And i am working with tomcat6 v24.

    When i call a different page in my project (like login, register… ie.),

    first execute “userBean”, than navigate the my calling page.

    Sorry about my english.

    How can i fixed that?. help please.

    #26219

    What do you mean with “execute userBean”? If you use a mapping that contains a path parameter bound to the userBean, the current value from the URL will be automatically injected in your bean.

    #26220

    darkside
    Participant

    Thank you for answers,

    I found my problem. I solved.

    The problem was,

    I forgot some unused js file links in my project. Browsers calls their url and if there is no such a file, than pretty faces calls project root file.

    And my second problem was faviocon.ico. same problem with js files.

    IE & Chrome is looking for favicon and if not exist than pretty calls root page file again.

    (the requests like http://domain.com/favicon.ico and also robots.txt )

    Maybe someone has a problem like mine. I hope this helps.

    Sorry for my english.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Comments are closed.