You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Frank W. Zammetti" <fz...@omnytex.com> on 2005/08/22 06:52:47 UTC

[SHALE] Simple "getting started"-type question

Hi everyone,

I'm finally getting a little bit of time to look at Shale, with the 
intent of doing the Mailreader app under it as I offered to do a few 
weeks back... although I was thinking of writing a blog app instead 
since I wanted to re-do mine anyway, but that is neither here nor there :)

I'm looking at the use cases app, as that seemed like the logical place 
to begin... there's quite a bit in there, it's a bit overwhelming to 
start, and, after just a few minutes of browsing, I have a question 
already :)

Looking at index.jsp, I see a forward to usecases.faces.  My question 
is, where is that mapping defined?  It's obviously winding up at 
usecases.jsp, and I can see that .faces is mapped to FacesServlet in 
web.xml, so it's straight-forward to an extent, but I'm not seeing in 
the config files were something akin to a Struts path to /usecases is 
defined.  I assumed it would be in faces-config.xml, but unless I'm 
really missing something, it's not (by the way, I *DO* assume I'm 
missing something there!).

Thanks!

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [SHALE] Simple "getting started"-type question

Posted by Craig McClanahan <cr...@gmail.com>.
On 8/21/05, Frank W. Zammetti <fz...@omnytex.com> wrote:
> Hi everyone,
> 
> I'm finally getting a little bit of time to look at Shale, with the
> intent of doing the Mailreader app under it as I offered to do a few
> weeks back... although I was thinking of writing a blog app instead
> since I wanted to re-do mine anyway, but that is neither here nor there :)
> 
> I'm looking at the use cases app, as that seemed like the logical place
> to begin... there's quite a bit in there, it's a bit overwhelming to
> start, and, after just a few minutes of browsing, I have a question
> already :)
> 
> Looking at index.jsp, I see a forward to usecases.faces.  My question
> is, where is that mapping defined?  It's obviously winding up at
> usecases.jsp, and I can see that .faces is mapped to FacesServlet in
> web.xml, so it's straight-forward to an extent, but I'm not seeing in
> the config files were something akin to a Struts path to /usecases is
> defined.  I assumed it would be in faces-config.xml, but unless I'm
> really missing something, it's not (by the way, I *DO* assume I'm
> missing something there!).
> 

How nice of you to start with an easy one :-).

If you take a look at the /WEB-INF/web.xml resource for this app,
you'll see that FacesServlet (the front controller provided by JSF) is
mapped to the "*.faces" URL pattern.  Therefore, it will receive this
request and turn it into a rendering of usecases.jsp ... but not until
*after* it has established an appropriate JSF lifecycle (including a
FacesContext instance) so that all the rest of the machinery has
access to it.

The gory details are in Chapter 10 of the JSF spec, although the
various books on JSF will cover this in a more
accessible-to-developers manner.  But this turns out to be a JSF
thing, not a Shale thing, so it's worth learning how it works.

Note that JSF, like Struts, is perfectly comfortable with either
prefix mapping ("/faces/*") or extension mapping ("*.faces").  When
you use JSF components like <h:form> to set up where a form submit
goes to, you won't even need to know what mapping is being used ...
but if the mapping were changed in this particular app, the relative
URL in index.jsp would need to be changed.

> Thanks!
> 
> --
> Frank W. Zammetti

Craig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [SHALE] Simple "getting started"-type question

Posted by Craig McClanahan <cr...@gmail.com>.
On 8/21/05, David G. Friedman <hu...@ix.netcom.com> wrote:
> Frank,
> 
> I hate to try to answer a question after Craig, but from my JSF newbie point
> of view, I didn't get an answer I'd want from his letter.  So, here's my try
> to help answer your questions.  Just keep in mind I'm re-reading (2nd time
> around) a JSF book so I'm no authority.
> 
> MyFaces, JSF actually, doesn't care about action mappings, like Struts does.
> When a url comes in which maps to JSF (or Myfaces) such as a *.faces URL,
> JSF looks for a file matching that url but ending in .jsp, not .faces.
> That's how /usecases.faces maps automatically to /usecases.jsp.
> 

FWIW, the actual mechanism is a little more flexible than this.  If
you are not using JSP as your view technology, you might want to
define a different suffix (for the scenarios where you are using
extension mapping, which is the preferred approach).  For example, you
can tell JSF to map the request "index.faces" to "index.foo" instead,
by setting the following context init parameter in your webapp.

  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.foo</param-value>
  </context-param>

The default for this parameter maps to ".jsp", which suits the
majority of JSF users, but it doesn't restrict you from other
approaches.

> Why does it do that?  The mapping of *.faces allows MyFaces/JSF to do the
> JSF tricks listed in the jsp file which could include bean auto-population,
> page redirects, validations, navigations, callback functions, templates,
> etc.  A tree is made of the JSF components from that page so further visits
> to that page don't require a rull re-parse of the page.  In my opinion, JSF
> navigation seems to care more about the direction of where to navigate next
> than how to come into a page.  You'll see loads of those 'where to next'
> ideas in the faces-config.xml file as 'navigation-rule' sections.

You don't actually *have* to be specific about where the navigation
request came from, or what the outcome value are ... you can either
leave those elements out of your navigation rule, or use one of the
wildcard expressions.  An example of this can be found in the use
cases webapp:

  <navigation-rule>
    <from-view-id>*</from-view-id>
    <navigation-case>
      <from-outcome>subview$first</from-outcome>
      <to-view-id>/subview/first.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>subview$second</from-outcome>
      <to-view-id>/subview/second.jsp</to-view-id>
    </navigation-case>
    <navigation-case>
      <from-outcome>subview$third</from-outcome>
      <to-view-id>/usecases.jsp</to-view-id>
    </navigation-case>
  </navigation-rule>

This navigation rule processes the specified outcome values
("subview$first", "subview$second", or "subview$third") no matter what
page you are currently on.

> 
> A few useful tidbits of knowledge:
> 
> 1. Everything JSF starts inside the f:view tags.
> 
> 2. The *.faces don't have to map to *.jsp extension files. A servlet
> container configuration parameter allows you to specify the default
> extension to use so you could use something other than *.jsp for your actual
> files.  You can also change your incoming *.faces URL mapping to *.html to
> hide the fact that you're using JavaServer Faces.
> 
> 3. JSF can be sufficiently complicated to 'look at' if you haven't read a
> JSF tutorial or book so jumping into Shale could be even more confusing.
> Shale confuses me some and I've read a JSF book once (I'm on read #2 as I
> mentioned).
> 
> 4. There are plenty of JSF tutorials at www.jsftutorials.net. (I've read a
> few of them, I'm reading about Facelets now - kind of a 'Shale Clay'
> alternative.)  This includes a section on their front page entitled: Golden
> Collection for JSF Newbies.
> 
> 5. navigation-rules got a little confusing for me when looking at JSF with
> Tiles, especially with Shale's Tiles mapper.  I think it (Shale's Tile
> mapper) looks for a tile with a name very similar to the jsp name and if one
> isn't found, it skips tiles and looks for a regular jsp instead.  Craig
> could comment on that if I'm wrong or off slightly but I think I just read
> about that last week.
> 

The precise rules are described in the JavaDocs for the mapper class,
but they are basically:
* Strip off any suffix on the specified to-view-id
* Look up the resulting value in the Tiles definitions
* If found, navigate to that Tile
* If not found, and if the to-view-id has a leading "/", remove that
and try again
* If we still cannot find a Tile, delegate to the standard JSF
navigation handler

This basically lets you have any combination of Tile names and regular
page names as your destinations for navigation rules.

> 6. In case you need it, myfaces is at http://myfaces.apache.org.  Tomahawk
> if the name of their set of custom add-on components, which you don't need
> if you are trying out JSF.  You can just use the MyFaces (non-Tomahawk
> stuff) implementation of JavaServer Faces.
> 

Just for the record, the JSF RI is also available under an open source
license, at java.net.  Go to <https://javaserverfaces.dev.java.net/>
and accept the CDDL license terms, and you'll be able to get to the
source code.

> Regards,
> David
> 

Craig


> -----Original Message-----
> From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
> Sent: Monday, August 22, 2005 12:53 AM
> To: Struts User
> Subject: [SHALE] Simple "getting started"-type question
> 
> 
> Hi everyone,
> 
> I'm finally getting a little bit of time to look at Shale, with the
> intent of doing the Mailreader app under it as I offered to do a few
> weeks back... although I was thinking of writing a blog app instead
> since I wanted to re-do mine anyway, but that is neither here nor there :)
> 
> I'm looking at the use cases app, as that seemed like the logical place
> to begin... there's quite a bit in there, it's a bit overwhelming to
> start, and, after just a few minutes of browsing, I have a question
> already :)
> 
> Looking at index.jsp, I see a forward to usecases.faces.  My question
> is, where is that mapping defined?  It's obviously winding up at
> usecases.jsp, and I can see that .faces is mapped to FacesServlet in
> web.xml, so it's straight-forward to an extent, but I'm not seeing in
> the config files were something akin to a Struts path to /usecases is
> defined.  I assumed it would be in faces-config.xml, but unless I'm
> really missing something, it's not (by the way, I *DO* assume I'm
> missing something there!).
> 
> Thanks!
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [SHALE] Simple "getting started"-type question

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Thanks to both of you, that definitely helped.

I'm going to go read a tutorial or two now... I actually have in the 
past, and also saw some code-intensive demos at two user group meetings, 
so I thought I had at least the JSF basics in my brain already... as it 
turns out, that might not be quite true :)  And in any case, this is the 
first attempt I've made at actually getting hands-on.

Frank

David G. Friedman wrote:
> Frank,
> 
> I hate to try to answer a question after Craig, but from my JSF newbie point
> of view, I didn't get an answer I'd want from his letter.  So, here's my try
> to help answer your questions.  Just keep in mind I'm re-reading (2nd time
> around) a JSF book so I'm no authority.
> 
> MyFaces, JSF actually, doesn't care about action mappings, like Struts does.
> When a url comes in which maps to JSF (or Myfaces) such as a *.faces URL,
> JSF looks for a file matching that url but ending in .jsp, not .faces.
> That's how /usecases.faces maps automatically to /usecases.jsp.
> 
> Why does it do that?  The mapping of *.faces allows MyFaces/JSF to do the
> JSF tricks listed in the jsp file which could include bean auto-population,
> page redirects, validations, navigations, callback functions, templates,
> etc.  A tree is made of the JSF components from that page so further visits
> to that page don't require a rull re-parse of the page.  In my opinion, JSF
> navigation seems to care more about the direction of where to navigate next
> than how to come into a page.  You'll see loads of those 'where to next'
> ideas in the faces-config.xml file as 'navigation-rule' sections.
> 
> A few useful tidbits of knowledge:
> 
> 1. Everything JSF starts inside the f:view tags.
> 
> 2. The *.faces don't have to map to *.jsp extension files. A servlet
> container configuration parameter allows you to specify the default
> extension to use so you could use something other than *.jsp for your actual
> files.  You can also change your incoming *.faces URL mapping to *.html to
> hide the fact that you're using JavaServer Faces.
> 
> 3. JSF can be sufficiently complicated to 'look at' if you haven't read a
> JSF tutorial or book so jumping into Shale could be even more confusing.
> Shale confuses me some and I've read a JSF book once (I'm on read #2 as I
> mentioned).
> 
> 4. There are plenty of JSF tutorials at www.jsftutorials.net. (I've read a
> few of them, I'm reading about Facelets now - kind of a 'Shale Clay'
> alternative.)  This includes a section on their front page entitled: Golden
> Collection for JSF Newbies.
> 
> 5. navigation-rules got a little confusing for me when looking at JSF with
> Tiles, especially with Shale's Tiles mapper.  I think it (Shale's Tile
> mapper) looks for a tile with a name very similar to the jsp name and if one
> isn't found, it skips tiles and looks for a regular jsp instead.  Craig
> could comment on that if I'm wrong or off slightly but I think I just read
> about that last week.
> 
> 6. In case you need it, myfaces is at http://myfaces.apache.org.  Tomahawk
> if the name of their set of custom add-on components, which you don't need
> if you are trying out JSF.  You can just use the MyFaces (non-Tomahawk
> stuff) implementation of JavaServer Faces.
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
> Sent: Monday, August 22, 2005 12:53 AM
> To: Struts User
> Subject: [SHALE] Simple "getting started"-type question
> 
> 
> Hi everyone,
> 
> I'm finally getting a little bit of time to look at Shale, with the
> intent of doing the Mailreader app under it as I offered to do a few
> weeks back... although I was thinking of writing a blog app instead
> since I wanted to re-do mine anyway, but that is neither here nor there :)
> 
> I'm looking at the use cases app, as that seemed like the logical place
> to begin... there's quite a bit in there, it's a bit overwhelming to
> start, and, after just a few minutes of browsing, I have a question
> already :)
> 
> Looking at index.jsp, I see a forward to usecases.faces.  My question
> is, where is that mapping defined?  It's obviously winding up at
> usecases.jsp, and I can see that .faces is mapped to FacesServlet in
> web.xml, so it's straight-forward to an extent, but I'm not seeing in
> the config files were something akin to a Struts path to /usecases is
> defined.  I assumed it would be in faces-config.xml, but unless I'm
> really missing something, it's not (by the way, I *DO* assume I'm
> missing something there!).
> 
> Thanks!
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [SHALE] Simple "getting started"-type question

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Frank,

I hate to try to answer a question after Craig, but from my JSF newbie point
of view, I didn't get an answer I'd want from his letter.  So, here's my try
to help answer your questions.  Just keep in mind I'm re-reading (2nd time
around) a JSF book so I'm no authority.

MyFaces, JSF actually, doesn't care about action mappings, like Struts does.
When a url comes in which maps to JSF (or Myfaces) such as a *.faces URL,
JSF looks for a file matching that url but ending in .jsp, not .faces.
That's how /usecases.faces maps automatically to /usecases.jsp.

Why does it do that?  The mapping of *.faces allows MyFaces/JSF to do the
JSF tricks listed in the jsp file which could include bean auto-population,
page redirects, validations, navigations, callback functions, templates,
etc.  A tree is made of the JSF components from that page so further visits
to that page don't require a rull re-parse of the page.  In my opinion, JSF
navigation seems to care more about the direction of where to navigate next
than how to come into a page.  You'll see loads of those 'where to next'
ideas in the faces-config.xml file as 'navigation-rule' sections.

A few useful tidbits of knowledge:

1. Everything JSF starts inside the f:view tags.

2. The *.faces don't have to map to *.jsp extension files. A servlet
container configuration parameter allows you to specify the default
extension to use so you could use something other than *.jsp for your actual
files.  You can also change your incoming *.faces URL mapping to *.html to
hide the fact that you're using JavaServer Faces.

3. JSF can be sufficiently complicated to 'look at' if you haven't read a
JSF tutorial or book so jumping into Shale could be even more confusing.
Shale confuses me some and I've read a JSF book once (I'm on read #2 as I
mentioned).

4. There are plenty of JSF tutorials at www.jsftutorials.net. (I've read a
few of them, I'm reading about Facelets now - kind of a 'Shale Clay'
alternative.)  This includes a section on their front page entitled: Golden
Collection for JSF Newbies.

5. navigation-rules got a little confusing for me when looking at JSF with
Tiles, especially with Shale's Tiles mapper.  I think it (Shale's Tile
mapper) looks for a tile with a name very similar to the jsp name and if one
isn't found, it skips tiles and looks for a regular jsp instead.  Craig
could comment on that if I'm wrong or off slightly but I think I just read
about that last week.

6. In case you need it, myfaces is at http://myfaces.apache.org.  Tomahawk
if the name of their set of custom add-on components, which you don't need
if you are trying out JSF.  You can just use the MyFaces (non-Tomahawk
stuff) implementation of JavaServer Faces.

Regards,
David

-----Original Message-----
From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
Sent: Monday, August 22, 2005 12:53 AM
To: Struts User
Subject: [SHALE] Simple "getting started"-type question


Hi everyone,

I'm finally getting a little bit of time to look at Shale, with the
intent of doing the Mailreader app under it as I offered to do a few
weeks back... although I was thinking of writing a blog app instead
since I wanted to re-do mine anyway, but that is neither here nor there :)

I'm looking at the use cases app, as that seemed like the logical place
to begin... there's quite a bit in there, it's a bit overwhelming to
start, and, after just a few minutes of browsing, I have a question
already :)

Looking at index.jsp, I see a forward to usecases.faces.  My question
is, where is that mapping defined?  It's obviously winding up at
usecases.jsp, and I can see that .faces is mapped to FacesServlet in
web.xml, so it's straight-forward to an extent, but I'm not seeing in
the config files were something akin to a Struts path to /usecases is
defined.  I assumed it would be in faces-config.xml, but unless I'm
really missing something, it's not (by the way, I *DO* assume I'm
missing something there!).

Thanks!

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [SHALE] Simple "getting started"-type question

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
Interesting idea... I think if I wind up doing it I'd be more inclined 
to offer it to Craig as an example for Shale first though.  But in any 
case, I just haven't had the time yet to do anything aside from a little 
early exploration, so I don't know what I'm going to do first yet.  I 
still intend to do the mailreader, unless someone beats me to it, but it 
might be easier to do the blog app first because I've already written 
one, so it would strictly be a JSF/Shale learning experience, I would 
barely have to really think about the app itself, just the mechanics of 
implementing it in Shale.

Frank

David G. Friedman wrote:
> Frank,
> 
> You could always write your JSF blog with Shale and post it to a created,
> but empty (abandoned), dev.java.net JSF blog project:
> https://jsfblog.dev.java.net/
> 
> (grin)
> 
> Regards,
> David
> 
> -----Original Message-----
> From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
> Sent: Monday, August 22, 2005 12:53 AM
> To: Struts User
> Subject: [SHALE] Simple "getting started"-type question
> 
> Hi everyone,
> 
> I'm finally getting a little bit of time to look at Shale, with the
> intent of doing the Mailreader app under it as I offered to do a few
> weeks back... although I was thinking of writing a blog app instead
> since I wanted to re-do mine anyway, but that is neither here nor there :)
> 
> ... SNIPPED ....
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


RE: [SHALE] Simple "getting started"-type question

Posted by "David G. Friedman" <hu...@ix.netcom.com>.
Frank,

You could always write your JSF blog with Shale and post it to a created,
but empty (abandoned), dev.java.net JSF blog project:
https://jsfblog.dev.java.net/

(grin)

Regards,
David

-----Original Message-----
From: Frank W. Zammetti [mailto:fzlists@omnytex.com]
Sent: Monday, August 22, 2005 12:53 AM
To: Struts User
Subject: [SHALE] Simple "getting started"-type question

Hi everyone,

I'm finally getting a little bit of time to look at Shale, with the
intent of doing the Mailreader app under it as I offered to do a few
weeks back... although I was thinking of writing a blog app instead
since I wanted to re-do mine anyway, but that is neither here nor there :)

... SNIPPED ....

--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org