Double type for request.getParameter

Hi , I have a page to get a parameter which is a double
I declare :
Double score = request.getParameter("score") == null ? "" : request.getParameter("score");
But I got error :
incompatible types found; java.lang.String, required:java.lang.Double.
Any idea how to solve this.
I appreciated for any solution.
Thank you very much in advance.

request.getParameter always returns a string, so you'll have to convert it to a double.
Something like this:
String score = request.getParameter("score");
Double score = (score == null) ? 0 : new Double(score);

Similar Messages

  • Equivalent for %= request.getParameter("input") %

    I am using facelets what is the equivalent for
    <%= request.getParameter("input") %>

    #{param.input}

  • Shorthand for request.getparameter

    hi,
    i've recently discovered the ${} shorthand for get attribute ie.
    <% request.setAttribute("test","100");%>
    <p>${test}</p>
    where ${test} will write the value of 100 to screen. conveniently this doesn't give a null error if test is undefined. even more conveniently it seems to have some automatic kind of casting so
    ${test/2}
    will return the value of 50.0 without the need to convert to an integer (or similar)
    i was wondering if anyone knew of a similar shorthand for displaying request.getParameter() objects and/or strings.
    cheers,
    ben

    The expression language is currently available only in attribute values.
    Future versions will allow its use in template text.
    shame it's not implemented yet.Ahh but it is.
    EL available only in attribute values applies only to JSP1.2 containers, when using JSTL.
    The "future version" is JSP2.0. That is available in Tomcat 5.
    the shortcut for request.getParameter("myString");
    is
    ${param.myString}
    Check out the implicit objects available in EL:
    http://java.sun.com/products/jsp/syntax/2.0/syntaxref207.html#1010522
    Cheers,
    evnafets

  • Shorthand for request.getParameter v2

    quick recap, thanks to evnafets for showing
    the shorthand for
    <%=request.getParameter("myString")%>
    or
    <%=request.getParameter("myString")!=null?request.getParameter("myString"):""%>
    is
    ${param.myString}
    cheers,
    ben

    btw: i've tested this using resin 3 and it works fine

  • Boolean & Double types for Data Objects

    Are the Boolean and Double types going to be supported/implemented as usable types for Process/Project data objects?
    The option is available for each of these in JDeveloper, but they become highlighted in red when you select them and if you accept they get converted into String types. I'm not sure if this means this isn't implemented yet or it won't be supported. If they're not supported types they shouldn't be displayed as options.

    That is currently I bug that I found as well. If you type in the type name manually as Bool that should work. For Double I think it is either Real or Decimal. Once you type in these values the red will go away and they will work.

  • Partner for request.getParameter?

    Hello,
    Does Servlet API contain any methods to add parameter to
    querystring?
    I have a situation where I should add key=value-pair to request
    that I am forwarding to other servlet.
    How can this kind of thing be handled?
    There are no request.setParameter or response.setParameter methods
    or I did not find them. And using request.setAttribute does not work in
    this case.
    Is it possible to do a own new request and fill a new
    key=value-pair there ?
    Can anyone help me?
    Thanks,

    Here's an extract from the servlet spec:
    Java Servlet Specification Version 2.2 39
    In the ServletContext and ServletRequest methods which allow the creation of a RequestDispatcher using path information, optional query string information may be attached to the path. For example, a Developer may obtain a RequestDispatcher by using the following code:
    String path = ?/raisons.jsp?orderno=5?;
    RequestDispatcher rd = context.getRequestDispatcher(path);
    rd.include(request, response);The contents of the query string are added to the parameter set that the included servlet has access to. The parameters are ordered so that any parameters specified in the query string used to create the RequestDispatcher take precedence. The parameters associated with a
    RequestDispatcher are only scoped for the duration of the include or forward call.
    i.e. you can add or override parameters by including them on the getRequestDispatcher() path.

  • Double type for output

    I need the Celcius output to be two decimal places. When I enter
    75 for Fahrenheit the result shows 23.88888888.
          //  Performs the conversion when the enter key is pressed in
          //  the text field.
          public void actionPerformed (ActionEvent event)
             double fahrenheitTemp;
            double celciusTemp;
             String text = fahrenheit.getText();
             fahrenheitTemp = Double.parseDouble(text);
             celciusTemp = (double)Math.round(fahrenheitTemp-32) * 5/9;
            resultLabel.setText (Double.toString(celciusTemp)); 
          }

    You could use Class DecimalFormat.
              double number = 1.123456789;
              DecimalFormat df = new DecimalFormat("0.00");
              String formatted = df.format(number);

  • Idoc type and message type for request for quotation

    hi

    MM Side...
    Message Type REQOTE
    Basic type ORDERS05
    SD side..
    Message type QUOTES
    Basic type ORDERS05
    Process code SD12                    
    "Reward point if usefull"
    Thanks,
    Narayan

  • Help needed in request.getParameter

    I have one table with field
    EMP_ID varchar(10) latin1_swedish_ci PRI
    I am passing the value of emp_id from one page to another.In the second page using request.getParameter i am receiving the value
    first page
    code:
    out.println("<td><a href = viewEmp.jsp?id=" + id + " /a>View</td>");
    in second page
    code:
    String tempQuery ="Select * from GSIS_EMP_MASTER where EMP_ID = "+ request.getParameter("id");
    Above are working fine if the EMP_ID is integer.If it is not integer like 3sd or 1a... i am getting error of
    Exception : java.sql.SQLException: Error during query: Unexpected Exception: java.sql.SQLException message given: Column not found: Unknown column '1a' in 'where clause'
    thanks
    Edited by: priyap on May 14, 2008 6:08 AM

    String tempQuery ="Select * from GSIS_EMP_MASTER where EMP_ID = "+ request.getParameter("id");if it is string then include double quotes for that getParameter()
    "Select * from GSIS_EMP_MASTER where EMP_ID = '"+ request.getParameter("id")+"'";observe it carefully i've enclosed the getParameter() with single quotes. you can use double quotes also but don't forget to use \" to avoid escape sequenses
    Edited by: Diablo_Chiru on May 13, 2008 11:47 PM

  • 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.

  • Incorrect MIME type for XML Data Connection POST requests

    It appears that Xcelsius 2008u2019s XML Data Connection logic does not specify the correct MIME type for the data it sends to the server in its POST request.  Using an HTTP debug proxy, I was able to see that Xcelsius sends XML data in the POST, but is setting a content-type of u201Cx-www-form-urlencodedu201D.  According to the W3C spec:
      http://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
    Data sent with a MIME type of u201Cxxu201D should be encoded as key?value pairs, like this:
      key1=val1&key2=val2&Submit=Submit
    So, what Xcelsius is doing is clearly incorrect.  Worse, if your server process is a Java servlet, you may find that the POSTed data will be gobbled up by the servlet container and you wonu2019t be able to read it using a getInputStream(), or getReader() call because itu2019s already been processed by a call to the getParameter() method.
    The correct mime type for POSTing an XML formatted request from Xcelsius should be "text/xml".
    Wayne

    Hi,
    The Error #2032 your getting is due to the Flash player security.
    To remove this this error you need one crossdomain Xml file in the root directory which actually provides a lot more control over who has access to your data from a SWF. The cross domain policy is attached as crossdomain.xml.
    In the XML file, it is used a wildcard (*). This allows a SWF located on any machine to access your data source. You can certainly use an IP address or domain name to restrict access rather to opening it up completely. I always start with the wildcard to make sure my dashboard works, then start restricting access as necessary.
    Here is a whitepaper with everything you need to know about Flash player security:
    http://www.adobe.com/devnet/flashplayer/articles/flash_player_9_security.pdf
    Please let me know if you need any more clarification.
    Regards,
    Sanjay

  • In WL6.1 request.getParameter returns NULL for URL parameters that exist

              With the following URL, I get different results between WebLogic 4.5.1 and WebLogic
              6.1:
              http://phx-kmccarthy.medspecialists.net/tsweb/ParametersTest.jsp?apple=macintosh&tree&dog&country=USA
              Weblogic 6.1 returns:
              query string = apple=macintosh&tree&dog&country=USA
              apple = macintosh
              tree = null
              dog = null
              country = USA
              WebLogic 4.5.1 returns:
              query string = apple=macintosh&tree&dog&country=USA
              apple = macintosh
              tree =
              dog =
              country = USA
              here is the jsp...
              <%--
              * ParamtersTest.jsp which shows that empty parameters are ignored in WebLogic
              6.1
              --%>
              <%
              String apple, tree, dog, country;
              apple = request.getParameter("apple");
              tree = request.getParameter("tree");
              dog = request.getParameter("dog");
              country = request.getParameter("country");
              out.println("<br>query string = " + request.getQueryString());
              out.println("<br>apple = " + apple);
              out.println("<br>tree = " + tree);
              out.println("<br>dog = " + dog);
              out.println("<br>country = " + country);
              %>
              From the documentation on the getParameter() method:
              Returns the value of a request parameter as a String, or null if the parameter
              does not exist.
              In my opinion, not existing and being empty are different. Also, every other web
              application environment we've dealt with (including WebLogic 4.5.1) treats them
              as different. If the parameter doesn't have a value, (i.e. ...&tree&dog&...) then
              getParameter() returns the empty string, not null.
              As a result of this we have JSPs that break when running on 6.1.
              

    Found the solution at last. Tomcat servlet container can't handle the chunked transfer-encoding that the J2ME Wireless Toolkit uses when you call outputstream.flush() in midlet. Using outputstream.close() instead of outputstream.flush() will avoid this problem for small requests. For all the codes in the articles on Http Post in Wireless Forum, don't use outputstream.flush() and it will run perfectly - Servlet's request.getParameter(parameterName) will work fine in doPost method.

  • Error: invalid content type for SOAP: TEXT/HTML; HTTP 400 Bad Request

    Hi Gurus,
    i am hardly fighting with this error in Communication Channel Monitoring:
    Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.io.IOException: invalid content type for SOAP: TEXT/HTML; HTTP 400 Bad Request
    SOAP: call failed: java.io.IOException: invalid content type for SOAP: TEXT/HTML; HTTP 400 Bad Request
    This is my scenario.
    I do a File to SOAP Scenario. in SXI_MONITOR everything is fine.
    My CommChan is a SOAP Receiver
    HTTP
    SOAP 1.1
    Central Adapter Engine
    Target URL is https --> i check url for correctness
    Configure User Authentication is checked and username and pw are given and are correct.
    Configure Certificate Authentication is checked are working
    Configure Proxy is checked and Host and port are povided.
    SOAP Action is provided
    In Tab Module
    if have this Processing Sequence
    1     localejbs/AF_Modules/MessageTransformBean     Local Enterprise Bean     transform
    2     sap.com/com.sap.aii.af.soapadapter/XISOAPAdapterBean     Local Enterprise Bean     1
    and this Module configuration (and only this)
    transform     Transform.ContentType     text/xml;charset=utf-8
    (according to /people/sobhithalaxmi.kata/blog/2009/07/21/cost-free-edi-integration-using-message-transformation-bean)
    As far as i understand that my http header should have Content-Type: text/xml;charset=utf-8 now. I don't understand why Communication Channel Monitoring shows an error according to content TEXT/HTML.
    Can anyone help me with that?
    Is it possible that Transform.ContentType does not work for SOAP Receiver Adapter?
    is there any chance to view the HTTP-Header of the outgoing SOAP Request (with PI Transaction / Java Enironment) to convince myself that the HTTP Header is text/xml?
    Thank you in advance and Best Regards
    Udo

    Hi Thanks for your fast replies.
    The Provider of the Endpoint tells me that he needs text/xml as content-type. When I sent a message to the given Endpoint via SOAP UI I can see in the HTTP LOG of SOAP UI that the Endpoint is also sending text/xml back.
    Below you find the Details log out of the CommChan Monitoring.
    2011-04-29 11:37:45 Information The message status was set to TBDL.
    2011-04-29 11:37:45 Information Retrying to deliver message to the application. Retry: 3
    2011-04-29 11:37:45 Information The message was successfully retrieved from the receive queue.
    2011-04-29 11:37:45 Information The message status was set to DLNG.
    2011-04-29 11:37:45 Information Delivering to channel: getxxxxx_In  <---- name of my SOAP Receiver CommChan
    2011-04-29 11:37:45 Information Transform: using Transform.Class:  $identity
    2011-04-29 11:37:45 Information Transform: transforming the payload ...
    2011-04-29 11:37:45 Information Transform: successfully transformed
    2011-04-29 11:37:45 Information SOAP: request message entering the adapter with user J2EE_GUEST
    2011-04-29 11:37:46 Error SOAP: call failed: java.io.IOException: invalid content type for SOAP: TEXT/HTML; HTTP 400 Bad Request
    2011-04-29 11:37:46 Information SOAP: sending a delivery error ack ...
    2011-04-29 11:37:46 Information SOAP: sent a delivery error ack
    2011-04-29 11:37:46 Error SOAP: error occured: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.io.IOException: invalid content type for SOAP: TEXT/HTML; HTTP 400 Bad Request
    2011-04-29 11:37:46 Error Adapter Framework caught exception: java.io.IOException: invalid content type for SOAP: TEXT/HTML; HTTP 400 Bad Request
    2011-04-29 11:37:46 Error Delivering the message to the application using connection SOAP_http://sap.com/xi/XI/System failed, due to: com.sap.engine.interfaces.messaging.api.exception.MessagingException: java.io.IOException: invalid content type for SOAP: TEXT/HTML; HTTP 400 Bad Request.
    2011-04-29 11:37:46 Error The message status was set to NDLV.
    What i am missing is a hint on the Message Transform Bean and a on a successfull sending process.
    What i also tried already:
    i also activated the checkbox "Do not use SOAP Envelop" in CommChan Configuration. The Result you see below (the last log entry is on first line - so read from bottom to top)
    Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: SOAP: response message contains an error XIAdapter/HTTP/ADAPTER.HTTP_EXCEPTION - HTTP 400 Bad Request
    error in response
    call completed
    request entering
    Message processing started
    As you can see there is a "call completed" and "error in response" log entry. This is missing in in the first Log. So i guess the error is still in the sending process.
    Installing additional Software on the PI and use them to find out what the HTTP Request is is not possible as system access is very strict and limited :/

  • Cfhttp and setting the content-type for a request

    Hi,
    I am trying to set the content-type for a cfhttp request like this (on coldfusion 9):
    <cfhttp redirect="no" method="get" timeout="120" url="http://10.0.0.1/test2.cfm">
        <cfhttpparam type="HEADER" name="Content-Type" value="application/json; charset=utf-8">
    </cfhttp>
    // coding on test2.cfm:
    <cfset x = GetHttpRequestData()>
    <cfdump var=#x#>
    // Output on test2.cfm
    content
    [empty string]
    headers
    struct
    Accept-Encoding
    deflate, gzip, x-gzip, compress, x-compress
    Connection
    TE
    Host
    10.0.0.1:80
    Proxy-Connection
    close
    TE
    trailers, deflate, gzip, compress
    User-Agent
    ColdFusion
    X-REWRITE-URL
    http://10.0.0.1:80/test2.cfm
    method
    GET
    protocol
    HTTP/1.1
    As you can see no content-type is send through. I also tried the sniffer.exe:
    GET http://10.0.0.1:80/test2.cfm HTTP/1.1
    Host: 127.0.0.1
    Proxy-Connection: close
    Connection: TE
    TE: trailers, deflate, gzip, compress
    User-Agent: ColdFusion
    Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
    Here you can also see that no content-type was passed through. The sniffer should report back
    GET http://10.0.0.1:80/test2.cfm HTTP/1.1
    Host: 127.0.0.1
    Proxy-Connection: close
    Connection: TE
    TE: trailers, deflate, gzip, compress
    User-Agent: ColdFusion
    Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
    Content-Type: application/json; charset=utf-8
    But is does not, what do i need todo to set the content-type in a cfhttp request.
    Kind regards,
    Nebu

    12Robots - are you sure about your statement that GET method requests cannot have Content-Type headers?  I don't think that that is correct.  I've always thought that it was valid (maybe unusual, but ...) and this W3C link weems to agree, especially in the context of its comment about what Content-Type means in a HEAD method request: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
    The big problem with trying to get around the CFHTTP limitation by using the CGI scope is that the dash is illegal in a CF varname.
    There is a custom tag called CFHTTP5 that getsaround a lot of the CFHTTP limitations, including cookie preservation across multiple requests.  I haven't used it for a long time (CF5), but it is still actively developed.  Costs $50 - http://www.cftagstore.com/tags/cfxhttp5.cfm
    -reed

  • Regarding the exact link for configurate type for leave request

    Hi all:
       I am trying to  Customize Types of Leave/ Absence Types for Leave Requests following the route Personnel Management u2192 Employee Self-Service u2192 Service-Specific Settings u2192 Working Time u2192 Leave Request u2192 Processing Processes u2192 Specify Processing Processes for Types of Leave, but it turns not be there, maybe it is because of the sap version, could you please tell
    me the exact route for  Customize Types of Leave/ Absence Types ?
    thank you very much

    sorry , the above link is correct , I found the above linke missing like personnel management--employee self-servce, because Basis didn't delopy some pakcage , could you please tell me what package missed.
    thank you very much .
    Edited by: jingying Sony on May 7, 2010 7:58 AM

Maybe you are looking for

  • Skype not recognising microphone or vice versa??

    Hi, I can't get my microphone to work with Skype on my HP DX2300 Desktop PC.  Windows XP PRO. I have started using Skype, but so far only for texting. I have connected the microphone to the appropriate socket (microphone symbol on front of PC case).

  • Core i7-2720QM on Macbook pro 2011: Turbo Boost doesn't work! It's possible?

    I test my core speed with MacCPUID that show real time cpu frequency. I try it in normal condition and running extreme application. Everytime my cpu frequency is something like 2.199 - 2.200 but never more than 2.200 ghz. So I have to think that Turb

  • How PO will create automatically through idoc

    in our project, PO is automatically triggering with the Help to PR and displayed in Output message at Sales Order Level. If any one know the procedure, Pls let me understand. Thanks

  • How to update the business area

    suppose that i created a table in schema. now i want to update/upload that table in my business create. i know that i mannually need to do it by creating folders from the database but can it be automated or an auto refresh. cheers,

  • XI : Error read exchange profile

    Hi, we have upgrade a XI 20 to XI 70 and all seems ok but when we test the system to send an idoc to the XI 70 from our R3 we got this error in Transaction Canceled IDOC_ADAPTER 106 ( Error while reading exchange profile for system XSD )" in SM21 in