How to get parameter from URL - part II

Is there a way to assign a value of JavaScript variable to JSF variable?, something like
<h:commandButton value="Send" actionListener ="#{myBean.myAction}" 
<f:attribute name="source" value="<some JavaScript variable>"/>
</h:commandButton>Here is my problem
Following the thread in http://forum.java.sun.com/thread.jspa?forumID=427&threadID=545973
I have a facelets page that is used as a "contact us" from this page the information is send to the action bean for saving in the database. We want to know where the users come from to this page. This can be done either by using the "referring page" or adding parameters to the URL - http://mylink?param=myval
In both cases the problem is that when transferring the information from the faclets page to the action bean the information is lost and instead of showing the "real" referring page or parameter it shows the information of the faclets page.
One solution to the problem is to save the information in the faclets page in a javascript variable and then transfer it using the f:attribute to the action bean. By the way, the opposing is very easy, one can save easy the value of a JSF parameter in a javascript variable:
<script type="text/javascript">
     // <![CDATA[
     var foo = "#{myBean.bar}"
// ]]>
</script>

I can, but the EL doesn't contain the "right" value..
But there is a general question
Can one use javascript in expression like f:attribute ?
BTW I solved the above problem by using AJAX like behavior, But I wanted to know if there is another way

Similar Messages

  • Get parameter from URL in Java code

    Hello everyone,
    I've got strange problem. I have one JSF page with two controls:
    - InputText
    - Button
    <?xml version='1.0' encoding='UTF-8'?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <f:view xmlns:f="http://java.sun.com/jsf/core" xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <af:document title="view12.jsf" id="d1">
    <af:messages id="m1"/>
    <af:form id="f1">
    <af:inputText label="Label 1" id="it98" value="#{param.test}" editable="always"/>
    <af:commandButton actionListener="#{bindings.przekierowanie.execute}" text="przekierowanie"
    disabled="#{!bindings.przekierowanie.enabled}" id="cb1"/>
    </af:form>
    </af:document>
    </f:view>
    And I want to initialize the InputText with parameter from URL (param name is test - value="#{param.test}"). In JSF page everything is fine. But after clicking button I have to read the value from InputText in Java Code, so I have URL:
    http://127.0.0.1:7101/Application6-ViewController-context-root/faces/view12.jsf?test=asd
    and my Java code which is executed after clicking button is:
    public String przekierowanie() {
    Map <String,String> map=FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
    String tttValue=map.get("test");
    System.err.println("test:" + tttValue);
         return null;
    but this doesn't work... Everytime I get null when I click the button. Could you tell me why and How to obtain this value, from InputTex in my java function?

    Hi,
    If you have a parameter in URL named as "product", you can get its value like:
    import javax.faces.context.FacesContext;
    import javax.servlet.http.HttpServletRequest;
    FacesContext facesContext = FacesContext.getCurrentInstance();
    HttpServletRequest httpRequest =
    (HttpServletRequest)facesContext.getExternalContext().getRequest();
    String product = httpRequest.getParameter("product");

  • How to get data from URL in a PL/SQL procedure

    Hi!<br>
    <br>
    I want to pass values in APEX from a report with a link to a PL/SQL procedure through URL.
    How can I make this?<br>
    <br>
    For example:<br>
    <br>
    I have a report:<br>
    <br>
    select<br>
       id,<br>
       name,<br>
       akt,<br>
       case<br>
          when akt is NULL then '< a href="f?p=&APP_ID.:27:&SESSION.:START_PROCESS" name="test_link" >set< /a >'<br>
       end choice<br>
    from<br>
       USERS;<br>
    <br>
    I want to pass the value "id" in the link ( named "test_link" ) . And want to use this value in a process like this:<br>
    <br>
    DECLARE<br>
       v_user_id NUMBER(10);<br>
    BEGIN<br>
       --I want to read this value from the url<br>
       if :REQUEST='START_PROCESS' then<br>
          v_user_id := ????;<br>
          <br>
          ...<br>
       end if;<br>
    END;<br>
    <br>
    <br>
    Thanks!<br>
    Marton

    Hi,
    1- Create a hidden item P27_USER_ID on page 27
    2- Change your code :
    SELECT ID, NAME, akt,
           CASE
              WHEN akt IS NULL
                 THEN    '< a href="f?p=&APP_ID.:27:&SESSION.:START_PROCESS:NO::P27_USER_ID:'
                      || ID
                      || '" name="test_link" >set< /a >'
           -- refer to f?p=App:Page:Session:Request:Debug:ClearCache:itemNames:itemValues:PrinterFriendly
           END choice
      FROM users;
       And then
    DECLARE
       v_user_id   NUMBER (10);
    BEGIN
       --I want to read this value from the url
       IF :request = 'START_PROCESS'
       THEN
          v_user_id := :p27_user_id;
           --your code
       END IF;
    END;Hope this helps,
    Grégory

  • Search Results web part - Custom Query using "Value with a parameter from URL" inconsistent

    I have encountered what I think may be a bug, but I am hoping that there is something that I am missing.
    Within my search site, I have created a new search results page where I want to customize the "Search Results" web part query.  I can add in any number of property and keyword filters (using the "Build Your Query" dialog) without
    issue... until I add a filter that uses the QueryString property (the builder dialog calls this "Value with a parameter from URL").
    If I use {QueryString.MyParameterX} for filtering, it works beautifully in the query builder dialog.  I see the expected results in the search results preview pane, but as soon as I apply the changes things become inconsistent. 
    If I close/reopen my browser and navigate to my page at http://myaddress/search/Pages/testresults.aspx?MyParameterX=test I see results.  If I then refresh the page, I get a "Nothing here matches your search" message.  I can then go to
    the same address but change one character to an uppercase character and get results.  Refreshing that same page again returns "Nothing here matches your search".  I can only get search results one time per uniquely cased URL without having
    to close/reopen my browser.  This behavior was seen on both Firefox and IE.
    Finally, I found that if I instead navigate to http://myaddress/search/testresults?MyParameterX=test, it always returns results.  This, unfortunately isn't the best solution for me... but it is a solution.
    Any insight that anyone can provide is greatly appreciated!  I would really like to be able to depend on this working in all logical cases (especially since the search center of other sites is set using the path all the way down to /Pages).
    Thanks!

    Hi, have you been able to solve this issue? I'm getting the same issue and I cant solve it (required CU is installed).
    Fabio

  • How to get parameter value from report in event of value-request?

    Hi everyone,
    The customer want to use particular F4 help on report, but some input value before press enter key are not used in event of "at selection-screen on value-request for xxx", How to get parameter value in this event?
    many thanks!
    Jack

    You probably want to look at function module DYNP_VALUES_READ to allow you to read the values of the other screen fields during the F4 event... below is a simple demo of this - when you press F4 the value from the p_field is read and returned in the p_desc field.
    Jonathan
    report zlocal_jc_sdn_f4_value_read.
    parameters:
      p_field(10)           type c obligatory,  "field with F4
      p_desc(40)            type c lower case.
    at selection-screen output.
      perform lock_p_desc_field.
    at selection-screen on value-request for p_field.
      perform f4_field.
    *&      Form  f4_field
    form f4_field.
    *" Quick demo custom pick list...
      data:
        l_desc             like p_desc,
        l_dyname           like d020s-prog,
        l_dynumb           like d020s-dnum,
        ls_dynpfields      like dynpread,
        lt_dynpfields      like dynpread occurs 10.
      l_dynumb = sy-dynnr.
      l_dyname = sy-repid.
    *" Read screen value of P_FIELD
      ls_dynpfields-fieldname  = 'P_FIELD'.
      append ls_dynpfields to lt_dynpfields.
      call function 'DYNP_VALUES_READ'
        exporting
          dyname     = l_dyname
          dynumb     = l_dynumb
        tables
          dynpfields = lt_dynpfields
        exceptions
          others     = 1.
      check sy-subrc is initial.
    *" See what user typed in P_FIELD:
      read table lt_dynpfields into ls_dynpfields
        with key fieldname = 'P_FIELD'.
    *" normally you would then build your own search list
    *" based on value of P_FIELD and call F4IF_INT_TABLE_VALUE_REQUEST
    *" but this is just a demo of writing back to the screen...
    *" so just put the value from p_field into P_DESC plus some text...
      concatenate 'This is a description for' ls_dynpfields-fieldvalue
        into l_desc separated by space.
    *" Pop a variable value back into screen
      clear: ls_dynpfields.
      ls_dynpfields-fieldname  = 'P_DESC'.
      ls_dynpfields-fieldvalue = l_desc.
      append ls_dynpfields to lt_dynpfields.
      call function 'DYNP_VALUES_UPDATE'
        exporting
          dyname     = l_dyname
          dynumb     = l_dynumb
        tables
          dynpfields = lt_dynpfields
        exceptions
          others     = 0.
    endform.                                                    "f4_field
    *&      Form  lock_p_desc_field
    form lock_p_desc_field.
    *" Make P_DESC into a display field
      loop at screen.
        if screen-name = 'P_DESC'.
          screen-input = '0'.
          modify screen.
          exit.
        endif.
      endloop.
    endform.                    "lock_p_desc_field

  • How to get file from server while click on link

    Hi,
    i created on link and i gave one server path to select file from server but while clickinng on link it no displaying any thing.
    following is the Destination url that i gave for the item.
    /u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/
    please tell me how to get file from server while click on link.

    Ok I got your requirement now.
    If you are getting file names from view attribute then you should not be adding destination URI property for the link.
    Instead you can use OADataBoundValueViewObject API.
    Try below code in your controller processRequest method:
    I am assuming that you are using classic table.
    Also in below example it considers OAMessageStyleText and you can replace it with link item if you want.
    OATableBean tableBean =
    (OATableBean)webBean.findChildRecursive("<table item id>");
    OAMessageStyledTextBean m= (OAMessageStyledTextBean)tableBean.findChildRecursive("<message styled text in table item id>");
    OADataBoundValueViewObject tip1 = new OADataBoundValueViewObject(m, "/u08/app/appvis/xxex/inst/xxex_apps/xxrbe/logs/appl/conc/log/"+"<vo attr name which stores file name for each row>");
    m.setAttributeValue(oracle.cabo.ui.UIConstants.DESTINATION_ATTR, tip1);
    Regards,
    Sandeep M.

  • How to get the customize url of an portlet using PLSQL

    How to get the customize url of an portlet using PLSQL.

    Are you trying to call the portlet Customization form directly from the browser?

  • How to get data from PDF form?

    PDF forms can send data in url like GET or POST method. Is it possible to get data from url, like in PHP http://sever/file.php?item1=value1&item2=value2&item3=value3
    In APEX url have specific construction and I don't know how to get value of items (1...3)
    Please let me help to find simple method of geting data from URL.
    Best Regards,
    Mark

    The APEX URL syntax is detailed here
    http://download.oracle.com/docs/cd/E14373_01/appdev.32/e11838/concept.htm#BCEDJBEH
    How to get it from PDF is another matter...
    I'm working on an app that downloads PDFs with a Large amount of data as a blob, takes that blob and changes it to XML, then goes through the xml to validate each section of data and then add it into the schema that my apex app is referencing....
    I didn't write the original code but I do know that it isn't a quick thing to implement and includes using some uploading some java jar files to your schema and writing some custom java code.
    Someone else may be able to help with grabbing PDF data into the URL for the amounts of data you want to pass to apex.
    Gus..
    REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!
    Edited by: Gussay on Sep 21, 2009 5:52 PM

  • How to get resultset from oracle procedure use ejb3

    how to get resultset from oracle procedure use ejb3
    i know oracle procedure should like this
    Create or replace PROCEDURE resultset_test(
    aaa IN NUMBER,
    bbb OUT sys_refcursor) ....
    but what s the ejb3 scripts looks like? please give me an example or link~
    ths

    - there are no EJB3 scripts, only compiled application code
    - the part of the EJB spec that deals with databases is called the Java Persistence API, but likely you are just looking for the JDBC API.
    Now you should know what to Google to get your "example script": "java jdbc oracle procedure"

  • How to get acknowlgmnt from EFT (debt card swap) machine from swing app.

    Hi,
    Please some 1 let me know how to get acknowlegdement from EFT ( debit card Swap) machine once it is connected to the computer.
    I have a code which seems to have no errors ut it I am not sure whether the EFT machine will be able to send or recieve the data once the car is swaped. because i dont know what is the response of the EFT machine when connected to the computer though a java swing class.
    I know it will be quite tidious job for you to go through my program but this is all i can do...or atleast give me a link where i can refer to such case.......I am using eclipe Ide....and have searched alot on google too......

    Vish_1x1 wrote:
    Hi,
    Please some 1 let me know how to get acknowlegdement from EFT ( debit card Swap) machine once it is connected to the computer.What do you mean by "acknowledgement"? You realise it needs some sort of authorising host in order to authorise, right?
    I have a code which seems to have no errors ut it I am not sure whether the EFT machine will be able to send or recieve the data once the car is swaped. because i dont know what is the response of the EFT machine when connected to the computer though a java swing class.Mumbo-jumbo
    I know it will be quite tidious job for you to go through my program but this is all i can do...or atleast give me a link where i can refer to such case.......I am using eclipe Ide....and have searched alot on google too......Where did you get this "EFT machine" (whatever that is)? Do you mean a card reader? An EMV terminal? A PDQ? What? Where did it come from? Start there. If you need to get this thing working, you must be part of an enterprise, which has access to resources such as hardware vendor support, merchant banking services and EFT software vendors. If you're not, then you might as well abandon all hope of using this machine to take cards on your own, because you can't. End of story
    And, no, nothing to do with Java

  • How to use Parameter from file in window env

    hi All,
    Please tell me the how I can get Parameter from Saved file and can use in other file.
    EX:
    I want to use Password file for each instance like
    ORCL-manager
    ORCL_1-tiger
    ORCL_2-*****
    how to call this file in other file. using pasword for instance
    any help would be appereciated.
    Regards,

    You can use SFTP for this.
    This is a way of implementing SFTP in SSIS using standard tasks 
    http://visakhm.blogspot.in/2012/12/implementing-dynamic-secure-ftp-process.html
    also see
    http://blog.goanywheremft.com/2011/10/20/sftp-ftps-secure-ftp-transfers/
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • How to get BOOLEAN from STORED FUNCTION

    We are calling legacy PLSQL stored procedures and functions via named queries. This has worked fine so far, but there are some functions which return the type 'BOOLEAN'. e.g.
    FUNCTION some_function( some_argument IN NUMBER) RETURN BOOLEAN;
    Where the return type is BOOLEAN calling the named query fails with
    Local Exception Stack:
    Exception [TOPLINK-4002] (Oracle TopLink - 10g Release 3 (10.1.3.0.0) (Build 060118)): oracle.toplink.exceptions.DatabaseException
    Internal Exception: java.sql.SQLException: ORA-06550: line 1, column 13:
    PLS-00382: expression is of wrong type
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Error Code: 6550
    A couple of threads have hinted that what we are trying to do is not possible:
    How to get BOOLEAN from STORED PROCEDURES
    Re: Creating Named Query: from OracleCallableStatement
    This would possibly be due to 'restriction in the OCI layer'. Can anyone help? Is there really now way to call a valid PLSQL stored function via a named query when the return type is BOOLEAN?
    thanks

    I can't comment on possible issues you might have with the driver, but if it can be done in JDBC, it should be possible in TopLink.
    TopLink has the StoredFunctionCall which extends the StoredProcedureCall but adds an unnamed ouput parameter in the first spot of its parameter list. You will need to get the databasefield and set its type to BOOLEAN ie:
      DatabaseField returnField = (DatabaseField)yourStoredFunctionCall.getParameters().firstElement();
            returnField.setName(name);
            returnField.setSqlType(Type.BOOLEAN);Be sure not to use the setType() method, as I believe TopLink will try to use the Type.BIT when a boolean class is used as the classtype.
    Best Regards,
    Chris

  • How to get answers from forum

    Hi,
    Just wondering, how to get answer from forum.  Some time, for simple question, I don't see anybody replying. 
    Is there any other platform we get define answer or is there any support who can connect to our system suggest resolution?
    Thanks,
    -Anand

    anand_gp wrote:
    Just wondering, how to get answer from forum.  Some time, for simple question, I don't see anybody replying.
    If it's really a simple question, then most people probably think the poster can get the answer from the documentation, or by searching the forum for previous answers.
    However, most of the time, it's not that the question actually is simple. It's usually a question that is being asked simplistically, making it nearly impossible to answer (or often even understand). To get an effective response to a question, it needs to be the right question, asked in the right way.
    Describe the the problem/requirement (not the attempted solutions) in detail:
    How to ask questions
    Re: 2. How do I ask a question on the forums?
    Include as much relevant information with the question as possible, starting with:
    APEX version
    DB version, edition and host OS
    Web server architecture (EPG, OHS or APEX listener), server platform, and host OS
    Browser(s)/version(s) used
    UI/Theme
    Templates
    Region type (making particular distinction as to whether a "report" is a standard report, an interactive report, or in fact an "updateable report" (i.e. a tabular form)
    With APEX we're also fortunate to have a great resource in apex.oracle.com where we can reproduce and share problems. Reproducing things there is the best way to troubleshoot most issues, especially those relating to layout and visual formatting. To get a detailed answer then it's appropriate for the questioner to take on a significant part of the effort by reproducing the problem on apex.oracle.com before asking for assistance with specific issues, which can then be seen at first hand in a real APEX environment.

  • How to get hostname from targetlist in custom deployment procedure?

    When I make a simple procedure with a phase that will loop through a procedure hostname list
    and a hostcmd or directive inside that will use the hostname ex change a configuration file. How to get hostname from the hostname targetlist?
    I would rather not use $(hostname) or similar function if I can get the hostname from the target list.
    Edited by: user476601 on 2012-09-06 05:59

    I have tried that and cannot get it to work.
    I have tried to make a procedure with:
    parameter
    - parallel fase
    - step directive with hostname parm based on simple sh script (echo $hostname)
    - map hostname setvalue %TargetName%
    In a hostcmd step you cannot access %TargetName% directly
    it doesn't work. Please come with an example if you have tried it.
    /René

  • Removing jsessionid parameter from url of Webdynpro iview

    Hi All,
             While i create a Webdynpro iview from SAP Webdynpro iview template, the generated url gets appended with the parameter jsessionid as shown.
    http://server:port/webdynpro/dispatcher/local/session/New_app;<b>jsessionid</b>=(J2EE14778100)ID1600385450DB11689045888563713719End
    I don't want this parameter to be appended and exposed in the url of the ivew. Is there any way i can hide/remove this parameter from the generated url?
    Regards,
    Vijay.K

    Hi All,
             I found that, the Webdynpro template which is an App-Integrator appends the parameter jsessionid to the generated URL. So, i tried changing some properties of the system regarding session, but i couldn't remove this parameter from URL.
    I also found that, custom Application integrators can also be developed. So, is it possible to get rid of the jsessionid parameter by developing a custom App-Integrator for Webdynpro application?
    Please help me in this regard.
    Regards,
    Vijay.K

Maybe you are looking for