Request parameters missing

Discussion in 'Java' started by Ravion, Nov 20, 2007.

  1. Ravion

    Ravion Guest

    Dear all,

    I am writing this after a strenous effort for a whole week, but ended up
    without any clue. Here is the problem.

    An application called "External" is built with JSF technology. Our module ,
    let it be "internal". Both External and Internal are within the same EAR
    file.External module talks with Internal through an interface servlet.
    Interface Servlet receives the request from External module, and adds a URL
    parameter ( like http://localhost:8080/Controller?id=200&value=300) and
    does a RequestDispatcher.forward.

    The controller from internal module receives it and prints the query string.
    This shows that the query string is id=200&value=300.

    Now the million dollar question, the internal module takes
    request.getParameter("id") and this gives me a NULL!!!! When I print
    request.getParameterMap, I get so many parameters which were set by External
    in the request. Note that External does a "POST" to interface servlet, which
    in turn again does a "forward" to controller.

    I searched google for about 8 hours to get a link or clue, but so sad.
    Kindly help, please...

    One small doubt I am getting - Is JSF ServletRequest different from
    HttpServletRequest ? Then the method of the controller (doGet/doPost) could
    not have been called right? Or a new instance is getting created? Then how I
    am getting query string... ahhhh

    Warmest regards,
    Ravion
     
    Ravion, Nov 20, 2007
    #1
    1. Advertising

  2. Ravion

    Lew Guest

    Ravion wrote:
    > An application called "External" is built with JSF technology. Our module ,
    > let it be "internal". Both External and Internal are within the same EAR
    > file.External module talks with Internal through an interface servlet.
    > Interface Servlet receives the request from External module, and adds a URL
    > parameter ( like http://localhost:8080/Controller?id=200&value=300) and


    How do you add the parameter?

    > does a RequestDispatcher.forward.

    ....
    > Now the million dollar question, the internal module takes
    > request.getParameter("id") and this gives me a NULL!!!! When I print


    Are you sure it doesn't give you a null?

    > request.getParameterMap, I get so many parameters which were set by External
    > in the request. Note that External does a "POST" to interface servlet, which
    > in turn again does a "forward" to controller.


    Perhaps the URL was added as an attribute, not a parameter?

    > One small doubt I am getting - Is JSF ServletRequest different from
    > HttpServletRequest ? Then the method of the controller (doGet/doPost) could
    > not have been called right? Or a new instance is getting created? Then how I
    > am getting query string... ahhhh


    A request is a request is a request.

    The JSF Faces Servlet grabs it first. The Sun Java EE tutorial goes into
    great detail about the JSF life cycle, plus there are many articles out there
    about it.

    SSCCE, please.
    <http://www.physci.org/codes/sscce.html>

    (P.S., Andrew, that page has some "<%@" litter peeking through.)

    --
    Lew
     
    Lew, Nov 20, 2007
    #2
    1. Advertising

  3. Ravion

    Ravion Guest

    Hi Lew,

    I am not adding a parameter, because we cannot add a parameter to request
    manually. I read the string directly from a configuration file, somehwta
    like Struts.

    The internal module "does" gove me null, when I get parameter.

    When I check request.getAttribute("id") or request.getParameter("id") -
    both are null.

    One more info, if I do the same thing without being sent from a JSF
    application, instead from a test JSP, it works, and it works exactly as
    expected.

    Please help, thanks.

    (Regarding multipost, I am extremely sorry, let me continue this)

    Thanks an dregards,
    Ravion


    "Lew" <> wrote in message
    news:...
    > Ravion wrote:
    >> An application called "External" is built with JSF technology. Our module
    >> , let it be "internal". Both External and Internal are within the same
    >> EAR file.External module talks with Internal through an interface
    >> servlet. Interface Servlet receives the request from External module, and
    >> adds a URL parameter ( like
    >> http://localhost:8080/Controller?id=200&amp;value=300) and

    >
    > How do you add the parameter?
    >
    >> does a RequestDispatcher.forward.

    > ...
    >> Now the million dollar question, the internal module takes
    >> request.getParameter("id") and this gives me a NULL!!!! When I print

    >
    > Are you sure it doesn't give you a null?
    >
    >> request.getParameterMap, I get so many parameters which were set by
    >> External in the request. Note that External does a "POST" to interface
    >> servlet, which in turn again does a "forward" to controller.

    >
    > Perhaps the URL was added as an attribute, not a parameter?
    >
    >> One small doubt I am getting - Is JSF ServletRequest different from
    >> HttpServletRequest ? Then the method of the controller (doGet/doPost)
    >> could not have been called right? Or a new instance is getting created?
    >> Then how I am getting query string... ahhhh

    >
    > A request is a request is a request.
    >
    > The JSF Faces Servlet grabs it first. The Sun Java EE tutorial goes into
    > great detail about the JSF life cycle, plus there are many articles out
    > there about it.
    >
    > SSCCE, please.
    > <http://www.physci.org/codes/sscce.html>
    >
    > (P.S., Andrew, that page has some "<%@" litter peeking through.)
    >
    > --
    > Lew
     
    Ravion, Nov 20, 2007
    #3
  4. Andrew Thompson, Nov 20, 2007
    #4
  5. Ravion

    Ravion Guest

    Dear all,

    I found the reason finally.

    The external module was passing "MulipartRequest", a wrapper class which
    wraps HttpServletRequest. And when a multipartrequest is received in a
    servlet, request.getParameter will be null. Very useful learning, which
    about 100 people could not find...

    Thanks and regards,
    Ravion

    "Andrew Thompson" <u32984@uwe> wrote in message news:7b845f14a4966@uwe...
    > Lew wrote:
    > ..
    >>SSCCE, please.
    >><http://www.physci.org/codes/sscce.html>
    >>
    >>(P.S., Andrew, that page has some "<%@" litter peeking through.)

    >
    > Thanks Lew - I'll look into it when I get a moment.
    >
    > --
    > Andrew Thompson
    > http://www.physci.org/
    >
    > Message posted via JavaKB.com
    > http://www.javakb.com/Uwe/Forums.aspx/java-general/200711/1
    >
     
    Ravion, Nov 21, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Birtle
    Replies:
    2
    Views:
    2,131
    John Saunders
    Oct 16, 2003
  2. Kai Grossjohann
    Replies:
    2
    Views:
    817
    Anton Spaans
    Dec 8, 2003
  3. Jonck van der Kogel
    Replies:
    2
    Views:
    1,002
    Jonck van der Kogel
    May 27, 2004
  4. Gary Herron
    Replies:
    2
    Views:
    690
    Bruno Desthuilliers
    Jul 4, 2006
  5. Replies:
    3
    Views:
    1,894
    =?ISO-8859-2?Q?Dra=BEen_Gemi=E6?=
    Aug 15, 2006
Loading...

Share This Page