NumberFormatException

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oll3i
    Contributor
    • Mar 2007
    • 679

    #16
    Code:
    <html><head><link rel="stylesheet" type="text/css" href="css.css"/><title>HRMailer</title></head><body>
    <table width="900">
    <tr><td>
    <a href="inbox.jsp?k=+&f=0">
    next >>
    </a>

    Comment

    • chaarmann
      Recognized Expert Contributor
      • Nov 2007
      • 785

      #17
      Maybe I'm wrong, but using "+" as a value for variable k can be the reason that k and f have no values.
      How?
      You are using "+" directly in your URL when creating it with out.println. ( For example you print out href="inbox.jsp ?k=+&f=12") But you should use the hex-code string "%2B" for it instead "+". Because a plus-sign is converted to space when submitted to the server. When there is some redirection or other double-parsing of the URL, the space determines the end of the URL, therefore all characters following this space are cut off. (In your case "inbox.jsp? k= &f=12" changes to "inbox.jsp?k=") . The effect is that both variable k and f are empty.

      Comment

      • oll3i
        Contributor
        • Mar 2007
        • 679

        #18
        with out.println("<a href=\"inbox.js p?k=+&f=f\">");
        i get
        java.lang.Illeg alStateExceptio n: isHexDigit

        Comment

        • oll3i
          Contributor
          • Mar 2007
          • 679

          #19
          Code:
          <html><head><link rel="stylesheet" type="text/css" href="css.css"/><title>HRMailer</title></head><body>
          <table width="900">
          <tr><td>
          <a href="inbox.jsp?k=+&f=0">
          next >>
          </a>


          org.apache.jasp er.JasperExcept ion: java.lang.Numbe rFormatExceptio n: null

          Comment

          • oll3i
            Contributor
            • Mar 2007
            • 679

            #20
            Code:
            <%
                  
                    CCC ccc = new CCC();
                    ccc.doGet(request, response);
                   
                    %>

            Comment

            • oll3i
              Contributor
              • Mar 2007
              • 679

              #21
              if i change k=+ to k=1 it works

              Comment

              • oll3i
                Contributor
                • Mar 2007
                • 679

                #22
                how do i quote in out.println the plus sign?
                out.println("<a href=\"inbox.js p?k=+&f="+f+"\" >");

                Comment

                • oll3i
                  Contributor
                  • Mar 2007
                  • 679

                  #23
                  i have in url http://localhost:8080/CCC/inbox.jsp?k=+&f=0

                  and doGet is not working

                  Comment

                  • oll3i
                    Contributor
                    • Mar 2007
                    • 679

                    #24
                    String k=request.getPa rameter("k"); is not working neither

                    Comment

                    • chaarmann
                      Recognized Expert Contributor
                      • Nov 2007
                      • 785

                      #25
                      how do i quote in out.println the plus sign?
                      Did you have difficulties understanding my previous reply? (if yes, don't hesitate to ask)
                      I told you to use the hex value "%2B" for it. That means:
                      Code:
                      out.println("<a href=\"inbox.jsp?k=%2B&f="+f+"\">");
                      if i change k=+ to k=1 it works
                      That means I was right and the improper coding of the plus-sign caused it the way I described.
                      You should also be careful in coding other characters. Like space should be coded as "+" or as "%20".

                      Plase try it again and tell me if it works now.

                      Comment

                      • oll3i
                        Contributor
                        • Mar 2007
                        • 679

                        #26
                        out.println("<a href=\"inbox.js p?k=%2B&f="+f+" \">");

                        i get java.lang.Illeg alStateExceptio n: isHexDigit

                        Comment

                        • chaarmann
                          Recognized Expert Contributor
                          • Nov 2007
                          • 785

                          #27
                          Are you using Glassfish4 ? Then most likely it is a bug, try to download the patch for glassfish.

                          Or:
                          Try using "%31" (which is digit "1") instead of "%2B". I just want to know if hex-digit parsing is a common problem for your Server.

                          Another try: use single quotation marks instead of double quotation marks. That means, use:
                          Code:
                          out.println("<a href='inbox.jsp?k=%2B&f="+f+"'>");

                          Comment

                          • oll3i
                            Contributor
                            • Mar 2007
                            • 679

                            #28
                            I get blank page with
                            Code:
                             out.println("<a href='inbox.jsp?k=%2B&f="+f+"'>");
                            I use GlassFish 4

                            Comment

                            • chaarmann
                              Recognized Expert Contributor
                              • Nov 2007
                              • 785

                              #29
                              And what about the other 2 possibilities?

                              Did you apply the glassfish-patch?
                              Did using "%31" work?

                              Another thing that would help greatly:
                              You are generating HTML that is send to the client browser. So just right-click in the browser page and select "view source" in the popup-menu. Locate the generated code that contains the "<a href..." from above and paste it here in this forum thread for further analysis.

                              Then we can decide if getting a blank page is one step to the solution and we solved the first error (hex-parsing). There may be a second error following the first one, like the link works, but the following page "inbox.jsp" contains an error somewhere, resulting in a blank page returned.

                              Comment

                              • oll3i
                                Contributor
                                • Mar 2007
                                • 679

                                #30
                                when i use %31 i get blank page using
                                Code:
                                out.println("<a href='inbox.jsp?k=%2B&f="+f+"'>");
                                also generates a blank page

                                Comment

                                Working...