• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

action mapping for pre-login

 
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Karthik Guru
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is what I am trying now, but it is not working.Any idea's ? Thanks for all your responses!

 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


<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
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nick,

It cant be another action is it? ( i mean login is an action in the posting)
 
Nicholas Cheung
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 276
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
reply
    Bookmark Topic Watch Topic
  • New Topic