This content has been marked as final.
Show 8 replies
-
1. Re: Seam URLs and request processing
pmuir Aug 9, 2006 11:50 AM (in response to dpocock)This is a facelets-centric response:
a) when I go to a Seam URL, e.g. seam-registration/register.seam, is the URL processed by JSF or by Seam?
JSF, but Seam has hooks into JSF that do magicc) is there any direct relationship between the Seam component names (e.g. the session bean annotated with @Name("register")) and the URL /register.seam?
No, to refer to properties from register in register.seam you would have to use #{register.property}I notice that for the dvd.xhtml page in the DVD example, you explicitly point to an action by using the pages.xml - but for other pages, you have nothing in pages.xml. Why is it that you have to explicitly put this code in pages.xml for some pages and not for others?
JSF is a component based framework. pages.xml adds some action framework ability by allowing an action to be run when a page is loaded. If an action is specified in pages.xmlit is run before the page is processed. -
2. Re: Seam URLs and request processing
raja05 Aug 9, 2006 12:29 PM (in response to dpocock)The rest have been answered in the other post. Ill try and answer the one that isnt answered there.
"dpocock" wrote:
b) for the register.seam URL, does JSF/Seam simply look for a JSP file with the same name, e.g. does it look for register.jsp, or if I put the URL help.seam, does it look for help.jsp? Or is there some more complicated decision making that helps it decide which page to use or which bean to invoke?
The default View handler extension(indicated by ViewHandler.DEFAULT_SUFFIX) is .jsp. So any url that you have will get replaced with a .jsp and is looked for. If you want this to be changed, you can specify a javax.faces.DEFAULT_SUFFIX in your web.xml's init-param and give a suitable extension. -
3. Re: Seam URLs and request processing
dpocock Aug 9, 2006 5:35 PM (in response to dpocock)"raja05" wrote:
The rest have been answered in the other post. Ill try and answer the one that isnt answered there."dpocock" wrote:
b) for the register.seam URL, does JSF/Seam simply look for a JSP file with the same name, e.g. does it look for register.jsp, or if I put the URL help.seam, does it look for help.jsp? Or is there some more complicated decision making that helps it decide which page to use or which bean to invoke?
The default View handler extension(indicated by ViewHandler.DEFAULT_SUFFIX) is .jsp. So any url that you have will get replaced with a .jsp and is looked for. If you want this to be changed, you can specify a javax.faces.DEFAULT_SUFFIX in your web.xml's init-param and give a suitable extension.
Thanks for these quick responses.
On the issue of URL's, are you saying that the .seam extension is simply an arbitrary choice, and that I could just as easily use .faces, .do or even .elvis, provided that my web.xml associates such pages with the FacesServlet? Or would Seam be affected if .seam was not used? -
4. Re: Seam URLs and request processing
gavin.king Aug 9, 2006 5:54 PM (in response to dpocock)yes, .elvis is supported
-
5. Re: Seam URLs and request processing
dpocock Aug 9, 2006 6:07 PM (in response to dpocock)"gavin.king@jboss.com" wrote:
yes, .elvis is supported
and could I define a `virtual' page in pages.xml, e.g. a page that doesn't actually exist, but where the action listener would decide the page to be rendered, e.g:
<page view-id="/virtual.xhtml" action="#{switchboard.chooseAPage}" />
virtual.xhtml being non-existant, and switchboard.chooseAPage being a stateless session bean method that returns the real view-id to display.
The user would possibly enter the URL ending in /myapp/virtual.elvis, and #{switchboard.chooseAPage} might return a value such as eminem.jsp or britney.xhtml
The result of all this is that the URLs no longer have a 1-1 mapping to actual files, much like in Struts. -
6. Re: Seam URLs and request processing
gavin.king Aug 9, 2006 6:13 PM (in response to dpocock)Absolutely, this pattern is mentioned in the documentation.
-
7. Re: Seam URLs and request processing
dpocock Aug 9, 2006 9:14 PM (in response to dpocock)"gavin.king@jboss.com" wrote:
Absolutely, this pattern is mentioned in the documentation.
I tried changing my URLs to end with `.elvis' instead of `.seam'. I notice that tags like <h:commandLink> now generate URLs with the new ending. How do these tags know that I am using this new pattern? Do they just look at the current URL being processed? -
8. Re: Seam URLs and request processing
ssilvert Aug 9, 2006 10:20 PM (in response to dpocock)"dpocock" wrote:
"gavin.king@jboss.com" wrote:
Absolutely, this pattern is mentioned in the documentation.
I tried changing my URLs to end with `.elvis' instead of `.seam'. I notice that tags like <h:commandLink> now generate URLs with the new ending. How do these tags know that I am using this new pattern? Do they just look at the current URL being processed?
This is done by JSF. The tags don't know anything. They defer to the ViewHandler to build the URL. Different view handlers might do different things, but it typically does tricks like looking at the incoming request and reading your web.xml. For portlets, the URL ultimately comes from the Portal.
Stan