-----Original Message-----
From: Kenneth Litwak [mailto:[EMAIL PROTECTED]
Sent: Thursday, August 19, 2004 9:18 AM
To: Struts Users Mailing List
Subject: RE: Learning the basics
Hi Jim,
I was hoping to
avoid having to
read a book to write my first Struts app, which is basically
a small web
app to let a user search a database table according to one of
three sets
of search criteria. I thought this would be relatively simple. My
impression so far, however, is that Struts is way way way way more
complicated than I thought for this simple app. Perhaps I
should just
write it without Struts and get a book to red and try Struts
next time.
It is relatevily simple.
showSearchCriteria.do forwards to searchCriteria.jsp (The
class could
be the ForwardAction)
searchCriteria.jsp has the fields for searching in.
action goes to findRecords.do, which queries the database and forwards
the results to foundRecorrds.jsp
Ken asks: My impression is that a something.do means a web
page, like a
JSP is involved. I don't understand this part about a jsp
linking to an
action that goes to findRecords.do. What does that represent? From
what I understand to this moment, it represents a page, when
it needs to
work with a backend component to search the database. This
may be part
of the piece I'm missing.
Part may be that you also need to understand how the web works... such subtle
things as the stateless nature of the http protocol, it's tendency to not pass fields
that are empty that kind of thing.
Then on top of that... the servlet specification... then on top of that the JSP
specification, and then tieing all that together neatly, is struts..... :)
Let's see if I can simplify this a bit...
Tomcat/Websphere/Weblogic (the container) receives this URL
http://foo.com/fooApp/showIndex.do
Container looks at it, and says... okay this goes to the fooApp web app... then says
*.do.. goes to the struts servlet in fooApp.
The struts servlet goes.. hmmmm... showIndex.... strtus-config says that maps to
ShowIndexAction class...
I better call it's exectue method.. and it returns the
sucess/index/whateverYouWantToCallItForward.. struts-config says that maps to
index.jsp.... better serve that up.
And now the request processing is done, the requestor has the resource they asked for.
So, 2 jsp pages, 2 actions (If you dont use ForwardAction).
If your search criteria are really three different searches, then you
can put all three forms on one page, and use DispatchAction for the
findRecords.do action class.
I thought EJBs were complex when I first learned them, but they have
NOTHING on Struts. Thanks again.
How do you figure?
Because, at least for me (and I grant that I'm much more
at home in
the business tier than the web tier), the workflow for an EJB
(find it,
create it, call it, remove it) is somewhat straightforward.
I have yet
to get the exact mechanics of how Struts works. I've seen
a couple of
diagrams but I need something more detailed that shows the exact flow
through each little step. Do I need a Form? A FormBean? A regular
bean? When? Where? I can't figure out how to answer these
questions.
Note: this is NOT an attack on Struts. I haven't spent several days
reading about it in order to be difficult in a mailing list.
Struts may
be a great framework once one figures it out.
I would suggest that you spend more time looking at the online struts
documentation. It's how most of us learned. If you've done mostly business tier,
then it would also be a good idea to study how the Servlet/JSP specs work, and how the
HTTP protocol works. Without Servlet/JSP fundamentals and some knowledge of HTTP, you
will probably be very lost for quite some time.
Yes, you have to learn 3 technologies just to learn struts if you have never ever done
any web programming at all. This isn't struts fault... just the way the web is.
Servlets/JSP abstracts some of the HTTP protocol, Struts abstracts that.
Ken
Ken
-----Original Message-----
From: Janne Mattila [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 18, 2004 11:19 PM
To: [EMAIL PROTECTED]
Subject: RE: Learning the basics
I did not notice any book recommendations in answers to
your question,
and
frankly, I am not surprised. For learning a new technology
I prefer a
good,
well-written and well-structured book to harvesting scattered
web pages
to
critical pieces of information. Unfortunately, I have read
three books
and
can not recommend any of those to you:
Mastering Jakarta Struts: elementary stuff, contains lots of errors,
does
not tell you how to implement non-trivial UI. Most is
copy-paste from
the
apache.org documentation. Poorly structured content.
Jakarta-Struts Live: goes deeper into details and offers more
advanced
stuff. Unfortunately author's way of words (no O'Reilly style
sophistication
here) and the book's (lack of) structure mean that it is an absolute
pain to
read! Also, you end up fiddling with lots and lots of "neat"
plugins and
helper applications (StrutsTestCase etc) for days before you get
anywhere in
the actual topic.
Programming Jakarta Struts: Perhaps the best structure out of these
books.
Unfortunately also covers just the basics and contains lots of
copy-paste
from the apache documentation. It seems that the author could
not think
of
enough to write on Struts, so he blabbers on things such as "unit
testing is
good" and "performance is important". What is it with the techincal
books
and their mammoth syndrome? Does every book have to contain all the
knowledge of the author? The examples are really irritating -
incomplete
and
you wil not be able to follow them by writing your own
application piece
by
piece, the only way is to get the sources from O'Reilly and
compile them
all
since the code is so coupled. Also lot of the book concentrates on
author's
proprietary framework.
None of these was a catastrophe though, but all were a bit
"so-so"....I
have
yet to find a _really good_ book.
From: "Kenneth Litwak" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: Learning the basics
Date: Wed, 18 Aug 2004 11:22:33 -0700
If I'm an experienced developer, but new to Struts, do
I need to
buy
a book to write a basic app, or is there an online tutorial or
something
like that that is sufficient? One of the things I'd like to
figure out
is to how to have three radio buttons, and a regular button,
and have a
different action for each radio button. I can't figure out
how to wire
that. Thanks.
Ken
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
_________________________________________________________________
Add photos to your e-mail with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]