• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

JSF to Struts conversion

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've recently started working on a Struts piece of work a having limited background in JSF.

I'm having trouble understanding how to approach a struts application, what I am currently trying to do is find the struts equvelent to the JSF:

JSF:

1) Session scoped object representing a user.
- Really used instead of the http session itself, but used to usfully store user information for display in my page header including user name and perhaps other methods to return other values.

With JSF, once the object is declared in the faces-config file we can trust JSF to create it when needed, this will satisfy any pages that attempt to use it.

In the code I can use:


So if the object has yet to be created we can do so, and make it available to any subseqent pages that require the same object.

The important bit is that I do not have to worry too much about other sessions, the FacesContext helps me out there.


In my Structs application I want a similar header, however that information is not available until after the user has logged in (security provided by Acegi) as that point, in the code I would need to retrieve the session scoped object (or create it)(does it necessarily exist yet?) and update it as appropriate.

In addition I need to provide log files including the user, so some class in the logger bits of my code will need to be able to retrieve this session scoped object.

With my current understanding of Struts I can set the object into the session from an action (if one is called before we start trying to use the object), however the login is not handled by an action (is done so by a Spring ApplicationListener!). I instinctivly want to 'create' the object by declaration in my config file rather then explicilty in code.

Any help would be very much appreciated.
[ September 02, 2008: Message edited by: Rich Peate ]
 
Tick check! Okay, I guess that was just an itch. Oh wait! Just a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic