Checking to see if request.getParameter("myparam") exists

Discussion in 'Java' started by Steveo, Sep 17, 2003.

  1. Steveo

    Steveo Guest

    I'm new to java and JSPs. I was wondering if there is an easy way to
    check if a parameter exists. I need to handle the page differently if
    the parameter is not there.

    Steveo, Sep 17, 2003
    1. Advertisements

  2. Steveo

    Roedy Green Guest

    does it not just return null if it is missing?
    Roedy Green, Sep 17, 2003
    1. Advertisements

  3. if (request.getParameter("name") == null) {
    // it's not there

    I still think request.hasParameter("name") would have been nice to have.
    Oh well.
    Michiel Konstapel, Sep 17, 2003
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.