• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is it possible to map URL's with independent view dir structure?

 
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible to map URL's with independent view dir structure?
If so how?

My goal is to simply point an url to a specific view file:
i.e.

to

and

to


A couple solutions I found so far where:

Solution 1

PrettyFaces
I just didn't wanted to use a third party solution.
This is my best solution so far.

Solution 2(a JSF solution):

navigation rule entries in the faces-config.xml file.

A bean is required, not a bad thing in above example but not great in combination with static navigation like:

Solution 3 (another JSF solution)

Resource Library Contracts
This forces me to work in the contracts file.


None of the solutions gave me a clear solution except prettyfaces.

Are there some elegant native JSF solutions ?
Something flexible and reusable? Something like a mvc controller i used to use in php applications. In this controller I was able to add a template file in the constructor and an content file in specific function. Custom paths where no problem.
I didn't want to use mvc nor the php language in this project.

Maybe I should go completely custom. But I just wanted to ask if there was something out of the box for this.
I'm still studying Java EE and jsf a lot, forgive me for asking a noob question. :)

Thanks a lot!
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PrettyFaces is a lightweight easy-to-use way of making "logical URLs" and bookmarkable URLs. While JSF2 added features that can make JSF URLs bookmarkable, I can't recall much it did to support the concept of abstract (logical) URLs.

Installation of PrettyFaces requires only a small amount of effort, and in modern-day versions, you can define the URL maps right on your backing beans using annotations.

I use it for almost all my JSF projects. I really don't know of anything I'd rather use.
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Indeed pretty faces was the best option. I've started using it as well.
Till so far i can't mention anything bad about it.
I like it!
Actually shouldn't PF not be a part of JSF in the first place?

Thanks a lot.



 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
PF was independently developed by Lincoln Baxter, who these days works for Red Hat/JBoss. He's been known to show up here occasionally.

I wouldn't mind it being part of core JSD, but to get it into JSF itself would probably require getting it into the JCP process and they'd probably "improve" and mangle it, as committees often do. So perhaps we're better off as it is. And, of course, if an app doesn't need it, that means that there's no deadwood if you don't include it.
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks to PF I'm finally getting my custom "design" working (mostly).

Trying to use all benefits from JSF using for example contracts, composite components and resources. It still wasn't enough for this project, for a specific purpose i still also needed an extra custom "layout" folder for custom reusable layout parts.
Now in this custom layout folder I had an xhtml file with a matching css file.
But JSF wouldn't let me use an old-fashioned relative path:

Neither JSF's way of doing stuff was helping.

Maybe I need to use a JAR file instead of my original "Layout folder"?
Or this is becuase I'm not in JSF's resources folder, right?

I wasn't going to use:

Am I right in thinking that JSF wouldn't let me think outside the JSF box at all? Using third party PF and still not being able to apply my custom design?
Should I have picked Servlets and JSP for my custom http needs?

At least with:
I can move on.

Thanks :D





 
Tim Holloway
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The technical term for custom "layout" is "skin" and skinning is a very big thing in JSF. In fact, a lot of the third-party JSF tagsets come with a set of skins pre-defined plus mechanisms for making your own.

A "link" raw html tag isn't the recommended way to handle skins in JSF2, however. There's an actual JSF2 tag for that. It's h:outputStylesheet. It works in conjunction with a standardized resource structure within the WAR.
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Allright.
The thing is that I wanted to keep the resources folder for my composite components.
I guess I would have to repend.
I'll use h:outputStylesheet.
Do you know such a third party tagset?
 
Peter Noordzij
Greenhorn
Posts: 28
jQuery Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it working the way I want to.
I am satisfied. I got the reusable css in the resources folder in the css library with different "sub" libraries.

The specific css is in the library contracts. So double swappable :)
Weird design perhaps but conveniant for me.

Thanks again!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic