There's no initial /org/apache/tapestry5/pages resources directory
because the (old fashioned) alternative was to place the .tml files in
the webapp (aka context) directory. That's where they appear in the
tutorial.

However that technique is no longer recommended and the .tml files
should be placed along side your java files. As to why they don't work
in the context dir ('cos they should still work there really)... I
don't know - I've never tried it! :)

The maven archetype (along with the tutorial) was written a wee while
ago now and needs updating - which is why the .tml files are in the
wrong place.

If you put your .tml files in src/main/java/... (as I saw in your
screenshot) then you're reliant on eclipse copying them over to
target/classes/... but if you put them in src/main/resources/... then
it's maven wot copies them over. And as you're using maven to launch
jetty, you're better off relying on maven to do the leg work.

But cool, I'm pleased you're now in a position to start playing around
with components and T5 in general.

T5 is an excellent piece of engineering but it is mentioned frequently
on this list that the documentation is a bit light. That maybe, but
what I find really goes in T5's favour is the quality of the code and
the way it's completely modular. Unlike other arbitrary frameworks
(e.g. in my opinion, Spring) T5 is really well written, avoids
inheritance where it can, and most answers can be found by a quick
peek in the code.

Anyhow, have fun,

Steve.

--
Steve Eynon
mobie: (+592) 678 4236



On 12 May 2010 14:16, aibkwik <phil.mcqui...@gmail.com> wrote:
>
> Hey Steve,
>
> Very interesting.
>
> I started over from scratch.
>
> Still did not work, however,
>
> when I copy (manually) my .tml files down into
> ../target/classes/org/apache/tapestry5/tutorial/pages along with my .class
> files, the damn thing worked right away.
>
> I don't even have a /src/main/resources/org/apache/tapestry5/pages
> directory.
>
> See my working file setup below...
>
> http://old.nabble.com/file/p28539377/Java%2B-%2Btutorial1_src_main_webapp_WEB-INF_Index.java%2B-%2BEclipse%2B-%2B_Users_phil.mcquitty_Documents_personal_javacode-1.jpg
>
> So I guess the question is, "why do I not get the resources directory?" and
> why don't my initial .tml files from the mvn:generate command get placed
> there?
>
> Phil
>
>
>
>
>
>
> Steve Eynon-2 wrote:
>>
>> Hi Phil,
>>
>> Now you've made me do the tutorial... (D'Oh) and yeah, it's not quite
>> as accurate as I expect it once was. But fundamentally, the principles
>> are sound.
>>
>> So again, starting from scratch, I generate the archetype.
>>
>> For the record, I'm using Maven 2.2.1 (as given by mvn -version) and
>> by default (i.e. pressing [enter]) it creates the tutorial in the
>> package : org.apache.tapestry : so we'll go with this.
>>
>> Now "org.apache.tapestry" is important, it means all your page code
>> and your page templates go in to "org.apache.tapestry.pages"
>>
>> So your Index.java and Guess.java go in to:
>>
>> /src/main/java/org/apache/tapestry/pages
>>
>> and Index.tml and Guess.tml go in:
>>
>> /src/main/resources/org/apache/tapestry/pages
>>
>> The important thing is, that once compiled, all your .class files and
>> your .tml files end up in the same place. Following our example this
>> would be:
>>
>> /target/classes/org/apache/tapestry/pages
>>
>> Note how "org.apache.tapestry.pages" is used throughout.
>>
>> I cut'n'paste'ed the java files from the tutorial and they give the
>> wrong java package of "org.apache.tapestry5.tutorial.pages" but follow
>> the eclipse hint to change it to "org.apache.tapestry.pages"
>>
>> The tutorial .tml files are fine.
>>
>> The generated web.xml is fine also, so no need to touch that.
>>
>> Despite the tutorial saying otherwise I would stick to using "mvn
>> jetty:run" for now to prevent further complicating your set up. (In
>> fact I use nothing else and still get live class re-loading but my
>> setup is probably a little more advanced.)
>>
>> In fact, start using "mvn clean jetty:run" just to make sure no stray
>> class files are hanging around.
>>
>> And that's it - it works on my machine!
>>
>> From there it's all about cut'n'pasting bits of code and not whole
>> pages. And once everything is in the correct directory it should
>> largely, just work.
>>
>> By the way, "org.apache.tapestry" is not a special package, you can
>> use what ever you want - just make sure everything is the same. i.e.
>> if use the package "foo.bar.t5" then
>>
>> .java files go in:
>> /src/main/java/foo/bar/t5/pages
>>
>> .tml files go in:
>> /src/main/resources/foo/bar/t5/pages
>>
>> so your .class and .tml files end up in:
>> /target/classes/foo/bar/t5/pages
>>
>> and make sure the "tapestry.app-package" param-value in your web.xml is
>> set to
>> foo.bar.t5
>>
>> I don't think I can say much more than that. But to be honest, if
>> Java, Eclipse, Maven and Web Apps are all new to you, then I suspect
>> you're in for rough ride and a steep learning curve whatever platform
>> you try out.
>>
>> Good luck!
>>
>> Steve.
>>
>>
>>
>>
>> On 11 May 2010 21:14:05 UTC-4, aibkwik <phil.mcqui...@gmail.com> wrote:
>>>
>>> Steve. thanks, for hangin in there, man.
>>>
>>> I have had that "ta da" moment each time I have started over from
>>> scratch.
>>>
>>> Each time I re-create my project, I follow the tutorial and actually use
>>> the
>>> exact command you specified.  (Discovered the "create" error in the
>>> tutorial
>>> (deprecated function) after a couple of hours....).
>>>
>>> It creates a project for me and going to the URL works great.  I see the
>>> time-of-day function and clicking on refresh works great.   I continue to
>>> follow the tutorial example and import the new, working project into my
>>> Eclipse.   (that's when the .tml files get separated from the .java
>>> files).
>>>
>>> Going to the URL at that point reveals the index.tml page and all looks
>>> good
>>> until you click the link.
>>>
>>> Nothing works beyond that.
>>>
>>> I checked my web.xml and did have "tutorial" instead of "tutorial5",
>>> however, making the change ended up with the same error, but gave me a
>>> new
>>> branch in my directory along with two new .class files.
>>>
>>> I'm losing steam...
>>>
>>> I feel like I should not proceed to other samples, examples, if I can not
>>> get this very simple one working.  I'm considering dropping this
>>> altogether
>>> and giving other paradigms a try.  I've seen appFuse and echo Web but was
>>> under the impression that tapestry was more settled and would be easier
>>> to
>>> learn.  I've been on this one tutorial for 3 days.... LoL...  I'm a C++
>>> programmer trying to make the switch over to Java/web and am looking for
>>> a
>>> way to avoid having to learn all the 'plumbing' required in servlet/JSP
>>> baseline programing.
>>>
>>> If you have something else you'd like me to try, I'm still game on giving
>>> it
>>> a go.
>>>
>>> Phil
>>>
>>>
>>>
>>>
>>> Steve Eynon wrote:
>>>>
>>>> Scary that the exception talks about components when it should be
>>>> looking for a page.
>>>>
>>>> What does your web.xml look like? What is your app package set to? It
>>>> should be:
>>>>
>>>> <context-param>
>>>>     <!-- The only significant configuration for Tapestry 5, this
>>>> informs Tapestry
>>>>           of where to look for pages, components and mixins. -->
>>>>     <param-name>tapestry.app-package</param-name>
>>>>     <param-value>org.apache.tapestry5.tutorial</param-value>
>>>> </context-param>
>>>>
>>>> See http://tapestry.apache.org/tapestry5.1/guide/conf.html
>>>>
>>>> Actually - if you're using maven, have you tried creating a project
>>>> from the maven archetype as mentioned on page one :
>>>> http://tapestry.apache.org/tapestry5.1/tutorial1/first.html
>>>>
>>>> To get a working app I did as follows:
>>>>
>>>>> mvn archetype:generate -DarchetypeGroupId=org.apache.tapestry
>>>>> -DarchetypeArtifactId=quickstart -DgroupId=org.apache.tapestry
>>>>> -DartifactId=tutorial1 -DpackageName=org.apache.tapestry5.tutorial
>>>>
>>>> And accepted the default settings. (Note I changed archetype:create to
>>>> archetype:generate)
>>>>
>>>>> cd tutorial1
>>>>
>>>> Edited the pom.xml at the bottom to update the Tapestry version 5.1.0.5
>>>>
>>>>> mvn jetty:run
>>>>
>>>> Open browser to: http://localhost:8080/tutorial1/
>>>>
>>>> Ta daa! That should give you a working base to start from.
>>>>
>>>> Steve.
>>>>
>>>>
>>>> On 11 May 2010 16:11, aibkwik <phil.mcqui...@gmail.com> wrote:
>>>>>
>>>>>
>>>>>
>>>>> Not sure what the current T5 deal is with putting .tml files in the
>>>>> WEB-INF, but I'm certain it's not recommended.
>>>>>
>>>>> Again, as Sergey and I have suggested, place your .tml files in the
>>>>> same package as your java / class files.
>>>>>
>>>>> With your current maven setup, that would be:
>>>>>
>>>>> src/main/resources/org/apache/tapestry5/tutorial/pages
>>>>>
>>>>> Steve.
>>>>>
>>>>>
>>>>> ----------
>>>>>
>>>>> Really embarrassing now...
>>>>>
>>>>> Forgot to mention earlier that I'd tried that already, to no avail.
>>>>> I do, however, get a different error.
>>>>>
>>>>> Here is the new file locations you suggested -
>>>>>
>>>>> http://old.nabble.com/file/p28528821/Java%2B-%2Btutorial1_src_main_java_org_apache_tapestry5_tutorial_pages_Index.java%2B-%2BEclipse%2B-%2B_Users_phil.mcquitty_Documents_personal_javacode-1.jpg
>>>>>
>>>>> ...and here is the new error -
>>>>> http://old.nabble.com/file/p28528821/Application%2BException-1.jpeg
>>>>>
>>>>> I really want to make this crazy thing work and get to a point where I
>>>>> can
>>>>> move forward.  I will understand if you guys 'cry uncle'.   I
>>>>> appreciate
>>>>> your help.
>>>>>
>>>>> Phil
>>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> For additional commands, e-mail: users-h...@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: 
> http://old.nabble.com/Noob-problem-with-Guessing-Game-tutorial-tp28519315p28539377.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to