Re: Question on calling .do's directly

2004-09-12 Thread Tom Holmes Jr.
Rick Reumann wrote:
Tom Holmes Jr. wrote the following on 9/11/2004 7:02 PM:
So, I guess the only question I have is:
Is there a problem with a web-site that contains a bunch of links to 
various '.do' pages as opposed to '.jsp' pages?  Are there any 
security concerns?  Do I really want to have direct links to '.do' pages?

Remember when you are setting up a global forward and going, as you say, 
directly to a page from a .do link you are really still using a default 
FowardAction provided by Struts. You DEFINTELY want to do this (as you 
have) vs going directly to a jsp page. If you decided later you need to 
do something before you forwarded to your jsp you could easily set you 
same .do link as a mapping to go to one of your own custom actions. If 
you had bypassed this step by providing just a basic link to the jsp you 
would end up having to change your link. Bottom line is you always want 
to go through a controller (an Action class) even if it's just the 
simple ForwardAction.

If you had to call a page that needed to display data immediately, is 
this how you would do it?

What do you mean by display data immediately? You still always want to 
have your links use a struts mapping (.do or whatever you are using).
I mean back in the day when I used to do ASP pages, I could call an ASP 
page, the ASP page would open up to the database, do a select statement, 
 and build a list of results.  Then I would iterate through the 
recordset and display the data within the HTML.  Hence, everytime this 
URL was called, the data was immediately collected and displayed from 
the database.  This is something I know we can do with the sql tags 
within JSP pages, but it isn't a very good way to do things and breaks 
the whole MVC architecture.

In my case, by calling the .do directly, as you said I am calling the 
Forward Action which is using a ListBean in order to do the database 
work and get my recordset back into a collection. Then when I go to my 
View, the JSP page can display my data immediately.

And, there are going to be times when I want to call a .jsp file first, 
when I have to collect data, I just want to go that .jsp page first with 
the form and enter my data, then I can submit to the .do file for 
validation.  If I were to call the action first, since there is no data 
in any of the fields, then I would get all these errors on the first 
round.  Shouldn't that be the case?


Oh, and I was think the ApplicationResources to put in the links to
my navigation menu ... now that I see global forwards. Could I use
this to define my list of main pages for various parts of my web-site?

I usually don't put the actual links(ie. /employeeAction.do) in the 
ApplicationResources file, but I will put their names in there sometimes 
(ie link.update.employee=Update Employee). For your navigation you 
*should* only have to maintain one page for these links so maintenance 
is easy so I don't see much reason to put the links in the App resources 
file. (If you are having to copy your navigation links on to different 
pages consider using Sitemesh or Tiles. Your navigation should just be 
one page).

I agree, I did not put the action link in the ApplicationResources file, 
but as you suggested just had the name of the link.  I am taking 
advantage of the global-forwards for the navigation side-bar, and that 
lets me keep those links maintained in the struts-config.xml file.

I do have a navigation menu in each one of my folders which is a 
different part of my web-application/site.  Because of the way I display 
my images and because of the changing paths, I did it that way.  Tiles 
is a whole another API, and I do want to learn it, but I have to learn 
to walk before I can run.  So, for right now, I'll keep all my 
navigation pages, though I agree, it is difficult to maintain.

Once I get my hands around, a few more forms to Create, Retrieve, 
Update, and Delete data, then I'm going to tackle creating my own 
taglibs, then dig into Tiles, and then maybe Java Server Faces, then 
EJB's, then maybe PHP, then maybe VB.NET/ASP.NET and C#.  The .NET and 
C# sharp technologies are always at the bottom of my list.

Anyway, thanks for all the help and suggestions.  It seems the best way 
to go.  My web-site has already undergone 4-5 revisions as I learn more 
and become more saavy with Struts.

Thanks again.
  Tom
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Question on calling .do's directly

2004-09-11 Thread Tom Holmes Jr.
As many of you know, I had a problem with my Guestbook, and how to call 
a .jsp page and have it auto-submit to the URL.  As was stated, calling 
my 'guestbooklist.do' directly from the URL worked.  I decided to keep 
the form in this guestbook page so people could hit the Submit button on 
the page (which I called) refresh to update my display of the guestbook 
list.

I have a new list which I decided do differently.  I made the mapping 
with the name, type, and forward(success) to my default.jsp page.  The 
default.jsp page still contains three imports for header.jsp, 
footer.jsp, and body.jsp.  The body.jsp contains no form, just the 
c:foreach tags in order to display the data I get back from the Action.

It used to be the default.jsp was called first from my navigation menu, 
but now I call http://xxx.mydomain.net/linkslist.do directly which on 
success forwards to the default.jsp and it displays my data correctly.

So, I guess the only question I have is:
Is there a problem with a web-site that contains a bunch of links to 
various '.do' pages as opposed to '.jsp' pages?  Are there any security 
concerns?  Do I really want to have direct links to '.do' pages?

If you had to call a page that needed to display data immediately, is 
this how you would do it?

Oh, and I was think the ApplicationResources to put in the links to my 
navigation menu ... now that I see global forwards.  Could I use this to 
define my list of main pages for various parts of my web-site?

Thanks again for all the help so far, and sorry to be such a pain!
   Tom Holmes
p.s. I did try to find this out via google and a few different archival 
searches before I left a message here.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Question on calling .do's directly

2004-09-11 Thread Rick Reumann
Tom Holmes Jr. wrote the following on 9/11/2004 7:02 PM:
So, I guess the only question I have is:
Is there a problem with a web-site that contains a bunch of links to 
various '.do' pages as opposed to '.jsp' pages?  Are there any security 
concerns?  Do I really want to have direct links to '.do' pages?
Remember when you are setting up a global forward and going, as you say, 
directly to a page from a .do link you are really still using a default 
FowardAction provided by Struts. You DEFINTELY want to do this (as you 
have) vs going directly to a jsp page. If you decided later you need to 
do something before you forwarded to your jsp you could easily set you 
same .do link as a mapping to go to one of your own custom actions. If 
you had bypassed this step by providing just a basic link to the jsp you 
would end up having to change your link. Bottom line is you always want 
to go through a controller (an Action class) even if it's just the 
simple ForwardAction.

If you had to call a page that needed to display data immediately, is 
this how you would do it?
What do you mean by display data immediately? You still always want to 
have your links use a struts mapping (.do or whatever you are using).

Oh, and I was think the ApplicationResources to put in the links to
my navigation menu ... now that I see global forwards. Could I use
this to define my list of main pages for various parts of my web-site?
I usually don't put the actual links(ie. /employeeAction.do) in the 
ApplicationResources file, but I will put their names in there sometimes 
(ie link.update.employee=Update Employee). For your navigation you 
*should* only have to maintain one page for these links so maintenance 
is easy so I don't see much reason to put the links in the App resources 
file. (If you are having to copy your navigation links on to different 
pages consider using Sitemesh or Tiles. Your navigation should just be 
one page).

--
Rick
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]