Query String parameter with # in its value

Hi,
When I send a parameter in a query string with value that has the hash symbol (i.e #) that parameter when fetched returns null. Why so?
Eg :
Page 1 :
String strTest = "1#2";
<a href="test.jsp?test=<%=strTest%>">Page 2: test.jsp
String strTest=request.getParameter("test");
System.out.println("strTest : "+strTest); // Prints null
Thanks</a>

Hi,
When I send a parameter in a query string with value
that has the hash symbol (i.e #) that parameter when
fetched returns null. Why so?
Its a special character and the url has to be 'rewritten properly.
>
Page 1 :
String strTest = "1#2";
<a href="test.jsp?test=<%=strTest%>">>
</a>
try this
<%
  String strTest = java.net.URLEncoder.encode("1#2");
%>
  <a href = "test.jsp?test=<%=strTest%>">test</a>and check the output in your next jsp :)
ram.

Similar Messages

  • JDeveloper, JPA named query String parameter with length of 1

    Hi,
    I use JDeveloper 11.1.1.2.0. and have the following table:
    CREATE SEQUENCE COUNTRY_SEQ;
    CREATE TABLE COUNTRY (
    COUNTRY_ID NUMBER NOT NULL,
    COUNTRY_NAME VARCHAR2(40),
    COUNTRY_CODE CHAR(2) NOT NULL,
    CONSTRAINT COUNTRY_ID_PK PRIMARY KEY (COUNTRY_ID)
    INSERT INTO COUNTRY VALUES (COUNTRY_SEQ.NEXTVAL, 'Belgium', 'B');
    INSERT INTO COUNTRY VALUES (COUNTRY_SEQ.NEXTVAL, 'Netherlands', 'NL');
    COMMIT;
    I made a JPA Entity with two queries:
    @NamedQueries({
    @NamedQuery(name = "Country.findAll", query = "select o from Country o"),
    @NamedQuery(name = "Country.findByCountryCode", query = "select o from Country o where o.countryCode = 'B' or o.countryCode ='NL'")
    The first works fine, gives back both B and NL. But the second gives back only NL. I have no clue why.
    If I change 'B' to 'BE' both in the DB and the code, it works. If I change to 'b', it doesn't. So it seems that the problem comes with 1 char long Strings.
    Is it an EclipseLink bug?
    I use Oracle Database 11g Enterprise Edition Release 11.1.0.7.0. But
    SELECT COUNTRY_ID, COUNTRY_NAME, COUNTRY_CODE FROM COUNTRY WHERE COUNTRY_CODE = 'B' OR COUNTRY_CODE = 'NL';
    works in SQL*Plus.
    Thx, Donat

    Hi,
    That's true, it uses value bindings while the values are hard coded. I use the default EclipseLink embedded into JDeveloper 11.1.1.2, with the default settings. The JPA bean runs in the default embedded WebLogic of JDeveloper. This might be a default setting of EclipseLink to use bindings for hard coded values.
    Here is a fragment of Country.java:
    @Entity
    @NamedQueries({
    //@NamedQuery(name = "Country.findAll", query = "select o from Country o")
    @NamedQuery(name = "Country.findAll", query = "select o from Country o where o.countryCode ='B' or o.countryCode ='NL'")
    public class Country implements Serializable {
    @Id
    @Column(name="COUNTRY_ID", nullable = false)
    private Long countryId;
    @Column(name="COUNTRY_CODE", nullable = false)
    private String countryCode;
    @Column(name="COUNTRY_NAME", length = 40)
    private String countryName;
    And I have a JavaServiceFacade.java:
    public class JavaServiceFacade {
    private EntityManagerFactory emf = Persistence.createEntityManagerFactory("EjbModel-1-Outside");
    public JavaServiceFacade() {
    public static void main(String [] args) {
    final JavaServiceFacade javaServiceFacade = new JavaServiceFacade();
    List<Country> countries;
    countries = javaServiceFacade.getCountryFindAll();
    for (Country country : countries) {
    System.out.println(country.getCountryCode());
    private EntityManager getEntityManager() {
    return emf.createEntityManager();
    /** <code>select o from Country o</code> */
    public List<Country> getCountryFindAll() {
    return getEntityManager().createNamedQuery("Country.findAll").getResultList();
    BR, Donat

  • JPA named query String parameter with length of 1

    Hi,
    I use JDeveloper 11.1.1.2.0. and have the following table:
    CREATE SEQUENCE COUNTRY_SEQ;
    CREATE TABLE COUNTRY (
    COUNTRY_ID NUMBER NOT NULL,
    COUNTRY_NAME VARCHAR2(40),
    COUNTRY_CODE CHAR(2) NOT NULL,
    CONSTRAINT COUNTRY_ID_PK PRIMARY KEY (COUNTRY_ID)
    INSERT INTO COUNTRY VALUES (COUNTRY_SEQ.NEXTVAL, 'Belgium', 'B');
    INSERT INTO COUNTRY VALUES (COUNTRY_SEQ.NEXTVAL, 'Netherlands', 'NL');
    COMMIT;
    I made a JPA Entity with two queries:
    @NamedQueries({
    @NamedQuery(name = "Country.findAll", query = "select o from Country o"),
    @NamedQuery(name = "Country.findByCountryCode", query = "select o from Country o where o.countryCode = 'B' or o.countryCode ='NL'")
    The first works fine, gives back both B and NL. But the second gives back only NL. I have no clue why.
    If I change 'B' to 'BE' both in the DB and the code, it works. If I change to 'b', it doesn't. So it seems that the problem comes with 1 char long Strings.
    Is it an EclipseLink bug?
    I use Oracle Database 11g Enterprise Edition Release 11.1.0.7.0. But
    SELECT COUNTRY_ID, COUNTRY_NAME, COUNTRY_CODE FROM COUNTRY WHERE COUNTRY_CODE = 'B' OR COUNTRY_CODE = 'NL';
    works in SQL*Plus.
    Thx, Donat

    I moved this question to: Forum Home » Java Enterprise & Remote Computing » Enterprise JavaBeans
    Donat

  • Dynamic cell associated value as query string parameter in custom hyperlink property of KPI of scorecard in PPS SP2013

    Can we pass dynamic cell associated value [of scorecard] as query string parameter in custom hyperlink property of KPI of scorecard in PPS SP2013 , so that we can pass those values to another page 
    How to get those cell associated values and set these dynamic value as query string parameter in custom hyperlink property of KPI of scorecard in performance point services in sharepoint 2013

     I could somehow link to the table name, but that can be changed...  Any ideas?
    Not sure if this will help or not but maybe a little from several areas might point you in the right direction.
    If you are concerned about users changing the table name then you can define a name to reference the table and then if the user changes the table name then the Refers to automatically changes to the new table reference but your defined name remains the same.
    However, if users want to break a system even when you think you have it bullet proof the users come along with armour piercing bullets.
    Example:
    Insert a table (say Table1)
    Go to Define a name and insert a name of choice (eg.  ForMyTab1)
    Then click the icon at the right of the Refers to field and select the entire table including the column headers and it will automatically insert something like the following in the Refers to field.
    =Table1[#All]
    Now if a user changes the table name then Table1 will also automatically change.
    Example code to to reference the table in VBA.
    Sub Test()
        Dim wsSht1 As Worksheet
        Dim lstObj1 As ListObject
        Set wsSht1 = Worksheets("Sheet1")
        Set lstObj1 = wsSht1.ListObjects(Range("ForMyTab1").ListObject.Name)
        MsgBox lstObj1.Name
    End Sub
    Regards, OssieMac

  • Read Query String Parameter Value in SSRS

    Hi,
    We have Project Server 2010 and Sharepoint Server 2010 env and using SSRS 2008 R2 for reporting purpose in Native mode.
    Here I am displaying the SSRS Project report in Project Server page using Report Viewer web part like below.
    Here I want to read projuid query string parameter value (Highlighthed above in URL ) in SSRS by using any way, so that I can pass that
    projuid value in my SSRS report parameter to filter and make this report dynamic.
    Right now I have to select the ProjectName (Label) which passes ProjUID
    as value from the Parameter, but I want it should read the projuid
    from URL so that this reports will display the project the data for the opened Project automatically
    Thanks and let me know in case we can achive this using OOTB or some custom functions.

    Hi,
    For the report parameter, you can get the value from database query or some embedded funcitons etc. or even some customerized function.
    You may consider to create your own code for the report to read the projuid from application or URL. The customer code can be used to get the values from the applicaiton or from the url etc. Then report can call the customer code function to get the value.
    refer link
    https://technet.microsoft.com/en-us/library/ms155798(v=SQL.100).aspx
    https://support.microsoft.com/kb/920769?wa=wsignin1.0
    Thanks,

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

  • Can a single quote be used at the beginning of a query string parameter

    Hi all,
    I am a relative newbie and have a newbie question.
    Can a single quote be used at the beginning of a query string parameter passed to a jsp page? Are there any inherant problems with this? Is there a comprehensive list of characters that must be escaped in a query string parameter?
    Example: http://mysite.com/myjsp.jsp?param1='nghdh
    Thanks

    You'll have to escape most non-letter characters before you can pass them as a URL. I don't know if it's necessary for a single quote, but better safe than sorry.
    Either use java.net.URLEncoder(...) or use javax.servlet.http.HttpServletResponse.encodeURL(String). I wouldn't recommend using unescaped characters in your URLs, that might cause pretty funny behavior that's sometimes hard to trace back. Don't worry about decoding it, your JSP/Servlet container will do it when you call javax.servlet.http.HttpServletRequest.getParameter(String).

  • How can pass the Maximum query String parameter in browser.....?? (URGENT)

    hi Guys,
    i make the application, in which lots of data record with id, whenever i clicked to the SUBMIT button, it wil forwarded to the next page.
    But The problem is.....when we pass the 30 id in a query string parameter that' fine but when it is incresing it is not transfaring to the next page. how i can do this.
    As per the concept EVERY BROWSER HAVING THE LIMITATION..
    hope all of u help me.
    saM

    hey all of you are saying right..!!
    But you know the doPost() method having the limitation, that is
    1 MB. so how can i used this method.
    I know the second way....Like make the hidden control with mantain the session, but i can not use this(Client do't want this).
    so please guys help me........
    saM

  • How to find String associated with some long value.

    My requirement is to know the String associated with the long value, for ex 23423423 is having some value like 'skljflsjf'. Can any body findout soln for the same.
    Thanks
    ~ Chethangowda.

    My requirement is to know the String associatedwith
    the long value, for ex 23423423 is having somevalue
    like 'skljflsjf'. Can any body findout soln forthe
    same.
    Hum... I'm not 100% sure, but it seems the answeris:
    dgjldkgjfkljg
    Please, don't thank me before you confirm thething.
    Regards.Oooohhhh! That explains it! I guess I must've missed
    the part where he said he wants it translated to
    trollish. How stupid of me.You're absolutely not to blame... to be honest, if I had not read the OP 3-4 times carefully, I would not have found the solution.

  • Add Multiple Detail Items Using the Same Query String Parameter

    I am using InfoPath 2010 and SharePoint 2010. 
    I have 2 forms libraries - Expense and Expense Details. 
    The 2 libraries are linked via a custom site column Expense ID. 
    The Expense form contains the main header type info you would typically find on an expense report; e.g., name, purpose, department, etc. 
    The Expense Details form contains multiple detail expenses related to the main expense report such as airfare, rental car, etc. 
    I have created a page that displays an expense report with all of the related expense detail items. 
    The page contains a link to add a new expense detail and passes the Expense ID of the Expense form to the Expense Detail form. 
    This all works fine.  The problem comes in after the first expense detail form is submitted. 
    I can successfully submit the first detail item.  However, the expense detail form loses the Expense ID that was passed to it after the first expense detail form has been submitted. 
    The parameter still shows in the URL but the detail form no longer shows the value of the parameter. 
    What do I need to do in order to be able to add multiple expense detail items using the same Expense ID that was passed to the form? 
    I have tried using a Submit Behavior of Open a new form, Close the form, and Leave the form open. 
    None of these options give me what I need.  Thanks for your help.
    pam

    Laura Rogers Blog
    In case anyone stumbles upon this looking for an answer. Laura Rogers has the answer found in the comments section of her blog above.  It’s not the best but it
    does work. You have to add an extra Info Path Web Form for it to work. I know, you can roll your eyes.<o:p></o:p>
    Steps.<o:p></o:p>
    1. Add Query String<o:p></o:p>
    2. Add the extra Info Path form to the page. This form will be a hidden on the page and will receive the value from the query string.<o:p></o:p>
    3. Add your original Info Path form and have it receive a parameter from the hidden Info Path form.<o:p></o:p>
    Now, when you hit save and it opens a new form the 3 Info Path form will function properly. <o:p></o:p>

  • Multiple select parameter with each selected value covering multiple sub values

    Hello, everyone,
    In my SSRS report, I need to set a multiple select parameter called Group, with values: group1 group2, etc....
    When group1 is selected, it needs to apply to data of certain sub groups: sub-group1, sub-group2;
    When group2 is selected, it needs to apply to data of different sub groups: sub-group3, sub-group4 and sub-group5;
    when both group1 and group2 are selected, then, it needs to apply to data of sub-group1 to sub-group5.
    I know how to do it when only one group is selected: simply use a case statement in the query to select the right sub groups based on the group selected.
    But I don't know a good way to do it when multiple groups are selected.
    Any help, pointers are much appreciated. Thanks in advance!
    Regards

    Hi QQFA,
    If I understand correctly, there are two parameters (Group and Sub_group) in the report. When we select group1 in Group parameter, it will auto select sub-group1, sub-group2 in the Sub_group parameter; when we select group2 in Group parameter, it will auto
    select sub-group3, sub-group4 and sub_group5 in the Sub_group parameter; when we select both all, it will auto select all sub_group values. If I have misunderstood, please don't hesitate to let me know.
    In this scenario, we can create a temporary table with Group and Sub_group columns, then select Sub_group column values based on the Group field. For more details, please see:
    Create a dataset with the query below:
    CREATE TABLE #temp([group] nvarchar(50),sub_group nvarchar(50))
    INSERT INTO #temp VALUES     ('group1','sub-group1'),('group1','sub-group2'),('group2','sub-group3'),('group2','sub-group4'),('group2','sub-group5')
    SELECT * FROM  #temp
    where [group]  in (@Group)
    Set available values and default values of Sub_group parameter with get values from the sub_group field in the new dataset.
    Note that the two parameters are all multiple parameters.
    If there are any misunderstanding, please elaborate the issue for further investigation.
    Thanks,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Using Query String Parameters with Session Scoped bean

    I would like to pass query string parameters from a product page (user clicks on a specific product commandLink) that is request scope to a details page that is session scoped.
    The problem is that the session scoped page only handles the first request. If you view the details of a product and then navigate back to the product page and choose another product ... the details page will not handle the new query string parameters and display the details for the first product chosen.
    Is there a way to make the session scoped bean recognize the query string parameters past the first request?

    I was able to replicate this problem with a very simple app that performs a redirection... just like the real app. Here's the simple app that I put together:
    From request scope page:
    <f:view>
             <h:form>
               <h:commandButton value="Link 1" action="#{reqbean.Link1}"/>
               <br/><br/>
              <h:commandButton value="Link 2" action="#{reqbean.Link2}"/>
            </h:form>
           </f:view>
    From request scope bean:
    public String Link1() throws IOException
        // Add event code here...
        //redirect the user
        FacesContext.getCurrentInstance().getExternalContext().redirect("untitled2.jspx?p=1");
        return null;
      public String Link2() throws IOException
        // Add event code here...
        //redirect the user
        FacesContext.getCurrentInstance().getExternalContext().redirect("untitled2.jspx?p=2");
        return null;
      }At this point... I put a println in the constructor of the session scoped bean because this is where I want to get the query string params. The constructor only gets called the first time a redirect is performed.

  • I cann't get query string parameter after recording

    Scenario [JSP APP]; open search page and enter search criteria and click search. after stopping the scenario and show data in Query string parameters I got the "PAGEDAT = 013001200454215112..." instead of Search value. Could you please help me
    to solve this issue.

    Hi Amohamed7,
    According to your description, I suggest you could try to use this fiddler tool to record the web test request check if you can get the Search value in the Query string parameters.
    Reference:
    http://blogs.msdn.com/b/slumley/archive/2007/04/17/enhanced-web-test-support-in-fiddler.aspx
    In addition, I suggest you could try to generate the coded web performance test and then modify the value in the Query string parameters for this web request.
    https://msdn.microsoft.com/en-us/library/ms182552.aspx
    You can also try to use quick find in the playback recording and then find the value of the parameter, then modify this search value.
    https://msdn.microsoft.com/en-us/library/vstudio/ee317494%28v=vs.110%29.aspx
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • SharePoint 2013 Query string parameter pass between visual webparts

    Hi,
    I have created one web part called Latest News in SharePoint 2013 which is
    visual web part(Sandbox Solution).
    In that, there is button called "Read More". Now when I click on that button I want to show only that item in the new page which is clicked using query string. but the data which will be shown after Read More button will be coming
    from a different Visual Web Part.
    How should I pass a query string value from one visual webpart to another visual webpart in SharePoint 2013 ?
    Could anyone please help me like how we can pass.
    Thanks in Advance.

    Hi,
    To pass information from one web part to another, we can use the consumer and provider web part with the
    IWebPartParameters interface.
    There are some articles about this topic, you can refer to them.
    http://msdn.microsoft.com/en-us/library/office/ms469765(v=office.14).aspx
    http://www.c-sharpcorner.com/UploadFile/40e97e/sharepoint-2010-connected-web-parts/
    http://underthehood.ironworks.com/2011/03/how-to-build-a-consumer-web-part-in-sharepoint-2010-using-iwebpartparameters-that-works-with-html-fo.html
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Set Query String Parameter

    What I am trying to do is to check whether does that variable exist in the querystring, if it does change the value to another value.
    How am I suppose to do abt doing that?

    Well, it's not too complex to do it with java... here is a simple example:
    public class QueryStringChanger
         public static String changeParameter(String query, String key, String value)
              String[] keyValuePairs = query.split("&");
              StringBuffer newQuery = new StringBuffer();
              for (int k = 0; k < keyValuePairs.length; k++)
                   if (keyValuePairs[k].indexOf(key) != -1)
                        String[] thePair = keyValuePairs[k].split("=");
                        keyValuePairs[k] = thePair[0] + "=" + value;
                   if (k != 0) newQuery.append("&");
                   newQuery.append(keyValuePairs[k]);
              return newQuery.toString();
         public static void main(String[] args)
              if (args.length != 3)
                System.out.println("Syntax: java QueryStringChanger 'the query string' theKey theValue\n"+
                                   "Example: java QueryStringChanger page=1&area=3&title=Not+So+Good title Pretty+Darn+Good");
                System.exit(1);
              System.out.println(changeParameter(args[0], args[1], args[2]));
              System.exit(0);
    }Not so sure what you would gain from a HashTable though...

Maybe you are looking for