This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

get session info and parameter

 
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

with struts 2 is there a way to get session information and parameter of the requestion in an action?

thanks
 
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look at the Struts 2 FAQ and scroll down to "Accessing Resources"
 
mark smith
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Joe Ess:
Look at the Struts 2 FAQ and scroll down to "Accessing Resources"



ok i checked it, but there are not good example...
 
Joe Ess
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The FAQ How do we get access to the session did not answer the first part of your question?
You are aware that the HttpServletRequest object contains the request parameters, right?
[ March 17, 2008: Message edited by: Joe Ess ]
 
mark smith
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried



but my application stoped to work...

so i tried



in my action:



that work... but i don't understand why i don't need to put something in the struts.xml file...
 
mark smith
Ranch Hand
Posts: 263
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
with that, that seem to work...

 
Joe Ess
Bartender
Posts: 9615
16
Mac OS X Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


that work... but i don't understand why i don't need to put something in the struts.xml file...



Because ServletActionContext lets you contact the underlaying J2EE Servlet API directly. You don't have to configure Struts to use it.
In order to use ServletConfigInterceptor you have to make some changes to your action so it can receive the values the interceptor sets. My wild guess is that you had some incompatibility between your action and ServletConfigInterceptor. Without seeing the code and the errors/exceptions I can't help.
 
I've read about this kind of thing at the checkout counter. That's where I met this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic