RE: jsp vs do
Probably because you want to remain faithful to the MVC approach: only the controller should decide where to dispatch a request. Linking JSPs together directly can lead to a spaghetti mess. What you want is one central point where the request dispacthing is done (the ActionServlet) so you can easily change it later on for all pages containing a certain request. This is why is's better to go through the ActionServlet (using .do instead of .jsp). Your login.jsp may not need some pre-processing logic at present, but in the future you may have the requirement to do so later on, in which case you need an Action and a mapping in struts-config.xml (the MVC approach recommends that you do not put such logic directly in the login.jsp itself). Fr. -Original Message- From: Bob Byron [mailto:[EMAIL PROTECTED]] Sent: 02 July 2001 18:56 To: struts-user Subject: jsp vs do I am still in the early stages of understanding struts and would like to know a bit more about the jsp vs do extensions. In looking at the index.jsp page of the struts-example, you see two links. "Register with the MailReader Demonstration Application" links to editRegristration.do (***DO***) "Log on to the MailReader Demonstration Application" links to login.jsp (***JSP***) Why was the register page linked to a "do" instead of a "jsp" page? Why was the login page linked to a "jsp" instead of a "do"? I do understand that the "do" takes you through the struts actions, but don't understand why the login link was set to login.jsp instead of login.do initially. (I am not asking "What" it does so much as I am asking "Why" was the decision made to do it that way.) Thank You, Bob Byron __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com ***
RE: jsp vs do
Oops forget my answer, I did not read well enough the question in the first instance, sorry. Fr. -Original Message- From: Rey Francois Sent: 02 July 2001 18:56 To: '[EMAIL PROTECTED]' Subject: RE: jsp vs do Probably because you want to remain faithful to the MVC approach: only the controller should decide where to dispatch a request. Linking JSPs together directly can lead to a spaghetti mess. What you want is one central point where the request dispacthing is done (the ActionServlet) so you can easily change it later on for all pages containing a certain request. This is why is's better to go through the ActionServlet (using .do instead of .jsp). Your login.jsp may not need some pre-processing logic at present, but in the future you may have the requirement to do so later on, in which case you need an Action and a mapping in struts-config.xml (the MVC approach recommends that you do not put such logic directly in the login.jsp itself). Fr. -Original Message- From: Bob Byron [mailto:[EMAIL PROTECTED]] Sent: 02 July 2001 18:56 To: struts-user Subject: jsp vs do I am still in the early stages of understanding struts and would like to know a bit more about the jsp vs do extensions. In looking at the index.jsp page of the struts-example, you see two links. "Register with the MailReader Demonstration Application" links to editRegristration.do (***DO***) "Log on to the MailReader Demonstration Application" links to login.jsp (***JSP***) Why was the register page linked to a "do" instead of a "jsp" page? Why was the login page linked to a "jsp" instead of a "do"? I do understand that the "do" takes you through the struts actions, but don't understand why the login link was set to login.jsp instead of login.do initially. (I am not asking "What" it does so much as I am asking "Why" was the decision made to do it that way.) Thank You, Bob Byron __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ The information in this email is confidential and is intended solely for the addressee(s). Access to this email by anyone else is unauthorised. If you are not an intended recipient, you must not read, use or disseminate the information contained in the email. Any views expressed in this message are those of the individual sender, except where the sender specifically states them to be the views of Capco. http://www.capco.com ***
Re: jsp vs do
One thing to note, however, is that the internationalization ( tags) won't go to non-default mappings unless you use a *.do extension. I can't remember if our tests showed that going first to a *.do and then to a *.jsp worked or not...I don't think so. If you need to make your login screen available (to continue the example) in several languages, you need to link to the *.do version, and write your Action class in a way that either won't auto-validate the ActionForm, or won't require info up front. Tim Shadel >>> "Gregor Rayman" <[EMAIL PROTECTED]> 07/02/01 11:52AM >>> "Anthony Martin" <[EMAIL PROTECTED]> wrote: > In general, however, you can go to actions directly as long as you supply > the required fields in the url (if any). > > In the case of the struts-example, going to logon.do gives a validation > error because it was expecting the correct query string. For example: > > http://localhost/struts-example/logon.do?username=foo&password=bar > > > Anthony Yes, you can always go directly to the action, as long as you provide the necessary data. Some actions do not need any input at all. (e. g. /admin/restart.do) It wouldn't be very bad to go directly to login.do without any data, since this would simply report an error and forward to its input (login.jsp) itself. -- gR > > -Original Message- > From: Gregor Rayman [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 02, 2001 10:28 AM > To: [EMAIL PROTECTED] > Subject: Re: jsp vs do > > > "Anthony Martin" <[EMAIL PROTECTED]> wrote: > > > > This is how I understand it. A .do maps to an action then to a .jsp. If > > you link directly to a .jsp, the action never executes. Actions are > mapped > > to a .jsp in the struts-config.xml file. > > > > I'm sure there are more clear explanations to follow. > > > > > > Anthony > > DO takes you to an action which needs some input from your currently > displayed from. If you don't have yet the data necessary for the > action, you cannot go to the action. In such case you can go to > HTML or JSP, which contains the input fields you can fill out and > submit to a DO action. > > In the example application, the link goes to login.jsp, since it is > the place where you can enter the credentials. They are then validated > in a action (DO). You cannot go to the action directly, since you > do not have the username/password yet. > > -- > gR >
Re: jsp vs do
"Anthony Martin" <[EMAIL PROTECTED]> wrote: > In general, however, you can go to actions directly as long as you supply > the required fields in the url (if any). > > In the case of the struts-example, going to logon.do gives a validation > error because it was expecting the correct query string. For example: > > http://localhost/struts-example/logon.do?username=foo&password=bar > > > Anthony Yes, you can always go directly to the action, as long as you provide the necessary data. Some actions do not need any input at all. (e. g. /admin/restart.do) It wouldn't be very bad to go directly to login.do without any data, since this would simply report an error and forward to its input (login.jsp) itself. -- gR > > -Original Message- > From: Gregor Rayman [mailto:[EMAIL PROTECTED]] > Sent: Monday, July 02, 2001 10:28 AM > To: [EMAIL PROTECTED] > Subject: Re: jsp vs do > > > "Anthony Martin" <[EMAIL PROTECTED]> wrote: > > > > This is how I understand it. A .do maps to an action then to a .jsp. If > > you link directly to a .jsp, the action never executes. Actions are > mapped > > to a .jsp in the struts-config.xml file. > > > > I'm sure there are more clear explanations to follow. > > > > > > Anthony > > DO takes you to an action which needs some input from your currently > displayed from. If you don't have yet the data necessary for the > action, you cannot go to the action. In such case you can go to > HTML or JSP, which contains the input fields you can fill out and > submit to a DO action. > > In the example application, the link goes to login.jsp, since it is > the place where you can enter the credentials. They are then validated > in a action (DO). You cannot go to the action directly, since you > do not have the username/password yet. > > -- > gR >
RE: jsp vs do
In general, however, you can go to actions directly as long as you supply the required fields in the url (if any). In the case of the struts-example, going to logon.do gives a validation error because it was expecting the correct query string. For example: http://localhost/struts-example/logon.do?username=foo&password=bar Anthony -Original Message- From: Gregor Rayman [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 10:28 AM To: [EMAIL PROTECTED] Subject: Re: jsp vs do "Anthony Martin" <[EMAIL PROTECTED]> wrote: > This is how I understand it. A .do maps to an action then to a .jsp. If > you link directly to a .jsp, the action never executes. Actions are mapped > to a .jsp in the struts-config.xml file. > > I'm sure there are more clear explanations to follow. > > > Anthony DO takes you to an action which needs some input from your currently displayed from. If you don't have yet the data necessary for the action, you cannot go to the action. In such case you can go to HTML or JSP, which contains the input fields you can fill out and submit to a DO action. In the example application, the link goes to login.jsp, since it is the place where you can enter the credentials. They are then validated in a action (DO). You cannot go to the action directly, since you do not have the username/password yet. -- gR
Re: jsp vs do
"Anthony Martin" <[EMAIL PROTECTED]> wrote: > This is how I understand it. A .do maps to an action then to a .jsp. If > you link directly to a .jsp, the action never executes. Actions are mapped > to a .jsp in the struts-config.xml file. > > I'm sure there are more clear explanations to follow. > > > Anthony DO takes you to an action which needs some input from your currently displayed from. If you don't have yet the data necessary for the action, you cannot go to the action. In such case you can go to HTML or JSP, which contains the input fields you can fill out and submit to a DO action. In the example application, the link goes to login.jsp, since it is the place where you can enter the credentials. They are then validated in a action (DO). You cannot go to the action directly, since you do not have the username/password yet. -- gR
RE: jsp vs do
This is how I understand it. A .do maps to an action then to a .jsp. If you link directly to a .jsp, the action never executes. Actions are mapped to a .jsp in the struts-config.xml file. I'm sure there are more clear explanations to follow. Anthony -Original Message- From: Bob Byron [mailto:[EMAIL PROTECTED]] Sent: Monday, July 02, 2001 9:56 AM To: struts-user Subject: jsp vs do I am still in the early stages of understanding struts and would like to know a bit more about the jsp vs do extensions. In looking at the index.jsp page of the struts-example, you see two links. "Register with the MailReader Demonstration Application" links to editRegristration.do (***DO***) "Log on to the MailReader Demonstration Application" links to login.jsp (***JSP***) Why was the register page linked to a "do" instead of a "jsp" page? Why was the login page linked to a "jsp" instead of a "do"? I do understand that the "do" takes you through the struts actions, but don't understand why the login link was set to login.jsp instead of login.do initially. (I am not asking "What" it does so much as I am asking "Why" was the decision made to do it that way.) Thank You, Bob Byron __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/