struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Duan, Bin" <>
Subject Problem getting request parameters in HTTP GET in Struts 2
Date Tue, 17 Mar 2009 19:01:10 GMT
I was trying to get a parameter from a Http GET. The get from jsp looks
like this: 

<a 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


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





    <package name="dataReceiving" extends="struts-default">


        <action name="listProvider" method="listProvider"




        <action name="providerDetail" method="providerDetail"








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<Integer, DrProvider> providerMap =

            if(providerMap != null) 


                provider = providerMap.get(drProviderId);



        else //go to database


            provider = service.getProvider(drProviderId); 



        return SUCCESS;





  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message