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.

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

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

  • Accessing the Query String parameter from a portlet

    Hi!
    I have developed a PDK portlet in Jdev 10.1.3.3 for Web Center (Just for testing, later it'll go on Oracle Portal 10.1.4). I am trying to access the query string parameter coming in the URL but not successfull at all. Following are the options that I have tried in vain :
    In MyPDkPortletShowPage.jsp with *<passAllUrlParams>true</passAllUrlParams>*
    1.) PortletRenderRequest pReq = (PortletRenderRequest) request.getAttribute(HttpCommonConstants.PORTLET_RENDER_REQUEST);
    pReq.getParameter("data");
    2.) request.getParameter("data");
    3.) request.getAttribute("data")
    This makes me ask that is there any other way to access the parameter or is it simply not possible?
    Please suggest!
    Regards,
    Neeraj.

    Hi Neeraj:
    I didn't deal with web center before i am working on Oracle Portal 10.1.4 so if you done that on oracle portal and got the same problem check for this?
    - add the parameter in the page parameter then you will get the value from either preq.getParameter or from request.getParameter,just go to page properties and add a page
    parameter called data
    - did you publish your page containing your portlet as portlet and included it in other page or it is just a page containing this portlet?

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

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

  • SQL Query string in VBA Access 2010

    Hi everyone,
    I am writing sql queries in VBA Access 2010.
    Now, i am very new to VBA programming, so i don't know how i have to write te string for the query.
    I mean, are the " a,d _& sings in the good place?
    The query sits behind a button on the form and when i use the form and click on the button i get the following error
    This is the code i wrote:
    Option Compare Database
    Option Explicit
    Private Sub Knop9_Click()
    Dim bedrijf As String
    Dim startdatum As Date
    Dim einddatum As Date
    Dim aantal_uren_jaarlijks As Double
    Dim gevolgde_uren As Double
    Dim resterende_uren As Double
    Dim naam As String
    'Voeg de waarden die ingevuld werden in het form in de variabelen
    Tekst1.SetFocus
    bedrijf = Tekst1.Text
    Tekst3.SetFocus
    startdatum = Tekst3.Text
    Tekst5.SetFocus
    einddatum = Tekst5.Text
    Tekst7.SetFocus
    gevolgde_uren = Tekst7.Text
    Tekst11.SetFocus
    naam = Tekst11.Text
    CurrentDb.Execute "UPDATE Lan_landmeter " _
    & "SET OpleidingsBedrijf =" & bedrijf & " ,Opleiding_startdatum =#" & startdatum & "#,Opleiding_einddatum =#" & einddatum & "#,Aantal_opleidingsuren_vast=20,Aantal_gevolgde_uren =" & gevolgde_uren & ",Aantal_resterende_uren=0" _
    & "WHERE Id_landmeter =" & naam & ""
    CurrentDb.Close
    End Sub
    Did i wrote the query string right?
    Thx

    In Access create a View showing the information you want, then in design mode click View, SQL to see teh SQL you need. now make sure the SQL you build in VBA is exactly the same. so in the Immediate window type a ? then copy paste your code then press Enter
    to see the result, EG:
    ?"UPDATE Lan_landmeter " _
            & "SET OpleidingsBedrijf =" & bedrijf & " ,Opleiding_startdatum =#" & startdatum & "#,Opleiding_einddatum =#" & einddatum & "#,Aantal_opleidingsuren_vast=20,Aantal_gevolgde_uren
    =" & gevolgde_uren & ",Aantal_resterende_uren=0" _
            & "WHERE  Id_landmeter =" & naam & ""
    Rod Gill
    Author of the one and only Project VBA Book
    www.project-systems.co.nz

  • How to access FlashVars or URL Query String

    I am a bit of a rookie with Flash/AS3 and I need help trying to access FlashVars or URL in Object/Embed tags. I've searched in the Internet and the forums but cannot get my head around how to implement this.  Here is my example.
    1) ACTION SCRIPT - I have created a simple flash banner with clickable button (sparkle) with a mouse down event.
    The action script (AS3) for the button is the following:
    sparkle.addEventListener(
        MouseEvent.MOUSE_DOWN,
        function(evt:MouseEvent):void {
            var url:String = "http://www.[site_url].com/as/img.cfm";
          var request:URLRequest = new URLRequest(url);
            var variables:URLVariables = new URLVariables();
            variables.gphc = "382";
            request.data = variables;
            request.method = URLRequestMethod.GET;
          navigateToURL(request);
         *** the core issue to resolve is how to make the line above (variables.gphc = "382";) to be set dynamically.  I would like for the variable to come from the FlashVars or the URL vars
    2) OBJECT/EMBED - my object/embed code with include FlashVars and URL Query String
    <OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" ID="bannerAD" WIDTH="728"  HEIGHT="90">
         <PARAM NAME="movie" VALUE="http://www.[site_url].com/images/imgs/flash_ad.swf?gphc=382">
        <PARAM NAME="quality" VALUE="high">
        <PARAM NAME="bgcolor" VALUE="#FFFFFF">
        <PARAM NAME="FlashVars" value="gphc=382" />
        <EMBED src="http://www.[site_url].com/images/imgs/flash_ad.swf?gphc=382" quality="high"WIDTH="728" HEIGHT="90" TYPE="application/x-shockwave-flash"  PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" FlashVars="gphc=382" />
    </OBJECT>
    Questions that I need answered ... How do we access the FlashVars or the URL Query String?  I have found many references to loaderInfo but no clear way to implement that I'm able to understand. So if the loaderInfo is the key, where do I add in the loaderComplete() function into my action script above in #1?
    function loaderComplete(myEvent:Event)
      var flashVars=this.loaderInfo.parameters;
      gphcTextField.text=flashVars.gphc
    this.loaderInfo.addEventListener(Event.COMPLETE, loaderComplete);
    Any help is much appreciated.

    Thank you for your input.  I implemented your sugguestion in the following way without any success.  Notice below in the addEventListner that I have added the snippet of code.  Is this a good place (correct place) to set the local_var?  I did confirm that the FlashVars and URL variables were set.
    sparkle.addEventListener(
         MouseEvent.MOUSE_DOWN,
         function(evt:MouseEvent):void {
             var url:String = "http://www.[site_url].com/as/img.cfm";
             var request:URLRequest = new URLRequest(url);
             var variables:URLVariables = new URLVariables();
             var local_gphc:String = LoaderInfo(this.root.loaderInfo).parameters.gphc;
             variables.gphc = local_gphc;
             request.data = variables;
             request.method = URLRequestMethod.GET;
           navigateToURL(request);
    Thank you for your help.

  • Example to use Query String in Oracle Access Manager Policy.

    Hi All,
    Can any one please tell me what is the use of Query String and Query String Variable in OAM Policy?
    If possible please explain with a sample example.
    Thanks in Advance.
    Siva Pokuri.

    Query string is used to protect URL with complete query string.
    Ex: in case you want to protect http://hi.com/first.html?uid=abc&pqr=123 URL then you will specify query string as uid=abc&pqr=123.
    In case you want to protect a URL with one of the query parameter as xyz and you do not care of other query parameters, then query string variables are used.
    Ex: in case you want to protect http://hi.com/first.html?uid=abc&pqr=123 and http://hi.com/first.html?uid=abc&pqr=456 both with same policy then you will create a policy to protect first.html and in query string variables you will specify uid=abc.
    Let me know if you have any problems in understanding this.
    Thanks
    Kiran Thakkar

  • Access query strings in a search results page with custom display template

    am trying to create a  custom display template in my search results page , so i went to download the itemdefault html file and renamed it and  saved as  different file.and  am started to updating.
    the issue i am facing here is : in my  search results page there are 2 query strings, which are passed by anotehr .net appln[ another asp.net appln will be sending the query string to my sp 2013 search results page]
    but, how can i  read these 2  query strings using jslink and  new token _#- ? 
             <!--#_
               var QStringResults= null;
    ctx.OnPostRender = [];
    ctx.OnPostRender.push(function(){ 
    QStringResults= getQuString(); //here am unable to read the QStringResults value 
     _#-->  
    the below is my cstomhtml file
    am unable to  get the values :
                   <a href="http://srvrname:2013/sites/CMP/_layouts/15/BIFAddInputRef/bifpage1.aspx?bif1=_#= $htmlEncode(QStringResults) =#_"> Add Input Reference </a>
    <html xmlns:mso="urn:schemas-microsoft-com:office:office" xmlns:msdt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"> 
    <head>
    <title>Item BIF</title>
    <!--[if gte mso 9]><xml>
    <mso:CustomDocumentProperties>
    <mso:TemplateHidden msdt:dt="string">0</mso:TemplateHidden>
    <mso:MasterPageDescription msdt:dt="string">Displays the default result item template.</mso:MasterPageDescription>
    <mso:ContentTypeId msdt:dt="string">0x0101002039C03B61C64EC4A04F5361F385106603</mso:ContentTypeId>
    <mso:TargetControlType msdt:dt="string">;#SearchResults;#</mso:TargetControlType>
    <mso:HtmlDesignAssociated msdt:dt="string">1</mso:HtmlDesignAssociated>
    <mso:ManagedPropertyMapping msdt:dt="string">'Title':'Title','Path':'Path','Description':'Description','EditorOWSUSER':'EditorOWSUSER','LastModifiedTime':'LastModifiedTime','CollapsingStatus':'CollapsingStatus','DocId':'DocId','HitHighlightedSummary':'HitHighlightedSummary','HitHighlightedProperties':'HitHighlightedProperties','FileExtension':'FileExtension','ViewsLifeTime':'ViewsLifeTime','ParentLink':'ParentLink','FileType':'FileType','IsContainer':'IsContainer','SecondaryFileExtension':'SecondaryFileExtension','DisplayAuthor':'DisplayAuthor','CMPBIFURL2':'CMPBIFURL2'</mso:ManagedPropertyMapping>
    <mso:_dlc_DocId msdt:dt="string">X3CVW7PXYF6P-3-222</mso:_dlc_DocId>
    <mso:_dlc_DocIdItemGuid msdt:dt="string">3ed12157-ea19-4591-b9cd-7a826aef35dc</mso:_dlc_DocIdItemGuid>
    <mso:_dlc_DocIdUrl msdt:dt="string">http://srvrname:2013/sites/CMP/_layouts/15/DocIdRedir.aspx?ID=X3CVW7PXYF6P-3-222, X3CVW7PXYF6P-3-222</mso:_dlc_DocIdUrl>
    </mso:CustomDocumentProperties>
    </xml><![endif]-->
    </head>
    <body>
        <script>
            $includeLanguageScript(this.url,"~sitecollection/_catalogs/masterpage/Display Templates/Search/BIFJScript.js");
        </script>
        <div id="Item_BIF2">
    <!--#_ 
            if(!$isNull(ctx.CurrentItem) && !$isNull(ctx.ClientControl)){
                var id = ctx.ClientControl.get_nextUniqueId();
                var itemId = id + Srch.U.Ids.item;
    var hoverId = id + Srch.U.Ids.hover;
    var hoverUrl = "~sitecollection/_catalogs/masterpage/Display Templates/Search/Item_Default_HoverPanel.js";
                $setResultItem(itemId, ctx.CurrentItem);
    if(ctx.CurrentItem.IsContainer){
    ctx.CurrentItem.csr_Icon = Srch.U.getFolderIconUrl();
    ctx.currentItem_ShowHoverPanelCallback = Srch.U.getShowHoverPanelCallback(itemId, hoverId, hoverUrl);
                ctx.currentItem_HideHoverPanelCallback = Srch.U.getHideHoverPanelCallback();
    _#-->
             <!--#_
               var QStringResults= null;
    ctx.OnPostRender = [];
    ctx.OnPostRender.push(function(){ 
    QStringResults= getQuString();
     _#-->  
            <div id="_#= $htmlEncode(QStringResults) =#_" name="bifItemqstring" 
                    data-displaytemplate="DefaultItem" class="ms-srch-item" 
                    >
                    <h5 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.Path =#_"> _#= ctx.CurrentItem.Path =#_</a>
                    </h5>
                </div>
                <div id="_#= $htmlEncode(itemId) =#_" name="bifItem" 
                    data-displaytemplate="DefaultItem" class="ms-srch-item" 
                    onmouseover="_#= ctx.currentItem_ShowHoverPanelCallback =#_" 
                    onmouseout="_#= ctx.currentItem_HideHoverPanelCallback =#_">
                    <h1 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.Path =#_"> _#= ctx.CurrentItem.Path =#_</a>
                    </h1>
                    <h4 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.Description =#_"> _#= ctx.CurrentItem.Description =#_</a>
                    </h4>
                    <h4 style="color:ghostwhite;background-color:black">
                        <a href="_#= ctx.CurrentItem.LastModifiedTime =#_"> _#= ctx.CurrentItem.LastModifiedTime =#_</a>
                    </h4>
                    <h3 style="color:floralwhite;background-color:green">
                        var mybifurl1= document.getElementById($htmlEncode(QStringResults));
                    <a href="http://srvrname:2013/sites/CMP/_layouts/15/BIFAddInputRef/bifpage1.aspx?bif1=_#= $htmlEncode(QStringResults) =#_"> Add Input Reference </a>
                    </h3>
                  </div>
            <div>
            </div>
                    <div id="_#= $htmlEncode(hoverId) =#_" class="ms-srch-hover-outerContainer"></div>
    <!--#_ 
    _#-->
        </div>
    </body>
    </html>
    when i run the page , i a getting the query string value as   undefined! though the custom javascript is getting called.

    i am able to get the  results  by implementing the below:
    <h4 style="background-color:black">
                        <a onclick="javascript:mycalltojs(_#=
    ctx.CurrentItem.Path=#_) > click here </a>
                    </h4>
    hope this helps  anyone

  • Unwanted Query string appears in Apache access log file

    hi,
    i tried with the follwoing code to send the request for a servlet.
    uri = "/servlet/Participant";
    res.sendRedirect(getScheme( req ) + req.getServerName() + (req.getServerPort() == 454 ? (":" + req.getServerPort()) : "") + uri);
    Here i am not appending any QueryString. But the log entry in Apache2 HTTP Server dispalys the QueryString apeended. Below is the log entry.
    Host name - - [12/Apr/2009:23:58:58 +0100] "GET /servlet/Participant/?login.userid=mullapati&login.password=venkat12345 HTTP/1.1" 500 1274
    any thoughts how it is happening?
    Thanks,
    Venkatesh

    when u do a HttpServletResponse.redirect(url), the server merely sends a HTTP 307 response (Temporary Redirect) back to the client together with the url (which is what you formed up).
    It is up to the client to make a second request to the server at the redirected URL. Your client (whatever it is, browser, etc) could be appending the query string at the end of the URL.

  • Database access in JSP?

    Can I easily access MS access using JSP? If it is, what kind of drive should be used to access the MS Access database?
    Thank you so much!

    <%!
    // define database parameters
    String host="localhost";
    String user="";
    String pass="";
    String db="";
    String conn;
    %>
    <%
    Class.forName("org.gjt.mm.mysql.Driver");
    // create connection string
    conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user + "&password=" +
    pass;
    // pass database parameters to JDBC driver
    Connection Conn = DriverManager.getConnection(conn);
    // query statement
    Statement SQLStatement = Conn.createStatement();
    This is when accessing a database in a JSP, not a javabean... Try searching this forum, there are LOTS of topics about this.

  • Query string is null while dispatching the request in Websphere for Endeca pages

    Hi,
    When AssemblerPipelineServlet forward the request with dispatcher the query string is missing from the request in Websphere 7.0 only(works fine in JBOSS).
    This is happening only for the pages those are created in the Experience Manager.
    Ex: /store/us/detail?A=1204455 - This URL will render the /cartridges/ProductDetail/ProductDetail.jsp page. When we access the /OriginatingRequest.queryString in the JSP, it is giving null.
    Please help us to resolve this issue.
    Regards,
    Ravinder P

    Got the solution to this problem . I was using wlClient.jar & WlfullClient.jar in my classpath . removed wlClient.jar from java client app and now i am able to get the IWorkflowContext object.
    Hope this helps for the coming generations :)
    Thanks

Maybe you are looking for