RE: Problem getting request parameters in HTTP GET in Struts 2
First, the post you referenced had a follow up a few days later, and the custom mapper was not actually needed, there was instead a bug in the oracle app server that was fixed in a later release. Second, let struts handle the type conversion for you. You don't need to convert from a string to an integer, it will be done automatically if the parameter names matches the bean property. Brian Relph -Original Message- From: Dave Newton [mailto:newton.d...@yahoo.com] Sent: Tuesday, March 17, 2009 6:05 PM To: Struts Users Mailing List Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 What's the action mapping look like (along with its package definition)? Dave Duan, Bin wrote: > We found a post in the mailing list that reported the same problem. Check it > out. The final solution of it was that the user had to implement a customized > map class, which was pretty nasty. Is this something we have to go through, > or is there better solution? Is this a bug in S2? Check it out. > > http://www.mail-archive.com/user@struts.apache.org/msg64440.html > > -Original Message- > From: Musachy Barroso [mailto:musa...@gmail.com] > Sent: Tuesday, March 17, 2009 5:12 PM > To: Struts Users Mailing List > Subject: Re: Problem getting request parameters in HTTP GET in Struts > 2 > > Why don't you try the blank application or showcase? if they work, > then at least you know it is not some container config, but your app. > > musachy > > On Tue, Mar 17, 2009 at 5:06 PM, Duan, Bin wrote: >> It doesn't work. I still get null for the parameter. >> >> Some additional info. The request is actually a StrutsRequestWrapper >> instance. I did the debug, the whole http content on the server side looks >> like this. You can see the drProviderId is in the get. >> >> GET /providerDetail.action?drProviderId=581 HTTP/1.1T accept: >> image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, >> application/x-shockwave-flash, application/vnd.ms-excel, >> application/vnd.ms-powerpoint, application/msword, >> application/xaml+xml, application/vnd.ms-xpsdocument, >> application/x-ms-xbap, application/x-ms-application, >> application/x-silverlight, application/x-silverlight-2-b2, */*6 >> >> I called request.getRequestURI(), the result is /providerDetail.action. It >> missed the parameter section. >> >> Another thought where might be the problem? >> >> -----Original Message- >> From: Musachy Barroso [mailto:musa...@gmail.com] >> Sent: Tuesday, March 17, 2009 4:32 PM >> To: Struts Users Mailing List >> Subject: Re: Problem getting request parameters in HTTP GET in Struts >> 2 >> >> can you try the new filters? >> >> >>struts-prepare >> >> org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter >> >> >> >>struts-execute >> >> org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter >> >> >> >>struts-prepare >>/* >> >> >> >>struts-execute >>/* >> >> >> >> musachy >> >> On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin wrote: >>> Musachy, >>> >>> The web.xml is very simple since we just started this project. Here it is. >>> Please advise: >>> >>> >>> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; >>> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee >>> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4" >>> xmlns="http://java.sun.com/xml/ns/j2ee";> >>> New MMS Website >>> >>> >>>struts2 >>> >>>org.apache.struts2.dispatcher.FilterDispatcher >>> >>> >>> >>>struts2 >>>/* >>> >>> >>>240 >>> >>> >>>html >>>text/html >>> >>> >>>txt >>>text/plain >>> >>> >>> >>> -Original Message- >>> From: Musachy Barroso [mailto:musa...@gmail.com] >>> Sent: Tuesday, March 17, 2009 4:17 PM >>> To: Struts Users Mailing List >>> Subject: Re: Problem getting request parameters in HTTP GET in >>> Struts 2 >>> >>> Something is very wrong in your configuration. Can you post your web.xml? >>> >>> musachy
Re: Problem getting request parameters in HTTP GET in Struts 2
What's the action mapping look like (along with its package definition)? Dave Duan, Bin wrote: We found a post in the mailing list that reported the same problem. Check it out. The final solution of it was that the user had to implement a customized map class, which was pretty nasty. Is this something we have to go through, or is there better solution? Is this a bug in S2? Check it out. http://www.mail-archive.com/user@struts.apache.org/msg64440.html -Original Message- From: Musachy Barroso [mailto:musa...@gmail.com] Sent: Tuesday, March 17, 2009 5:12 PM To: Struts Users Mailing List Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 Why don't you try the blank application or showcase? if they work, then at least you know it is not some container config, but your app. musachy On Tue, Mar 17, 2009 at 5:06 PM, Duan, Bin wrote: It doesn't work. I still get null for the parameter. Some additional info. The request is actually a StrutsRequestWrapper instance. I did the debug, the whole http content on the server side looks like this. You can see the drProviderId is in the get. GET /providerDetail.action?drProviderId=581 HTTP/1.1T accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/x-silverlight, application/x-silverlight-2-b2, */*6 I called request.getRequestURI(), the result is /providerDetail.action. It missed the parameter section. Another thought where might be the problem? -Original Message- From: Musachy Barroso [mailto:musa...@gmail.com] Sent: Tuesday, March 17, 2009 4:32 PM To: Struts Users Mailing List Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 can you try the new filters? struts-prepare org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter struts-execute org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter struts-prepare /* struts-execute /* musachy On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin wrote: Musachy, The web.xml is very simple since we just started this project. Here it is. Please advise: http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";> New MMS Website struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /* 240 html text/html txt text/plain -Original Message- From: Musachy Barroso [mailto:musa...@gmail.com] Sent: Tuesday, March 17, 2009 4:17 PM To: Struts Users Mailing List Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 Something is very wrong in your configuration. Can you post your web.xml? musachy On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin wrote: Thanks for the response. I did that. The request obtained by implementing RequestAware is the same as the one obtained from ServletActionRequest.getRequest(). None of them worked. Actually, I did get the parameter map from the request, and it contained null data. Have you tried the scenario, did it work for your application? -Original Message- From: Struts Two [mailto:struts...@yahoo.ca] Sent: Tuesday, March 17, 2009 3:46 PM To: Struts Users Mailing List Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 Why do n't you let your action implement RequestAware interface and then get parameter from the request map. --- On Tue, 3/17/09, Duan, Bin wrote: From: Duan, Bin Subject: Problem getting request parameters in HTTP GET in Struts 2 To: user@struts.apache.org Received: Tuesday, March 17, 2009, 7:01 PM I was trying to get a parameter from a Http GET. The get from jsp looks like this: Provider Name The providerDetail.action maps to ProviderAction class. In the action class, I have a setDrProviderId() method, but found the id was not set. Then I tried to get the id from ServletActionRequest.getRequest().getParameter("drProviderId"), but still did not get anything. I debugged the code, in the request object, I saw request input as "GET /providerDetail.action?drProviderId=1000", this pretty much meant the parameter was sent to the server side correctly. But request.getParameter("drProviderId") returned me null. If I switch to use form POST, my setDrProviderId() method was still NOT called, but I could get the id from request.getParameter("drProviderId"). This problem will almost be a show stopper for our project to use Struts. Anybod
RE: Problem getting request parameters in HTTP GET in Struts 2
We found a post in the mailing list that reported the same problem. Check it out. The final solution of it was that the user had to implement a customized map class, which was pretty nasty. Is this something we have to go through, or is there better solution? Is this a bug in S2? Check it out. http://www.mail-archive.com/user@struts.apache.org/msg64440.html -Original Message- From: Musachy Barroso [mailto:musa...@gmail.com] Sent: Tuesday, March 17, 2009 5:12 PM To: Struts Users Mailing List Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 Why don't you try the blank application or showcase? if they work, then at least you know it is not some container config, but your app. musachy On Tue, Mar 17, 2009 at 5:06 PM, Duan, Bin wrote: > It doesn't work. I still get null for the parameter. > > Some additional info. The request is actually a StrutsRequestWrapper > instance. I did the debug, the whole http content on the server side looks > like this. You can see the drProviderId is in the get. > > GET /providerDetail.action?drProviderId=581 HTTP/1.1T accept: image/gif, > image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, > application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, > application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, > application/x-ms-application, application/x-silverlight, > application/x-silverlight-2-b2, */*6 > > I called request.getRequestURI(), the result is /providerDetail.action. It > missed the parameter section. > > Another thought where might be the problem? > > -Original Message- > From: Musachy Barroso [mailto:musa...@gmail.com] > Sent: Tuesday, March 17, 2009 4:32 PM > To: Struts Users Mailing List > Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 > > can you try the new filters? > > > struts-prepare > > org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter > > > > struts-execute > > org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter > > > > struts-prepare > /* > > > > struts-execute > /* > > > > musachy > > On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin wrote: >> Musachy, >> >> The web.xml is very simple since we just started this project. Here it is. >> Please advise: >> >> >> >> http://www.w3.org/2001/XMLSchema-instance"; >> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee >> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4" >> xmlns="http://java.sun.com/xml/ns/j2ee";> >> New MMS Website >> >> >> struts2 >> >> org.apache.struts2.dispatcher.FilterDispatcher >> >> >> >> struts2 >> /* >> >> >> 240 >> >> >> html >> text/html >> >> >> txt >> text/plain >> >> >> >> -Original Message- >> From: Musachy Barroso [mailto:musa...@gmail.com] >> Sent: Tuesday, March 17, 2009 4:17 PM >> To: Struts Users Mailing List >> Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 >> >> Something is very wrong in your configuration. Can you post your web.xml? >> >> musachy >> >> On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin wrote: >>> Thanks for the response. >>> >>> I did that. The request obtained by implementing RequestAware is the same >>> as the one obtained from ServletActionRequest.getRequest(). >>> >>> None of them worked. Actually, I did get the parameter map from the >>> request, and it contained null data. >>> >>> Have you tried the scenario, did it work for your application? >>> >>> -Original Message- >>> From: Struts Two [mailto:struts...@yahoo.ca] >>> Sent: Tuesday, March 17, 2009 3:46 PM >>> To: Struts Users Mailing List >>> Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 >>> >>> >>> Why do n't you let your action implement RequestAware interface and then >>> get parameter from the request map. >>> >>> --- On Tue, 3/17/09, Duan, Bin wrote: >>> >>>> From: Duan, Bin >>>> Subject: Problem getting request parameters in HTTP GET in Struts 2 >>>> To: user@struts.apache.org >>>> Received: Tuesday, March 17, 200
Re: Problem getting request parameters in HTTP GET in Struts 2
Why don't you try the blank application or showcase? if they work, then at least you know it is not some container config, but your app. musachy On Tue, Mar 17, 2009 at 5:06 PM, Duan, Bin wrote: > It doesn't work. I still get null for the parameter. > > Some additional info. The request is actually a StrutsRequestWrapper > instance. I did the debug, the whole http content on the server side looks > like this. You can see the drProviderId is in the get. > > GET /providerDetail.action?drProviderId=581 HTTP/1.1T accept: image/gif, > image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, > application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, > application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, > application/x-ms-application, application/x-silverlight, > application/x-silverlight-2-b2, */*6 > > I called request.getRequestURI(), the result is /providerDetail.action. It > missed the parameter section. > > Another thought where might be the problem? > > -Original Message- > From: Musachy Barroso [mailto:musa...@gmail.com] > Sent: Tuesday, March 17, 2009 4:32 PM > To: Struts Users Mailing List > Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 > > can you try the new filters? > > > struts-prepare > > org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter > > > > struts-execute > > org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter > > > > struts-prepare > /* > > > > struts-execute > /* > > > > musachy > > On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin wrote: >> Musachy, >> >> The web.xml is very simple since we just started this project. Here it is. >> Please advise: >> >> >> >> http://www.w3.org/2001/XMLSchema-instance"; >> xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee >> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4" >> xmlns="http://java.sun.com/xml/ns/j2ee";> >> New MMS Website >> >> >> struts2 >> >> org.apache.struts2.dispatcher.FilterDispatcher >> >> >> >> struts2 >> /* >> >> >> 240 >> >> >> html >> text/html >> >> >> txt >> text/plain >> >> >> >> -Original Message- >> From: Musachy Barroso [mailto:musa...@gmail.com] >> Sent: Tuesday, March 17, 2009 4:17 PM >> To: Struts Users Mailing List >> Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 >> >> Something is very wrong in your configuration. Can you post your web.xml? >> >> musachy >> >> On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin wrote: >>> Thanks for the response. >>> >>> I did that. The request obtained by implementing RequestAware is the same >>> as the one obtained from ServletActionRequest.getRequest(). >>> >>> None of them worked. Actually, I did get the parameter map from the >>> request, and it contained null data. >>> >>> Have you tried the scenario, did it work for your application? >>> >>> -Original Message- >>> From: Struts Two [mailto:struts...@yahoo.ca] >>> Sent: Tuesday, March 17, 2009 3:46 PM >>> To: Struts Users Mailing List >>> Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 >>> >>> >>> Why do n't you let your action implement RequestAware interface and then >>> get parameter from the request map. >>> >>> --- On Tue, 3/17/09, Duan, Bin wrote: >>> >>>> From: Duan, Bin >>>> Subject: Problem getting request parameters in HTTP GET in Struts 2 >>>> To: user@struts.apache.org >>>> Received: Tuesday, March 17, 2009, 7:01 PM >>>> I was trying to get a parameter from >>>> a Http GET. The get from jsp looks >>>> like this: >>>> >>>> >>> href=/providerDetail.action?drProviderId=1000>Provider >>>> Name >>>> >>>> The providerDetail.action maps to ProviderAction class. In >>>> the action >>>> class, I have a setDrProviderId() method, but found the id >>>> was not set. >>>> Then I tried to get the
RE: Problem getting request parameters in HTTP GET in Struts 2
It doesn't work. I still get null for the parameter. Some additional info. The request is actually a StrutsRequestWrapper instance. I did the debug, the whole http content on the server side looks like this. You can see the drProviderId is in the get. GET /providerDetail.action?drProviderId=581 HTTP/1.1Taccept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/xaml+xml, application/vnd.ms-xpsdocument, application/x-ms-xbap, application/x-ms-application, application/x-silverlight, application/x-silverlight-2-b2, */*6 I called request.getRequestURI(), the result is /providerDetail.action. It missed the parameter section. Another thought where might be the problem? -Original Message- From: Musachy Barroso [mailto:musa...@gmail.com] Sent: Tuesday, March 17, 2009 4:32 PM To: Struts Users Mailing List Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 can you try the new filters? struts-prepare org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter struts-execute org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter struts-prepare /* struts-execute /* musachy On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin wrote: > Musachy, > > The web.xml is very simple since we just started this project. Here it is. > Please advise: > > > > http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee > http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4" > xmlns="http://java.sun.com/xml/ns/j2ee";> > New MMS Website > > > struts2 > > org.apache.struts2.dispatcher.FilterDispatcher > > > > struts2 > /* > > > 240 > > > html > text/html > > > txt > text/plain > > > > -Original Message- > From: Musachy Barroso [mailto:musa...@gmail.com] > Sent: Tuesday, March 17, 2009 4:17 PM > To: Struts Users Mailing List > Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 > > Something is very wrong in your configuration. Can you post your web.xml? > > musachy > > On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin wrote: >> Thanks for the response. >> >> I did that. The request obtained by implementing RequestAware is the same as >> the one obtained from ServletActionRequest.getRequest(). >> >> None of them worked. Actually, I did get the parameter map from the request, >> and it contained null data. >> >> Have you tried the scenario, did it work for your application? >> >> -Original Message- >> From: Struts Two [mailto:struts...@yahoo.ca] >> Sent: Tuesday, March 17, 2009 3:46 PM >> To: Struts Users Mailing List >> Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 >> >> >> Why do n't you let your action implement RequestAware interface and then get >> parameter from the request map. >> >> --- On Tue, 3/17/09, Duan, Bin wrote: >> >>> From: Duan, Bin >>> Subject: Problem getting request parameters in HTTP GET in Struts 2 >>> To: user@struts.apache.org >>> Received: Tuesday, March 17, 2009, 7:01 PM >>> I was trying to get a parameter from >>> a Http GET. The get from jsp looks >>> like this: >>> >>> >> href=/providerDetail.action?drProviderId=1000>Provider >>> Name >>> >>> The providerDetail.action maps to ProviderAction class. In >>> the action >>> class, I have a setDrProviderId() method, but found the id >>> was not set. >>> Then I tried to get the id from >>> ServletActionRequest.getRequest().getParameter("drProviderId"), >>> but >>> still did not get anything. >>> >>> >>> >>> I debugged the code, in the request object, I saw request >>> input as "GET >>> /providerDetail.action?drProviderId=1000", this pretty much >>> meant the >>> parameter was sent to the server side correctly. But >>> request.getParameter("drProviderId") returned me null. >>> >>> >>> >>> If I switch to use form POST, my setDrProviderId() method >>> was still NOT >>> called, but I could get the id from >>> request.getParameter("drProviderId"). >>> >>&g
Re: Problem getting request parameters in HTTP GET in Struts 2
can you try the new filters? struts-prepare org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter struts-execute org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter struts-prepare /* struts-execute /* musachy On Tue, Mar 17, 2009 at 4:21 PM, Duan, Bin wrote: > Musachy, > > The web.xml is very simple since we just started this project. Here it is. > Please advise: > > > > http://www.w3.org/2001/XMLSchema-instance"; > xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee > http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4" > xmlns="http://java.sun.com/xml/ns/j2ee";> > New MMS Website > > > struts2 > > org.apache.struts2.dispatcher.FilterDispatcher > > > > struts2 > /* > > > 240 > > > html > text/html > > > txt > text/plain > > > > -Original Message----- > From: Musachy Barroso [mailto:musa...@gmail.com] > Sent: Tuesday, March 17, 2009 4:17 PM > To: Struts Users Mailing List > Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 > > Something is very wrong in your configuration. Can you post your web.xml? > > musachy > > On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin wrote: >> Thanks for the response. >> >> I did that. The request obtained by implementing RequestAware is the same as >> the one obtained from ServletActionRequest.getRequest(). >> >> None of them worked. Actually, I did get the parameter map from the request, >> and it contained null data. >> >> Have you tried the scenario, did it work for your application? >> >> -Original Message- >> From: Struts Two [mailto:struts...@yahoo.ca] >> Sent: Tuesday, March 17, 2009 3:46 PM >> To: Struts Users Mailing List >> Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 >> >> >> Why do n't you let your action implement RequestAware interface and then get >> parameter from the request map. >> >> --- On Tue, 3/17/09, Duan, Bin wrote: >> >>> From: Duan, Bin >>> Subject: Problem getting request parameters in HTTP GET in Struts 2 >>> To: user@struts.apache.org >>> Received: Tuesday, March 17, 2009, 7:01 PM >>> I was trying to get a parameter from >>> a Http GET. The get from jsp looks >>> like this: >>> >>> >> href=/providerDetail.action?drProviderId=1000>Provider >>> Name >>> >>> The providerDetail.action maps to ProviderAction class. In >>> the action >>> class, I have a setDrProviderId() method, but found the id >>> was not set. >>> Then I tried to get the id from >>> ServletActionRequest.getRequest().getParameter("drProviderId"), >>> but >>> still did not get anything. >>> >>> >>> >>> I debugged the code, in the request object, I saw request >>> input as "GET >>> /providerDetail.action?drProviderId=1000", this pretty much >>> meant the >>> parameter was sent to the server side correctly. But >>> request.getParameter("drProviderId") returned me null. >>> >>> >>> >>> If I switch to use form POST, my setDrProviderId() method >>> was still NOT >>> called, but I could get the id from >>> request.getParameter("drProviderId"). >>> >>> >>> >>> This problem will almost be a show stopper for our project >>> to use >>> Struts. Anybody has any ideas of what could be wrong? >>> >>> >>> >>> I am using Struts 2.1.6. I tried both on oc4j and JBoss. >>> >>> >>> >>> >>> >>> >>> >>> Following is my struts.xml file >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> extends="struts-default"> >>> >>> >>> >>> >> method="listProvider" >>> >>> >>> class="com.claritas.mms.radish.dataReceiving.DrProviderAction"> >>> >>> >>> /dataReceiving/ProviderList.jsp >>> >>> >>> >>> >> name="providerDetail" method=&q
RE: Problem getting request parameters in HTTP GET in Struts 2
Musachy, The web.xml is very simple since we just started this project. Here it is. Please advise: http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"; version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee";> New MMS Website struts2 org.apache.struts2.dispatcher.FilterDispatcher struts2 /* 240 html text/html txt text/plain -Original Message- From: Musachy Barroso [mailto:musa...@gmail.com] Sent: Tuesday, March 17, 2009 4:17 PM To: Struts Users Mailing List Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 Something is very wrong in your configuration. Can you post your web.xml? musachy On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin wrote: > Thanks for the response. > > I did that. The request obtained by implementing RequestAware is the same as > the one obtained from ServletActionRequest.getRequest(). > > None of them worked. Actually, I did get the parameter map from the request, > and it contained null data. > > Have you tried the scenario, did it work for your application? > > -Original Message- > From: Struts Two [mailto:struts...@yahoo.ca] > Sent: Tuesday, March 17, 2009 3:46 PM > To: Struts Users Mailing List > Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 > > > Why do n't you let your action implement RequestAware interface and then get > parameter from the request map. > > --- On Tue, 3/17/09, Duan, Bin wrote: > >> From: Duan, Bin >> Subject: Problem getting request parameters in HTTP GET in Struts 2 >> To: user@struts.apache.org >> Received: Tuesday, March 17, 2009, 7:01 PM >> I was trying to get a parameter from >> a Http GET. The get from jsp looks >> like this: >> >> > href=/providerDetail.action?drProviderId=1000>Provider >> Name >> >> The providerDetail.action maps to ProviderAction class. In >> the action >> class, I have a setDrProviderId() method, but found the id >> was not set. >> Then I tried to get the id from >> ServletActionRequest.getRequest().getParameter("drProviderId"), >> but >> still did not get anything. >> >> >> >> I debugged the code, in the request object, I saw request >> input as "GET >> /providerDetail.action?drProviderId=1000", this pretty much >> meant the >> parameter was sent to the server side correctly. But >> request.getParameter("drProviderId") returned me null. >> >> >> >> If I switch to use form POST, my setDrProviderId() method >> was still NOT >> called, but I could get the id from >> request.getParameter("drProviderId"). >> >> >> >> This problem will almost be a show stopper for our project >> to use >> Struts. Anybody has any ideas of what could be wrong? >> >> >> >> I am using Struts 2.1.6. I tried both on oc4j and JBoss. >> >> >> >> >> >> >> >> Following is my struts.xml file >> >> >> >> >> >> >> >> >> >> > extends="struts-default"> >> >> >> >> > method="listProvider" >> >> >> class="com.claritas.mms.radish.dataReceiving.DrProviderAction"> >> >> >> /dataReceiving/ProviderList.jsp >> >> >> >> > name="providerDetail" method="providerDetail" >> >> >> class="com.claritas.mms.radish.dataReceiving.DrProviderAction"> >> >> >> /dataReceiving/ProviderDetails.jsp >> >> >> >> >> >> >> >> >> >> >> >> Following is my DrProviderAction class >> >> >> >> public void setDrProviderId(String id) >> >> { >> >> this.drProviderId = new >> Integer(id).intValue(); >> >> } >> >> >> >> public String providerDetail() >> >> { >> >> Map map = >> request.getParameterMap(); >> >> >> >> String sid = >> request.getParameter("drProviderId"); >> >> drProviderId = new >> Integer(sid).intValue(); >> >> //check if the >> >> if(session != null) >> >> { >>
Re: Problem getting request parameters in HTTP GET in Struts 2
Something is very wrong in your configuration. Can you post your web.xml? musachy On Tue, Mar 17, 2009 at 3:50 PM, Duan, Bin wrote: > Thanks for the response. > > I did that. The request obtained by implementing RequestAware is the same as > the one obtained from ServletActionRequest.getRequest(). > > None of them worked. Actually, I did get the parameter map from the request, > and it contained null data. > > Have you tried the scenario, did it work for your application? > > -Original Message- > From: Struts Two [mailto:struts...@yahoo.ca] > Sent: Tuesday, March 17, 2009 3:46 PM > To: Struts Users Mailing List > Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 > > > Why do n't you let your action implement RequestAware interface and then get > parameter from the request map. > > --- On Tue, 3/17/09, Duan, Bin wrote: > >> From: Duan, Bin >> Subject: Problem getting request parameters in HTTP GET in Struts 2 >> To: user@struts.apache.org >> Received: Tuesday, March 17, 2009, 7:01 PM >> I was trying to get a parameter from >> a Http GET. The get from jsp looks >> like this: >> >> > href=/providerDetail.action?drProviderId=1000>Provider >> Name >> >> The providerDetail.action maps to ProviderAction class. In >> the action >> class, I have a setDrProviderId() method, but found the id >> was not set. >> Then I tried to get the id from >> ServletActionRequest.getRequest().getParameter("drProviderId"), >> but >> still did not get anything. >> >> >> >> I debugged the code, in the request object, I saw request >> input as "GET >> /providerDetail.action?drProviderId=1000", this pretty much >> meant the >> parameter was sent to the server side correctly. But >> request.getParameter("drProviderId") returned me null. >> >> >> >> If I switch to use form POST, my setDrProviderId() method >> was still NOT >> called, but I could get the id from >> request.getParameter("drProviderId"). >> >> >> >> This problem will almost be a show stopper for our project >> to use >> Struts. Anybody has any ideas of what could be wrong? >> >> >> >> I am using Struts 2.1.6. I tried both on oc4j and JBoss. >> >> >> >> >> >> >> >> Following is my struts.xml file >> >> >> >> >> >> >> >> >> >> > extends="struts-default"> >> >> >> >> > method="listProvider" >> >> >> class="com.claritas.mms.radish.dataReceiving.DrProviderAction"> >> >> >> /dataReceiving/ProviderList.jsp >> >> >> >> > name="providerDetail" method="providerDetail" >> >> >> class="com.claritas.mms.radish.dataReceiving.DrProviderAction"> >> >> >> /dataReceiving/ProviderDetails.jsp >> >> >> >> >> >> >> >> >> >> >> >> Following is my DrProviderAction class >> >> >> >> public void setDrProviderId(String id) >> >> { >> >> this.drProviderId = new >> Integer(id).intValue(); >> >> } >> >> >> >> public String providerDetail() >> >> { >> >> Map map = >> request.getParameterMap(); >> >> >> >> String sid = >> request.getParameter("drProviderId"); >> >> drProviderId = new >> Integer(sid).intValue(); >> >> //check if the >> >> if(session != null) >> >> { >> >> Map> DrProvider> providerMap = >> (Map)session.get("provider_map"); >> >> if(providerMap != >> null) >> >> { >> >> >> provider = providerMap.get(drProviderId); >> >> } >> >> >> } >> >> else //go to database >> >> { >> >> provider = >> service.getProvider(drProviderId); >> >> } >> >> >> >> return SUCCESS; >> >> >> >> } >> >> >> >> >> >> > > > __ > Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! > Canada Messenger at http://ca.beta.messenger.yahoo.com/ > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > > - > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org > For additional commands, e-mail: user-h...@struts.apache.org > > -- "Hey you! Would you help me to carry the stone?" Pink Floyd - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
RE: Problem getting request parameters in HTTP GET in Struts 2
Thanks for the response. I did that. The request obtained by implementing RequestAware is the same as the one obtained from ServletActionRequest.getRequest(). None of them worked. Actually, I did get the parameter map from the request, and it contained null data. Have you tried the scenario, did it work for your application? -Original Message- From: Struts Two [mailto:struts...@yahoo.ca] Sent: Tuesday, March 17, 2009 3:46 PM To: Struts Users Mailing List Subject: Re: Problem getting request parameters in HTTP GET in Struts 2 Why do n't you let your action implement RequestAware interface and then get parameter from the request map. --- On Tue, 3/17/09, Duan, Bin wrote: > From: Duan, Bin > Subject: Problem getting request parameters in HTTP GET in Struts 2 > To: user@struts.apache.org > Received: Tuesday, March 17, 2009, 7:01 PM > I was trying to get a parameter from > a Http GET. The get from jsp looks > like this: > > href=/providerDetail.action?drProviderId=1000>Provider > Name > > The providerDetail.action maps to ProviderAction class. In > the action > class, I have a setDrProviderId() method, but found the id > was not set. > Then I tried to get the id from > ServletActionRequest.getRequest().getParameter("drProviderId"), > but > still did not get anything. > > > > I debugged the code, in the request object, I saw request > input as "GET > /providerDetail.action?drProviderId=1000", this pretty much > meant the > parameter was sent to the server side correctly. But > request.getParameter("drProviderId") returned me null. > > > > If I switch to use form POST, my setDrProviderId() method > was still NOT > called, but I could get the id from > request.getParameter("drProviderId"). > > > > This problem will almost be a show stopper for our project > to use > Struts. Anybody has any ideas of what could be wrong? > > > > I am using Struts 2.1.6. I tried both on oc4j and JBoss. > > > > > > > > Following is my struts.xml file > > > > > > > > > > extends="struts-default"> > > > > method="listProvider" > > > class="com.claritas.mms.radish.dataReceiving.DrProviderAction"> > > > /dataReceiving/ProviderList.jsp > > > > name="providerDetail" method="providerDetail" > > > class="com.claritas.mms.radish.dataReceiving.DrProviderAction"> > > > /dataReceiving/ProviderDetails.jsp > > > > > > > > > > > > Following is my DrProviderAction class > > > > public void setDrProviderId(String id) > > { > > this.drProviderId = new > Integer(id).intValue(); > > } > > > > public String providerDetail() > > { > > Map map = > request.getParameterMap(); > > > > String sid = > request.getParameter("drProviderId"); > > drProviderId = new > Integer(sid).intValue(); > > //check if the > > if(session != null) > > { > > Map DrProvider> providerMap = > (Map)session.get("provider_map"); > > if(providerMap != > null) > > { > > > provider = providerMap.get(drProviderId); > > } > > > } > > else //go to database > > { > > provider = > service.getProvider(drProviderId); > > } > > > > return SUCCESS; > > > > } > > > > > > __ Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Problem getting request parameters in HTTP GET in Struts 2
Why do n't you let your action implement RequestAware interface and then get parameter from the request map. --- On Tue, 3/17/09, Duan, Bin wrote: > From: Duan, Bin > Subject: Problem getting request parameters in HTTP GET in Struts 2 > To: user@struts.apache.org > Received: Tuesday, March 17, 2009, 7:01 PM > I was trying to get a parameter from > a Http GET. The get from jsp looks > like this: > > href=/providerDetail.action?drProviderId=1000>Provider > Name > > The providerDetail.action maps to ProviderAction class. In > the action > class, I have a setDrProviderId() method, but found the id > was not set. > Then I tried to get the id from > ServletActionRequest.getRequest().getParameter("drProviderId"), > but > still did not get anything. > > > > I debugged the code, in the request object, I saw request > input as "GET > /providerDetail.action?drProviderId=1000", this pretty much > meant the > parameter was sent to the server side correctly. But > request.getParameter("drProviderId") returned me null. > > > > If I switch to use form POST, my setDrProviderId() method > was still NOT > called, but I could get the id from > request.getParameter("drProviderId"). > > > > This problem will almost be a show stopper for our project > to use > Struts. Anybody has any ideas of what could be wrong? > > > > I am using Struts 2.1.6. I tried both on oc4j and JBoss. > > > > > > > > Following is my struts.xml file > > > > > > > > > > extends="struts-default"> > > > > method="listProvider" > > > class="com.claritas.mms.radish.dataReceiving.DrProviderAction"> > > > /dataReceiving/ProviderList.jsp > > > > name="providerDetail" method="providerDetail" > > > class="com.claritas.mms.radish.dataReceiving.DrProviderAction"> > > > /dataReceiving/ProviderDetails.jsp > > > > > > > > > > > > Following is my DrProviderAction class > > > > public void setDrProviderId(String id) > > { > > this.drProviderId = new > Integer(id).intValue(); > > } > > > > public String providerDetail() > > { > > Map map = > request.getParameterMap(); > > > > String sid = > request.getParameter("drProviderId"); > > drProviderId = new > Integer(sid).intValue(); > > //check if the > > if(session != null) > > { > > Map DrProvider> providerMap = > (Map)session.get("provider_map"); > > if(providerMap != > null) > > { > > > provider = providerMap.get(drProviderId); > > } > > > } > > else //go to database > > { > > provider = > service.getProvider(drProviderId); > > } > > > > return SUCCESS; > > > > } > > > > > > __ Instant Messaging, free SMS, sharing photos and more... Try the new Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/ - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Problem getting request parameters in HTTP GET in Struts 2
I was trying to get a parameter from a Http GET. The get from jsp looks like this: Provider Name The providerDetail.action maps to ProviderAction class. In the action class, I have a setDrProviderId() method, but found the id was not set. Then I tried to get the id from ServletActionRequest.getRequest().getParameter("drProviderId"), but still did not get anything. I debugged the code, in the request object, I saw request input as "GET /providerDetail.action?drProviderId=1000", this pretty much meant the parameter was sent to the server side correctly. But request.getParameter("drProviderId") returned me null. If I switch to use form POST, my setDrProviderId() method was still NOT called, but I could get the id from request.getParameter("drProviderId"). This problem will almost be a show stopper for our project to use Struts. Anybody has any ideas of what could be wrong? I am using Struts 2.1.6. I tried both on oc4j and JBoss. Following is my struts.xml file /dataReceiving/ProviderList.jsp /dataReceiving/ProviderDetails.jsp Following is my DrProviderAction class public void setDrProviderId(String id) { this.drProviderId = new Integer(id).intValue(); } public String providerDetail() { Map map = request.getParameterMap(); String sid = request.getParameter("drProviderId"); drProviderId = new Integer(sid).intValue(); //check if the if(session != null) { Map providerMap = (Map)session.get("provider_map"); if(providerMap != null) { provider = providerMap.get(drProviderId); } } else //go to database { provider = service.getProvider(drProviderId); } return SUCCESS; }