Query string error in JSP

Hi. I originally thought my problem was a javaScript problem but now realize it is a JSP problem:
I have a JSP calling another JSP (which is opened in a smaller window with javaScript) and it uses a query string for values. One of these variables in the string is a note the user enters and can contain anything. Problem is when they enter text with the '&' symbol, I'm getting a Null Pointer Execption as the receiving JSP interprets it as part of the query string.
How can I 'hide' these characters so the receiving JSP page doesn't try to process it?
Thanks in advance,
Mike

hi,
you could detect the string before you sent the string, check for the & symbol and replace it with something else, such as the html equivalent and then append it to the url and send it, on the other end read it and replace the symbol with the & to get it back without confusing the code. you would run into the same problems if the user enter = or possibly ? into the string, so try fixing it with a search and replace method.

Similar Messages

  • How do i pass a url with query string using the jsp:forward tag

    This snippet of code gives a 403 error
    <jsp:forward page="testpage.jsp?test=1" />
    How do i rectify it?

    Well better way to go about for the job is to use
    setAttribute("name","value");method in the first page
    and then in next page use method
    String s=getAttribute("name");to retreive the value.
    Url rewritting or using Query String has some disadvantages ,which are handled by above mentioned approach.
    Ashish

  • Query string access in jsp

    I want to access the query strings from this URL. http://localhost:8080/napstersBank/imageone.jsp?39,23
    I tried javascript method window.location.search.substring(1); but i want to implement it in JSP due to security reasons.
    How to extract the query string from the above URL.
    Thank you in Advance

    I am not sure of what exactly the question is.
    Are you asking about how to access variables in JSP ? Or how to pass a parameter from an HTML page to a SWF ?
    Here:
               'meetingModule.html?roomURL=<%= roomURL  %>&authToken=<%= token %>',
    you are simply passing variable to the HTML page. From there you need to use javascript to parse the query string and pass the values to your SWF.
    If you look at the ExternalAuthentication examples they all do something similar.

  • Sql Server Express Query String error

    I am having trouble trying to filter my sql database using the query string against a date column in my database.  I set a date variable = "dd/mm/yyy" format but when I apply that in the sql query as:
    StartPeriod = CDate("01/" & Today.Month.ToString & "/" & Today.Year.ToString)
    EndPeriod = CDate(Today.Day.ToString & "/" & Today.Month.ToString & "/" & Today.Year.ToString)
    At this point StartPeriod = #04/01/2015#  and EndPeriod is #04/27/2015#
    sql = "SELECT * FROM Transactions WHERE  ((PaidOutDate IS Null) OR (TransDate >= '" & StartPeriod & "' AND TransDate <= '" & EndPeriod & "')
    When I execute the Sql command I get this error:
    "Conversion failed when converting date and/or time from character string"
    My Current Culture is {en-AU}
    Any help is appreciated.
    Brad
    BHend

    Visakh,
    Further to the problem above.  Your suggestion worked well on my laptop, but when I transferred the program to my desktop it failed with the error: "Conversion failed when converting date and/or time from character string" again.  Both
    computers are running the same version of Windows 8.1, both running the same version of vs express 2012 and both running the same version of ssms.  Both Windows 8.1 versions have the same English (Australia) as the Region and language.  The only
    difference that I can find is that while both have a CurrentCulture of {en=AU} and CurrentUICulture of {en-GB} the laptop, where the program works has an InstalledUICulture of {en-GB} and the PC where it doesn't work has an InstalledUICulture of {en-US}.
    Do you think this could be the problem?  If so, how would I change the InstalledIUCulture?
    As you can tell I am way our of my depth here, I've looked in the Control Panel and both computers appear to have the same settings for options that I think are relevant, but of course there could be hundreds of other settings nI don't know about. 
    I've also progressively worked through the Registry on both computers comparing their settings but could find nothing relevant. 
    Any suggestions of where to look?
    Thanks Again
    Brad
    BHend

  • A weird query string error?

    hi, everybody
    recently, I found that a particular user always has the request in the query string "Get \Servlet\com.ec.ercbroker.servlets.PingServlet". The user send the request almost every day. In each day, it sends the request very few minutes.
    the status code of the �GET� is 302 Which means the uri has been removed. the error message in our log file is:
    �404;http://66.151.158.177:80/servlet/co...Servlet�however, "66.151.158.177" is NOT our ip address. the question is: why the GET errors for another web site (66.151.158.177) are sent to us? are they trying to hack our system? how to prevent this?
    thank you! looking forward to your answer.
    louis

    organization class has a transient attribute called localAddresses
    The instance is saved into the session. Could these be related in some way shape or form?
    Transient attributes are not saved when the bean is serialized. So if the bean gets serialized/unserialized that attribute would not be available.
    I don't recognise the exception - is it a custom one you have? What is the full stack trace?
    What does your "getLocalAddresses" method look like?

  • Doget and query String

    how to use "doget", any example for me reference.
    if i would like to pass the variable by querystring, can i add the variable in URL like this:
    go home
    but how can i get the ID in query string in home.jsp???

    1. I can't understand the line of code that you just gave
    What are you trying to put as the query string is not clear to me. If you are thinking that that code will call the toString method on any ID object, then it won't
    2. To access the value of the ID parameter in home.jsp, you can use scriptlets or EL
    <%=request.getParameter("ID")%>
    ${param.ID}

  • XPath query string returns zero node error

    I have created car loan bpel application. One is Citi Loan and another is Star Loan.
    I have created just like similar to sample loan demo.
    I have entered the SSN, email, carModel, carYear, loanAmount and creditRating value and submitted. It will initiated the following tasks successfully.
    StarLoan Instance
    CitiLoan Instance
    TaskManager Instance
    CreditRating Instance
    Root appln. instance
    I have created one user approval page for Approve/Reject (jsp). Through this page, I have approved the CitiLoan offer. I have faced the following errors.
    <output>
    <part name="payload" >
    <loanOffer>7.4</loanOffer>
    </part>
    </output>
    <loanOffer>7.4</loanOffer>
    <selectionFailure>
    <part name="summary" >
    <summary>XPath query string returns zero node. According to BPEL4WS spec 1.1 section 14.3, The assign activity <to> part query should not return zero node. Please check the BPEL source at line number "90" and verify the <to> part xpath query. </summary>
    </part>
    </selectionFailure>
    Please help me.
    Thanks in advance.
    Regards,
    Sara

    Let us know if you have customized SOA composite for user creation approval?
    -Vamsi.

  • Save Query - An error occurred while creating connection strings for the query

    A workbook trying to edit and reload I get the following error "Save Query - An error occurred while creating connection strings for the query" No Power Pivot data model or anything.

    I am getting the same error when editing a Power Query in an Excel spreadsheet. It happens when I change a Group By step to do a Sum instead of Count Rows.

  • C:import tag - Query string while calling servlet from JSP

    Hi,
    From my JSP I am calling a servlet to write back to the response stream of the JSP. From the JSP i am trying to pass some values into the query string as follows
         <%
         String strGetParameters = "/servlet/MyServlet?path=" + strPath;
          %>
         <pre><c:import url="<%=strGetParameters%>" /></pre>In the servlet I try to get the path from the query string by using
    request.getParameter("path")But in the servlet the query string doesnt have the "path" parameter that I added in the strGetParameters string (in the JSP).
    Am i missing something? Do i have to use something else or do something else?
    Any help is appreciated.

    I've taken some time to do a simple test and it just works.
    Here is the test code, it was tested in Java EE 5 + JSTL 1.2 + Tomcat 6.
    JSP<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
    <html>
        <head>
            <title>Test</title>
        </head>
        <body>
            <pre>
                <c:import url="myServlet?param1=foo&param2=bar">
                    <c:param name="param3" value="meep" />
                    <c:param name="param4" value="waah" />
                </c:import>
            </pre>
        </body>
    </html>MyServlet (mapped on "/myServlet")package mypackage;
    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    public class MyServlet extends HttpServlet {
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
            throws ServletException, IOException
            String param1 = request.getParameter("param1");
            String param2 = request.getParameter("param2");
            String param3 = request.getParameter("param3");
            String param4 = request.getParameter("param4");
            String output = param1 + ", " + param2 + ", " + param3 + ", " + param4;
            response.getOutputStream().write(output.getBytes());
    }All parameters gets printed.

  • Jsp:forward param not getting included in my query string

    Hi,
    On a particular JSP page, mine.jsp, I am forwarding to a servlet ...
    <jsp:useBean id="HotelResortDBBean" class="com.lvcva.database.HotelResortDBBean" scope="request" />
    <jsp:forward page="/meetings/meeting-venues/results">
         <jsp:param name="sqftRange" value="${empty param.meetingsqft ? -1 : param.meetingsqft}" />
    </jsp:forward>This forwards to a servlet, when I query "request.getQueryString", it comes up null. However, when I enter the URL, "mine.jsp?sqftRange=-1", the query string returns "sqftRange=-1" as expected. Can someone tell me what I'm doing wrong in the above that is causing the jsp:param to not be added to the query string?
    - Dave

    a forward does not create a new request, and thus the query string is not altered. If you want the query string to change, use a redirect in stead.
    note: even though the query string does not change, the new parameter IS added to the HttpServletRequest object, so you can still fetch the new parameter from it even with the forward.

  • Query string read as part of file name, throwing not found errors

    Hi all, I host a number of Web sites under a CF7 installation, Win2003.
    One site in particular is throwing not-found errors in response to certain search bot requests.
    In the IIS log, I noticed that for these requests, the query part of the URL is part of cs-uri-stem field value, but is not in the cs-uri-query field where it belongs:
    cs-uri-stem=                                               /index.cfm?template=24hour5.cfm
    cs-uri-query=<blank>
    instead of
    cs-uri-stem=                                               /index.cfm
    cs-uri-query=template=24hour5.cfm
    Evidently something somewhere is interpreting the entire URL as a filename, instead of a file name and a query string. When CF tries to locate the file it is throwing a not-found error.
    Maybe there is something weird about the question mark, but it looks normal to me.
    I can't seem to stop this error, since it is occuring at the OS, IIS, CF or jrun layer. Does anyone have any idea what is going on here, and what I can do about it?
    Thanks in advance.
    Joe

    Hey Reed, thanks for responding.
    I have a Cf utility that parses logs, so I modifed it to print out the ASCII codes for each character. They look normal, as far as I can tell. The question mark has a code of 63 which is correct, and no non-alphabetic characters precede or follow.
    One interesting thing is that the stem being called is an index.cfm file, and the query string argument happens to be a template name, and it ends in .cfm. That's why it is making it all the way to CF, which chokes on it, instead of IIS logging a 404 error.
    Often an identifiable bot is requesting these bad URLs, though I have spotted another request with agent 'Mozilla/4.0.' I suspect that is some kind of automated scan. (I also see other requests with the same agent name, though a different IP, that look like errononeously URL-encoded requests. These get filtered by URLScan.)
    I don't know for sure is whether the specific clients that make these bad calls always make them them wrong way. They appear to. Most clients that access the site do so normally.
    I wonder if there could be something in the request header, perhaps that instructs IIS to expect a different charset than what is actually used, or something like that.

  • Publishing server doesn't work - error 'The request URL doesn't contain the query string for the client OS'

    Hi,
    I'm trying to setup an App-V environment in my lab.
    I've used the App-V 5.0 Trial guide to help me configure all necessary components.
    I'm able to install everything without error.
    when come time to publish an app, it simply doesn't show up on my client.
    after looking at events on the client and server, I found that the Publishing server is returning under Admin the following message.
    'The request URL doesn't contain the query string for the client OS'
    My setup is pretty simple.
    App-V Server managament and Publishing on the same box
    App-V database on my SQL server.
    I'm able to see the publishing "webpage" by using http:://localhost:889.
    It only display this :
    -<Publishing Protocol="1.0"
    <Packages />
    </Publishing>
    I've published one app from the management console.
    any idea what could mean this error?
    thanks

    Hi,
    thanks for the link.
    I've validated the suggested debug steps. It seems that the problem is with my Publish server again.
    I've looked in the web.config file. It seems to be missing some parts compare to the example provided.
    Again, I've published an application from the management console. Management and Publishing are running on the same box, while SQL is remote.
    Here's the web.config
    <?xml version="1.0" ?>
    - <configuration>
    - <system.web>
    <compilation debug="false" targetFramework="4.0" />
    <machineKey validationKey="AutoGenerate,IsolateApps" decryptionKey="AutoGenerate,IsolateApps" />
    - <authentication>
    - <!-- We don't support form authentication, but this will supress x-ray security warning
    -->
    <forms requireSSL="true" />
    </authentication>
    </system.web>
    - <system.webServer>
    - <modules runAllManagedModulesForAllRequests="true">
    <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
    </modules>
    - <security>
    - <requestFiltering>
    - <verbs>
    <remove verb="GET" />
    <add verb="GET" allowed="true" />
    </verbs>
    </requestFiltering>
    </security>
    </system.webServer>
    - <system.serviceModel>
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
    + <behaviors>
    - <serviceBehaviors>
    - <behavior name="">
    <serviceAuthorization impersonateCallerForAllOperations="true" />
    <serviceMetadata httpGetEnabled="false" httpsGetEnabled="false" />
    </behavior>
    </serviceBehaviors>
    </behaviors>
    - <bindings>
    - <webHttpBinding>
    - <binding name="SecureBinding">
    - <security mode="Transport">
    <transport clientCredentialType="Windows" />
    </security>
    </binding>
    <binding name="UnsecureBinding" />
    </webHttpBinding>
    </bindings>
    - <protocolMapping>
    <add scheme="http" binding="webHttpBinding" bindingConfiguration="UnsecureBinding" />
    <add scheme="https" binding="webHttpBinding" bindingConfiguration="SecureBinding" />
    </protocolMapping>
    - <standardEndpoints>
    - <webHttpEndpoint>
    - <!--
    Configure the WCF REST service base address via the global.asax.cs file and the default endpoint
    via the attributes on the <standardEndpoint> element below
    -->
    <standardEndpoint name="" helpEnabled="true" automaticFormatSelectionEnabled="true" />
    </webHttpEndpoint>
    </standardEndpoints>
    </system.serviceModel>
    </configuration>

  • Workflow manager 1.0 : runtime error 400 running Add-WFHost "The api-version in the query string is not supported"

    Installing Workflow Manager 1.0 for SharePoint Server 2013 SP1 everything is fine until the last step of the configuration and last powershell command : 
    Add-WFHost -WFFarmDBConnectionString 'myconnectionstring' -RunAsPassword $WFRunAsPassword -EnableFirewallRules $true -SBClientConfiguration $SBClientConfiguration -CertificateAutoGenerationKey $WFCertAutoGenerationKey -Verbose;
    gives me the following error : 
    Add-WFHost : The remote server returned an error: (400) Bad Request. The api-version in the query string is not supported. Either remove it from the Uri or use one of '2012-03'..TrackingId:412684e3-3539-468e-91e6-17838c6eaa55_GS
    P,TimeStamp:04/04/2014 12:54:11
    At line:1 char:1
    Can't find anything about this subject except this
    thread which does not help me that much in SharePoint dev env ...
    Removing workflow manager 1.0 and service bus (leave the farm using wizzard, remove binaries and databases) does not help.
    Who already faces this issue and how can I try to resolve it ?
    Best regards !
    Alexandre DAVID

    The API version is hardcoded in Microsoft.ServiceBus.dll, which ships as part of the Service Bus. Each version of this lib has a different string.
    If you install workflow manager 1.0, here are the pre-requisites:
    .NET Framework 4 Platform Update 3 or .NET Framework 4.5
    Service Bus 1.0
    Workflow Client 1.0
    PowerShell 3.0
    The following are the pre-requisites to configure Workflow Manager 1.0
    Instance of SQL Server 2008 R2 SP1, SQL Server Express 2008 R2 SP1, or SQL Server 2012.
    TCP/IP connections or named pipes must be configured in SQL Server.
    Windows Firewall must be enabled. [Windows Firewall is Off on target server]
    Ports 12290 and 12291 must be available.
    Here are the reference for installing and configuring Workflow Manager 1.0:
    http://lennytech.wordpress.com/2013/06/02/installing-workflow-manager-1-0/
    http://lennytech.wordpress.com/2013/06/02/configuring-workflow-manager-1-0/
    http://social.technet.microsoft.com/Forums/en-US/c74507fb-ac2d-405f-b19c-2712b1055708/workflow-manager-10-configuration-service-bus-for-windows-server-the-api-version-is-not?forum=sharepointadmin

  • JSP HTML Query String

    Hi I am using query strings to pass variables such as groupName=Bonza.
    However, I don't want the user to see this string so i was wondering if there is a simple way for the JSP or HTML page to encrypt or hide or mangle the query string, so instead of:
    http://localhost:8080/jsp/newGroup.jsp?groupName=Bonza
    i could have:
    http://localhost:8080/jsp/newGroup.jsp?7thsgs7393j38dx
    Something like that anyway, at least so i could decrypt at the processing JSP page. The information doesn't need to be secure, just so ppl can't see the names of groups and change the query string.
    Thanks!

    A few ways you can do this is to:
    1) Use a form and specify POST to pass the data to the next page. The HTTP specification calls for passing the data in the header.
    2) Use hidden fields on the page.
    3) Use JSP sessions and use a bean to access the data from any page in your application implementing session.
    The last method is prbably the better method and is what I used for my recent application. This requires that the client accept cookies so that you can track the user session. The first 2 do not.

  • Workspace Error executing query: String index out of range: -39

    I am running a Financial Reporting Book.
    When running this book, I am receiving the following error.
    Error executing query: String index out of range: -39
    What does this mean?
    And how do I fix this?
    Thank you,
    Dan

    This is happening to a single Financial Reporting book.
    Oracle suggested changing the Data Query Optimization settings.
    I had checked on Essbase Queries Use MDX on all the reports being called into the book.
    Oracle suggested that I uncheck this box.
    This did not do the trick.
    I ran the reports individually, and they all worked.
    I am stumped.

Maybe you are looking for