NullPointer exception in request.getParameter().indexof(.....) only in 6.1

Hi
I have one full working application (containing WAR + JAR) files.
Right now this application is working absolutely fine in weblogic 6.0 sp1 on
WINNT & Solaris.
In this application, we accept events to save data from external
applications like excel files.
Now code in JSP is -->
Line 1: String Data = request.getParameter("data");
Line 2: Data.indexof(........);
Now in case of weblogic 6.1, i am getting NullPointer Exception in line 2,
but I am NOT getting any exception in case of weblogic 6.0sp1.
To my surprise, I am also printing request obj parameters values, whenever
jsp get called from external source, there it is printing value of "data".
I am totally clueless!!
Any idea plz?
Ashish Jain

Looking very closely at request object contents..
Wht i am sending (posting) from excel file-->
xmlData=<?xml version="1.0" encoding="UTF-8"?><reportSheet bu="SHKXXX"
report="PBrandContr" sheet=
"PBrandContr" year="2002" coType="A" status="0" brId="PIC" act_brId="PIC"
opt="P" ></reportSheet>
But 6.1 interprets like this ---->
key is --------> xmlData=<?xml version="1.0" encoding="UTF-8"?><reportSheet
bu="SHKXXX" report="PBrandContr" sheet=
"PBrandContr" year="2002" coType="A" status="0" brId="PIC" act_brId
And Value is -------> "PIC" opt="P" ></reportSheet>
This thing is causing all problems.
I am not observing this kinda behaviour in 6.0sp1.
Thanks
Ashish Jain
"Ashish Jain" <[email protected]> wrote in message
news:[email protected]..
Hi
I have one full working application (containing WAR + JAR) files.
Right now this application is working absolutely fine in weblogic 6.0 sp1on
WINNT & Solaris.
In this application, we accept events to save data from external
applications like excel files.
Now code in JSP is -->
Line 1: String Data = request.getParameter("data");
Line 2: Data.indexof(........);
Now in case of weblogic 6.1, i am getting NullPointer Exception in line 2,
but I am NOT getting any exception in case of weblogic 6.0sp1.
To my surprise, I am also printing request obj parameters values,whenever
jsp get called from external source, there it is printing value of "data".
I am totally clueless!!
Any idea plz?
Ashish Jain

Similar Messages

  • Retriving only hidden parameters from request.getParameter

    Hi,
    I want to retrive only the hidden parameters from previous JSP page into current JSP page. The problem here is that my hidden parameters in privious page are dynamically generated (parameter names are decided based on values retrived from the database) and I cannot retrive them using "request.getParameter(<parametername>)"
    Can I find the parameter type (i.e. text box, text area, checkbox, radio or hidden) from the request.getParameter() or request.getParameterNames() methods? or is there any other way to find it.
    Thanks in advance for any help

    You can use the getParameterNames() or getParameterMap() methods from javax.servlet.ServletRequest to get all the parameters in the request. Even if they're dynamically generated, and you don't know the names in advance, these methods will ferret them out.
    getParameterMap() returns name String, values String [] pairs, so you'll have to work with String arrays to get the input out. It's got to be that way to accomodate checkboxes and other HTML form elements that can send more than one value for a given name.
    I prefer getParameterMap, because I don't like using Enumerations as much. - MOD

  • Jsp request.getparameter doesn't get querystring values

    We have recently deployed our jsp application which was running successfully on ias8i apache jserv into the 8.1.7 JVM and configured the mod_ose on the Oracle HTTP server every thing seems to be fine except the following case.
    Here we are accepting the userid,password from a jsp and submiting to the same jsp for action on submit we are reading a combination of jsp form feilds and url querystrings strangely we are able to get values only for the form feilds and querystrings return null.
    The same peice of code works fine on apache jserv implementation.
    Any clues please write to me.
    <SCRIPT Language="JavaScript">
    function check_password()
    document.Login.action ="problem.jsp?tab=YES&nSessionId="+document.Login.sessionid.value+"&nUserId=" + document.Login.userid.value;
    document.Login.target = "_top";
    document.Login.method = "post";
    document.Login.submit();
    </SCRIPT>
    <%
    userid = request.getParameter("userid");
    password = request.getParameter("password");
    tab = request.getParameter("tab");
    %>
    <form name="Login" Border="0" TopMargin="0" LeftMargin="0" Marginheight="0" Marginwidth="0">
    <table>
    <tr>
    <td class="FORMHEADERLEFTB"><b> Login</td>
    <td class="FORMHEADERLEFT">:</td>
    <td><input TYPE="TEXT" NAME="userid" SIZE="25" VALUE="<%=userid%> MAXLENGTH="10"></td>
    </tr>
    <tr>
    <td class="FORMHEADERLEFTB"> Password</td>
    <td class="FORMHEADERLEFT">:</td>
    <td><input TYPE="password" NAME="password" SIZE="25" VALUE="<%=password%>" MAXLENGTH="10" onChange="check_password()"></td>
    </tr>
    </table>
    <input type="hidden" name="sessionid" value="999999">
    </form>
    Thanks
    suresh
    null

    How are you retrieving the parameter values? I am able to retrieve parameters successfully using the following simple testcase:
    untitled1.jsp:
    <form method="post" action="servlet1">
    <P>Username:
    <input type="text" name="un"/>
    </P>
    <P>Password:
    <input type="text" name="pw"/></P>
    <P>
    <input type="submit" value="Submit"/>
    </P>
    </form>
    servlet1.java: (copy and paste from doGet() to doPost() method depending on value of form method in untitled1.jsp)
    String un = request.getParameter("un").toString();
    String pw = request.getParameter("pw").toString();
    out.println(un);
    out.println(pw);
    Please test this and let me know your results and the differences with what you are trying to do.
    Regards,
    Lynn
    Java Tools Team

  • Request.getParameter("_ROWKEY") returns null in JDev 3.2

    My SubmitEditForm.jsp uses a bean which inherits from the EditCurrentRecord data web bean. In JDeveloper 3.1 'request.getParameter("ROWKEY")' in this JSP returns the rowkey for the record being edited, but in JDeveloper 3.2 'request.getParameter("_ROWKEY")' returns null. No modifications have bean made to the application - the working JDeveloper 3.1 app has only been compiled in JDeveloper 3.2. Can anyone help please?

    Hi,
    This exception is raised when the multipart/form-data parser has read the number of bytes specified by the Content-Length HTTP header, or tries to read past the end of the input stream, but has not parsed to the end of the message. As implied by the error text, this can happen for a couple of reasons.
    Although its unlikely, it is possible for a client to sent an incorrect Content-Length header. However, we've so far only seen this with a user-written HTTP client. We have yet to see a browser send the wrong value.
    The usual reason for this error is if a user hits the stop button while submitting a form. If the browser has already sent the HTTP header, including Content-Type, then the parser will try to read the entire message. However, this is going to fail, as the browser stops sending the request as soon as the stop button is pressed.
    Finally, there is one more possible reason for this error, and that is if the request is somehow being 'munged' in some way between the browser and the servlet container.
    To help us better understand what is happening here, can you supply
    the following information:
    - Does this problem happen consistently or occur only randomly?
    - When it does happen, is it repeatable, or does it go away if the user hits the submit button again?
    - Does it happen with certain HTML forms, any HTML form, or is it specific to the data entered into a pariticular form?
    - Does it happen with any browser, or a specific version and/or implementation?
    - What is your network configuration? For example, does the problem occur only when going through a proxy server or fire wall.
    - Does it depend on network load? For example, does it happen only at heavy load times?
    - What is you web server configuration, on what platform are you running it, and what JDK version are you using?
    As I'm writing this, the TAR system is down for upgrades - my apologies if you've already supplied this information.
    Regards,
    Simon
    null

  • Not able to get the full value from request.getParameter()

    hi all,
    Iam giving a text input value as" Analysis and tracking" in one jsp form.
    while fetching and assigning the value to another variable using request.getparameter , iam getting only the text "Analysis" , the space after it were ignored andnt displaying it.
    Help me in solving this.
    thanx
    Balaji

    I think you are code is something like this
    <input name="xyz" type="text" value=<%=variable%>>
    HTML ignores spaces. Therefore you are only getting Analysis, the first word, when your browser encounters the first space it ignores whatever is present after that.
    One way of overcoming this is putting double quotes around the text value
    <input name="xyz" type="text" value=<% out.println("\"" + variable + "\""); %>
    Thanks.

  • Submitting request.getParameter value on page submit

    I am getting the value from the request parameter as under
    <%
    String mod = request.getParameter("mod");
    %>
    Now i want this mod value to be submitted as page submits. For that i used:
    <h:inputHidden id="mod_field" value="" />
    Now the question is how to pass the above mod value using this hidden input? and secondly how to bind it with the property in the backing bean (say the name of my backing bean is bean.navigation) so that i can access and use the value.

    Hay this exception has again started showing me up.
    exception
    org.apache.jasper.JasperException: javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.el.ReferenceSyntaxException: param.mod
         org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    root cause
    javax.servlet.ServletException: javax.servlet.jsp.JspException: javax.faces.FacesException: javax.faces.el.ReferenceSyntaxException: param.mod
         org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:854)
         org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
         org.apache.jsp.tsheetRcode_jsp._jspService(tsheetRcode_jsp.java:344)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
    root cause
    javax.faces.el.EvaluationException: javax.faces.FacesException: javax.faces.el.ReferenceSyntaxException: param.mod
         com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:206)
         com.sun.faces.el.ValueBindingImpl.getValue(ValueBindingImpl.java:154)
         javax.faces.component.UIOutput.getValue(UIOutput.java:147)
         com.sun.faces.renderkit.html_basic.MenuRenderer.getCurrentSelectedValues(MenuRenderer.java:670)
         com.sun.faces.renderkit.html_basic.MenuRenderer.renderOption(MenuRenderer.java:549)
         com.sun.faces.renderkit.html_basic.MenuRenderer.renderOptions(MenuRenderer.java:525)
         com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:481)
         com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:430)
         javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:712)
         javax.faces.webapp.UIComponentTag.encodeEnd(UIComponentTag.java:616)
         javax.faces.webapp.UIComponentTag.doEndTag(UIComponentTag.java:539)
         com.sun.faces.taglib.html_basic.SelectOneMenuTag.doEndTag(SelectOneMenuTag.java:505)
         org.apache.jsp.tsheetRcode_jsp._jspx_meth_h_selectOneMenu_0(tsheetRcode_jsp.java:449)
         org.apache.jsp.tsheetRcode_jsp._jspService(tsheetRcode_jsp.java:263)
         org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
         org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
         com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:147)
         com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
         com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
         com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
         javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)

  • Servlets, request.getParameter()

    How do I test a servlet in Jdeveloper
    that wants a param from the calling URL, like
    http://.../servlet?myparam=myvalue
    via
    val=request.getParameter("myparam");
    I did already figure out, how to get init-Parameters, from
    webtogo.ora
    with
    getInitParameter();
    but that is not what I want, I want normal
    parameters.
    Running my servlet within jdev pops up
    a page with WebAppRunner.html in my Browser,
    that calls the servlet in jdev, I even tried handcoding my param there with no succes
    so far.
    Thanks for any help in advance.
    Rx
    null

    Hi Ganesh,
    Rx can u help me out on this.
    I have an applet that access a servlet and fetches information
    via a vector. The applet also sends the information via vector
    back to the Servlet. But the servlet fails to write into the
    database.
    Thanks in advance!!!Thank you for your confidence,
    I'm sorry for not being able to answer your question right away.
    * You might post some code examples,
    hopefully reduced to the minimum of what is
    needed to understand your problem.
    * You should consider opening a new thread
    as your problem seems only loosly related
    to mine.
    * I am just an Oracle JDeveloper user having
    gained some experience with jdev and the bc4j framework, but without the insight
    of the sourcecode.
    * You can however expect the people from
    the Oracle JDeveloper Team to be more
    responsive to user questions. - My general
    experience is, that the responsiveness
    in open source projects forums/mailing lists/newsgroups is much better. - They should be interested in their user's problems.
    Rx
    null

  • Unable get complete filepath from jsp page using request.getParameter()

    Hey all,
    i am actually trying to get the selected file path value using request.getParameter into the servlet where i will read the (csv or txt) file but i dont get the full path but only the file name(test.txt) not the complete path(C:\\Temp\\test.txt) i selected in JSP page using browse file.
    Output :
    FILE NAME : TEST
    FILE PATH : test.txt
    Error : java.io.FileNotFoundException: test.txt (The system cannot find the file specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.java:106)
    at java.io.FileReader.<init>(FileReader.java:55)
    at com.test.TestServlet.processRequest(TestServlet.java:39)
    at com.test.TestServlet.doPost(TestServlet.java:75)
    JSP CODE:
    <%@page contentType="text/html" pageEncoding="UTF-8"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>DEMO SERVLET</title>
    </script>
    </head>
    <body>
    <h2>Hello World!</h2>
    <form name="myform" action="TestServlet" method="POST"
    FILE NAME : <input type="text" name="filename" value="" size="25" /><br><br>
    FILE SELECT : <input type="file" name="myfile" value="" width="25" /><br><br>
    <input type="submit" value="Submit" name="submit" />
    </form>
    </body>
    </html>
    Servlet Code :
    protected void processRequest(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException, FileNotFoundException {
    response.setContentType("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter();
    try {
    String filename = request.getParameter("filename");
    out.println(filename);
    String filepath = request.getParameter("myfile");
    out.println(filepath);
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet TestServlet</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");
    if (filepath != null) {
    File f = new File(filepath);
    BufferedReader br = new BufferedReader(new FileReader(f));
    String strLine;
    String[] tokens;
    while ((strLine = br.readLine()) != null) {
    tokens = strLine.split(",");
    for (int i = 0; i < tokens.length; i++) {
    out.println("<h1>Servlet TestServlet at " + tokens[i] + "</h1>");
    out.println("----------------");
    out.println("</body>");
    out.println("</html>");
    } finally {
    out.close();
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    processRequest(request, response);
    Needed Output :
    FILE NAME : TEST
    FILE PATH : C:\\Temp\\test.txt
    Any suggestions Plz??

    As the [HTML specification|http://www.w3.org/TR/html401/interact/forms.html] states, you should be setting the enctype to multipart/form-data to be able to upload files to the server. In the server side, you need to process the multipart/form-data binary stream by parsing the HttpServletRequest#getInputStream(). It is a lot of work to get it to work flawlessly. There are 3rd party API's around which can do that for you, such as [Apache Commons FileUpload|http://commons.apache.org/fileupload] (carefully read the User Guide how to use it).
    You can also consider to use a Filter which makes use of the FileUpload API to preprocess the request so that you can continue writing the servlet code as usual. Here is an example: [http://balusc.blogspot.com/2007/11/multipartfilter.html].

  • Request.getParameter comes blank on some browser, while works on other

    Hi,
    Need urgent help to rectify thie problem
    I am accessing a application hosted on Weblogic8 SP2 as WAR file
    In this application I am able to login and search result and go to home page of one the search results.
    But on some other machine on same IE6 or Firefox the forward from search results to Home page stops in a URL which is being used in middle to forward.
    URL (also used in JSP pasted below) is created in action class called by search result link.
    This is how it is impleted.....
    I have a replicated link with unique Id on Search result page which forward me to this JSP
    <head>
    <SCRIPT language="JavaScript">
    function submitform()
    var urlString = "<%=request.getAttribute("urlString")%>";
    document.form1.action =urlString;
    document.form1.submit();
    </SCRIPT>
    </head>
    <body onload="submitform();">
    <form name = "form1" method = "POST">
    <input type = "hidden" name="myVariable" value="myValue"></input>
    <input type = "hidden" name="empID" value="<%=request.getAttribute("empID")%>"></input>
    <input type = "hidden" name="ownerName" value="<%=request.getSession().getAttribute("ownerName").toString()%>"></input>
    </form>
    </body>
    </html>
    Once this JSP is submitted this URL has to call a action class to validate some session attribute and the hidden value in JSP above named as "myVariable" which is checked for some "myValue". So it will then Forward to Home Page.
    On some machines IE6 or FireFox this is working as expected and logs show correct results all through.
    But some other machines with same Browser, the "myVariable" value in action class is coming blank and so request stops at the URL submit in above JSP. However no errors or Exceptions are thrown.
    Please help in this issue if some one can suggest any solution or way to dig up more on this.
    Also if I havent explained clearly by chance, then pls give me another chance to explain more.
    Thanks a lot for all your efforts.

    Hi,
    Thanks for reply,
    Nop our WAR do not have any filter. and We used IE 6 and FireFox 2 on both machines. We also saw the Options for both browser and matched these for both machines. They were same.
    The javascript we used was to submit the form on click of a Href. but it do not use any JSP element. We had just set a value in <input type="hidden"...
    and this value we fetch in Java class by saying request.getParameter("name");

  • Request.getParameter() always returns null

    I have a html file and am trying to retrieve the values from a formin my servlet.
    here is the html code:
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <h1><b>Add DVD</b></h1>
    </head>
    <body>
    <form action="add_dvd.do" method="POST">
    Title:<input type="text" name="title" />
    Year:<input type="text" name="year" />
    Genre: <select name='gselected'>
    <option value='Sci-Fi'>Sci-Fi</option>
    </select>
    or enter new genre:<input type="text" name='gentered' value="" />
    <input type="submit" value="Add DVD" />
    </form>
    </body>
    </html>
    and here is the servlet code:
    public class AddDVDServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    // System.out.println("in AddDVDServlet post method");
    List errorMsgs = new LinkedList();
    //retrieve form parameters
    try{
    String title = request.getParameter("title").trim();
    String year = request.getParameter("year").trim();
    *String gentered = request.getParameter("gentered");
    String gselected = request.getParameter("gselected");
    String genre="";
    if("".equals(gentered))
    genre = gselected;
    else
    genre = gentered;
    // System.out.println("parameter retrieved");
    if(!year.matches("\\d\\d\\d\\d"))
    // System.out.println("year not 4 digit long");
    errorMsgs.add("Year must be four digit long");
    if("".equals(title))
    // System.out.println("title not entered");
    errorMsgs.add("Please enter the title of the dvd");
    if("".equals(genre))
    // System.out.println("genre not valid");zdf
    errorMsgs.add("Enter genre.");
    if(! errorMsgs.isEmpty())
    //System.out.println("errors in entry ");
    request.setAttribute("errors",errorMsgs);
    // System.out.println("error attribute set in request");
    RequestDispatcher rd = request.getRequestDispatcher("error.view");
    rd.forward(request, response);
    return;
    //create DVDItem instance
    DVDItem dvd = new DVDItem(title,year,genre);
    request.setAttribute("dvdItem",dvd);
    RequestDispatcher rd = request.getRequestDispatcher("success.view");
    rd.forward(request, response);
    catch(Exception e){
    errorMsgs.add(e.getMessage());
    request.setAttribute("errors",errorMsgs);
    RequestDispatcher rd = request.getRequestDispatcher("error.view");
    rd.forward(request, response);
    e.printStackTrace();
    System.out.println("exception:"+e);
    why does getParameter always return null??? whats wrong?

    I don't know. However, I suspect that because you have a tag with the same name as 'title', its causing a name conflict. Chnage the name to something else. If it works, then that's the likely explaination.

  • Request.getParameter problem

    Did any one faced the problem please provide me a solution I am converting a project to WebSphere. using J2EE jsp 1.1 from NAS,jsp 0.92
    I have a jsp page and I am submitting the form:
    Test.jsp
    <body>
    <form name="frm" method="post" action="TestServlet">
    <INPUT type="CHECKBOX" name="CKBXVCH23" value="A" checked>A
    <INPUT type="CHECKBOX" name="CKBXVCH23" value="B" checked>B
    <INPUT type="CHECKBOX" name="CKBXVCH23" value="C" checked>C
    </form>
    </body>
    TestServlet:
    when i do String str=request.getParameter("CKBXVCH23")
    I am getting only str="A"
    It suppose to give str=A;B;C because I have selected all the three items Its working fine in iPlanet, jsp 0.92
    can anyone know whats the diffenrece.???
    Thanks
    zakir hussain

    If you change the post to a get so you can see what is passed to the servlet you'll see the following parameters are passed:
    CKBXVCH23=A&CKBXVCH23=B&CKBXVCH23=C
    You need to use the
    public java.lang.String[] getParameterValues(java.lang.String name)
    mehod to get an array of all the values associated with "CKBXVCH23"

  • Request.getParameter("") values: Are they null or ""?

    Hello:
    I have a web page that links up to a MYSQL database. I use JSP files to process the database queries from an HTML form. However, I am having an issue after moving the code from MYSQL 5.0 and JDK 1.5 to a machine with MYSQL 4.X and JDK 1.4.X
    I am enabling user to enter several pieces of search criteria that I, in turn, use to build the SQL syntax statement. And I test to see which HTML fields the user has entered something into so that the SQL only includes those where statements.
    I first had the following to process the individual search criteria into SQL where statements:
    String tester1 = request.getParameter("tester");
    String tester = "";
    if (tester1 != "") {
         tester += " tester like \"" + tester1 + "%\"" + " and ";
         } else {
    tester += "";
    so if the user enter "Tommy in the tester field as a search criterion this part of the SQL would be
    tester like Tommy%
    Then I build the select statment with only the where statements that the user is interested in (and provided search criteria on):
    String syntax = "Select * from database where ";
    String array[] = { tester, call_from, call_to, r_no, rec_no, date };
    for (int counter=0;counter<array.length;counter++){
              if (array[counter] != "") {
              syntax += array[counter];
    int a = 0;
    int b = (syntax.length() - 4);
    String syntax1 = syntax.substring(a, b);
    so the above would create
    Select * from database where tester like Tommy%
    This worked on the previous machine. However, it no longer works on the machine with the older apis. So I have tried everything to weed out the blank database fields so they are not factored in the query (if they are they return nothing as these fields are required to be entered into the database). I tried this:
    String tester1 = request.getParameter("tester");
    String tester = "";
    if ((tester1 != "") || (tester1 != null)){
         tester += " tester like \"" + tester1 + "%\"" + " and ";
         } else {
    tester += "#";
    . . . and then . . .
    String syntax = "Select * from database where ";
    String array[] = { tester, call_from, call_to, r_no, rec_no, date };
    for (int counter=0;counter<array.length;counter++){
              if (array[counter] != "#") {
              syntax += array[counter];
    int a = 0;
    int b = (syntax.length() - 4);
    String syntax1 = syntax.substring(a, b);
    But no matter what I try the query that gets sent to the database is as follows:
    Select * from qa_data where tester like "%" and called_from_1 = "" and call_to = "" and r_no = "" and rec_no = "" and (date >= "" and date <= "")
    So I am at a loss. It appears that I am not testing for the correct value that the browser is sending to my JSP file when a user does not enter a value in the field. What other than "" and null are there? I have tested for one or the other and both. I am at a loss now as to what to do. I am only concerned with IE6/7 and Firefox 1.5
    I output what the value being sent to the JSP file was and it was something like "The tester value is:". So, basically it isn't anything ("").
    Can anyone help me here?

    Rule #1 when comparing strings: use the equals() method, rather than == or !=
    You only use == when checking for null, or checking to see if it is the same object.
    if (tester1 == null || tester1.trim().equals("")){
      // value is null/empty/spaces only
    else {
      // a value is present
    }

  • Request.getParameter() not working correctly for Check Boxes!

    Hi,
    I am writing my own custom form action in cq5.4 and I need to access the fields of my form. I have a checkbox component on my form named 'cbox' and now I want to access it.
    So this is the code I'm writing in the JSP
    String name = request.getParameter("cbox");
    But when I fill up the data on the form and submit it.. I only get the first element of the checkbox which I had selected. So suppose if the checkbox was having some options..
    a
    b
    c
    d
    and if I selected b and d then I only get 'b'.
    Actually the type of the name variable must be String Array. But when I do..
    String[] name = request.getParameter("cbox");
    //it gives me compilation error saying cannot convert from String to String[]
    I cannot understand whats happening here. Can someone help me? How do I find out that which options has the user checked?
    Thanks!

    I think you are looking for getParameterValues().
    If you read http://docs.oracle.com/javaee/1.3/api/javax/servlet/ServletRequest.html#getParameter(java. lang.String) and http://docs.oracle.com/javaee/1.3/api/javax/servlet/ServletRequest.html#getParameterValues (java.lang.String), you'll see the behavior you are seeing is as-documented.

  • Request.getParameter() values in servlet? Urgent

    String str=request.getParameter();
    I am facing a problem when i submit the arabic values from hidden form fields using javascript.
    In servlet when i tries to retrive the arabic values stored in the session, it displays only
    garbage values(ie. ?????????).
    How to solve this problem?
    Please clarify and if possible give some samples.
    Thanks & Regards,
    Govindaraman

    Hi Govindaraman,
    in O'Reilly's Servlet book in the internationalization section it describes how. You have to change the String returned into bytes using the proper enconding, then back into a String to it will convert to Unicode.
    The basics are this:
    String parameterName="your param name";
    String encoding = "your charset encoding on the page";
    String value = request.getParameter(parameterName);
    value = new String(value.getBytes(), encoding);
    value is now a Unicode string that should be correctly interpreted.
    You can use new String( oldString.getBytes(), encoding) to convert between charsets.

  • Request.getParameter returns null - Converting webapp from Tomcat to oc4j

    I support a simple web app that passes arguments via url context variables. For some reason it does not work in OC4J. When I use request.getContextPath() I see that the URL string only contains the webapps name, not the whole URL with parameters set.
    BTW it is an OC4J cluster

    *Name:             index.jsp
    *Function:         This page is 1st url for WebApp
    *Information:      This page is used as the home page for this application.
    *Version:          1.0 (created on 2005-06-06)
    * 2.0 052406 pge
    %>
    <%@ page pageEncoding="UTF-8"%>
    <%@ page import="com.hp.itsm.api.*" %>
    <%@ page import="com.hp.itsm.api.interfaces.*" %>
    <%@ page import="java.text.Collator" %>
    <%@ page import="java.util.*"%>
    <%@ page contentType="text/html; charset=utf-8" %>
    <%@ include file="include/variables_initialize.jsp" %>
    <%@ include file="include/methods_global.jsp" %>
    <%@ include file="include/methods_servicedesk.jsp" %>
    <%
    String login = request.getParameter("u");
    String xxx = request.getContextPath();
    //Service Call objects
    ApiSDSession SDsession = null;
    IPerson[] personList = null;
    IAccount accountRequester = null;
    Boolean bError = Boolean.FALSE; //Default to no errors found
    List errMsgList = new ArrayList(); //Array of error messages
    //Get account information
    accountRequester = getAccount(SDsession, login);
    if (accountRequester == null) {
    bError = Boolean.TRUE;
    errMsgList.add("Could not retrieve the accountRequester.");
    }

Maybe you are looking for

  • Maxl doesn't logout after Calc Script execution

    Hi All, I have a batch script which runs to load data and then aggregate data using calc script. Maxl completes the load and then starts the calculation execution but this never ends. I tried looking into the logs and it shows that Calc Script execut

  • Powerbook won't  sleep automatically

    Hi, im reposting because no one replied to my initial post, my powerbook recently stop going to sleep on its on unless i do it manually. Every other energy saving settings works normally the display sleeps after a while but not the computer itself. D

  • PO Output Email

    Hi all, We are in SRM extended classis senario. For the PO output, we have created the 2 different smartforms based up on the output medium. One for - print Another smart from - mail . .Incase of email smart form, we noticed that when the PO output i

  • Calling two different clients in SOLAR02-configuration

    Hi Experts, I have got two clients one for Configuration and another for development - All the necessary settings have been done and they are assigned to the project system landscape. since both of them belongs to the same logical component(SAP ECC)

  • What photoshop can I download on to a mac 10.5.8?

    My mac book is not a pro but I want to download photoshop in a free trial - is there one compatible? Thank you!