• 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

Getting pageContext from request

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello everybody,
does anybody know how you where access the pageContext? I'm working on a project using Struts 1.1 and am searching for a way to access the pageContext from within a Action or a ActionForm. However all the stuff you get there are the ActionMapping, the Form, the Request and the Response. I'm stuck on finding the pageContext which i need to use the RequestUtils.message method.
Thanks in advance!
Regards,
Robert
Ps. Hope this doesn't belong in the Struts/Framework forum. If it does, my apologies.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is no page context at that juncture. The page context only exists within a JSP page. Since your action has yet to forward to a JSP page, there's no page context.
bear
 
Robert Willems
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ah, ok... i was in the impression that a page had already been made somewhere... Now i can stop looking and think of something else ;-)
Thanks!
 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What are you actually trying to do?
bear
 
Robert Willems
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I needed to get a message from the default message bundle within a Action.execute() and a ActionForm.validate();
I stored the localized format string to use in the bundle.
However as i'm quite lazy (sometimes a good thing for a programmer ;-)) i wanted to use thre RequestUtils.message() method to get the message for me. However that method needs the pageContext.
Now i just have to use the Globals.MESSAGES_KEY to get the bundle out of my ServletContext...
Regards,
Robert
 
reply
    Bookmark Topic Watch Topic
  • New Topic