I need to access the request as I have a session variable stored in a
StateHolder class which I need to access (request.getSession()).
Basically, the field in my form is a calculated field (age) which is
calculated from a DOB field. I need it in the form as I need access to
the age field for some validations. I could write a custom validator for
this which has access to the request object. I was just trying to see if
it is at all possible to get the request object in any way.

I have solved my problem now. But I am still wondering if it is a good
idea to have access to the request object from anywhere. If yes, then is
there a way to do it. Any thoughts?

Harsh.

-----Original Message-----
From: David Evans [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 12, 2006 1:41 PM
To: Struts Users Mailing List
Subject: Re: Get request object


Hello,

I don't think you can get the request from the ActionForm. From within
the ActionForm you can get the ServletContext this way:

ServletContext context = this.getServlet().getServletContext();

But i don't think that helps. 

What is the scenario here? why do you need the request in the
ActionForm? there may be a simple refactoring that could solve the
problem.

dave


On Fri, 2006-05-12 at 11:59 -0500, Chaudhary, Harsh wrote:
> Hi,
> This is not exactly a struts question. But I am in a bind and short on
> time. So, maybe someone can help.
> 
> I need to access the request object from a struts form. How do I do
> that? I mean how can I access the request object.
> 
> I could have sworn there was a way to get either the ServletContext or
> ServletConfig or something like that from where you could access the
> request object. I can find it. Anyone?
> 
> Harsh.
> 
> -----Original Message-----
> From: news [mailto:[EMAIL PROTECTED] On Behalf Of Danny Lee
> Sent: Friday, May 12, 2006 9:52 AM
> To: user@struts.apache.org
> Subject: Re: Interesting question (to me)... Perl app conversion to
> SUNWappserver/Java/Struts
> 
> 
> Use URL rewrite filter for this one. It's really a good stuff.
> 
> https://urlrewrite.dev.java.net/
> 
> Cheers,
> 
> Danny
> 
> 
> 
> Alan Treece wrote:
> > As the Subject: line states I'm in the middle of converting a larger

> > Perl application to a Struts web-app running on the SUNWappserver.
The
> 
> > question was posed as to how to deal with all of the folks who may
> have 
> > "bookmarked" a perl URL to the old app. I don't want to just cut
those
> 
> > folks off when the switch is made.
> > 
> > Are there any tricks folks have used to deal with this scenario? The

> > goal is to turn off the perl app and start the Struts web-app with
the
> 
> > same server name and port.
> > 
> > 
> > Thanks, ajTreece
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to