aspose file tools*
The moose likes Struts and the fly likes action mapping for pre-login Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "action mapping for pre-login" Watch "action mapping for pre-login" New topic
Author

action mapping for pre-login

Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
Hi,
I have been given the suggestion that using a pre-login is good architechture for my struts-config.xml action mapping. This is the code piece I was given as an example:



The question I have is, I do not under stand what the parameter=".login" refers to, and I also don't understand how to link this up to my acutal login action and page.

Any help very appreciated, I am new to struts.
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Originally posted by Kim Kantola:
Hi,
I have been given the suggestion that using a pre-login is good architechture for my struts-config.xml action mapping. This is the code piece I was given as an example:



The question I have is, I do not under stand what the parameter=".login" refers to, and I also don't understand how to link this up to my acutal login action and page.

Any help very appreciated, I am new to struts.


parameter indicates the resource you want the ForwardAction to forward to.
So what is .login here? does it do anything?
Normally it is used to displath to say a jsp / servlet or calling some resource.



will forward to the login.jsp page.

Did you consider using Global forwards instead?
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
For the values *.xxx*, we usually put it into tiles, if any.

We can define the forward parameter by ".xxx", and this ".xxx" can be referenced in the tiles file. Inside the tiles file, we can defines the title, the header, the footer, and the *real* JSP that this ".xxx" maps to.

Thus, does the code sample ".login" refering to the tiles?

Nick


SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Originally posted by Nicholas Cheung:
For the values *.xxx*, we usually put it into tiles, if any.
Nick


Thanks for pointing that out!
Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
This is what I am trying now, but it is not working.Any idea's ? Thanks for all your responses!

Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982

<action path="/preLogin"
type="org.apache.struts.actions.ForwardAction"
parameter="/login" />
</action>

Does the parameter "/login" is Servlet? If not, I suppose it should be a JSP, like this:


Nick
Karthik Guru
Ranch Hand

Joined: Mar 06, 2001
Posts: 1209
Nick,

It cant be another action is it? ( i mean login is an action in the posting)
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
It can be another action, but:


1. If it is another action, it should not be started with "/".
2. If it is another action, it should as the default forward action, which is refers to one of the *forward* parameters in its sub-element forward list, but I think he does not doing so.

Thus, for your case, should the XML be:


Nick
Kim Kantola
Ranch Hand

Joined: May 17, 2001
Posts: 274
Just for the record, I just got this to work! Thank you for all the tips. I found out that part of my problem was that in my jsp file, I was specifying the wrong form name. Here is how I got it to work:

from struts-config.xml



From LoginKim.jsp


[ May 19, 2004: Message edited by: Kim Kantola ]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: action mapping for pre-login