Parameter passing from JSF to a Java class

Hi,
I am new to JSF, and I looked around in the questions to find an answer to my "Parameter passing" question. No luck..
Below is an example that illustrate what I mean:
This illustrate a way that I have found to work:
<h:commandButton value="New"
disabled="#{buttonHandler.newDisabled}" />
<h:commandButton value="Delete"
disabled="#{buttonHandler.deleteDisabled}" />
But something like this is more how I would prefer to do it:
<h:commandButton value="New"
disabled="#{buttonHandler.Disabled("New")}" />
<h:commandButton value="Delete"
disabled="#{buttonHandler.Disabled("Delete")}" />
Yes, I know it does not work.. but it illustrates what I want to do. I would like to use the same Java method for all buttons and just pass a parameter to sort out which one it is.
Someone knows how to achieve this?

In the get(key), you can pass in object, and do
whatever you want with it. That's exactly what you
want, but maynot be as nice, but that's EXACTLY what
you want I think, except you have to work with get
function, not your function. But you can just call
your function in the get function.(Shudder) Really, "hack" is too kind for this.
So to continue my checksum example above: I can "easily" find the checksum of an object by creating an implementation of Map that really only implements the get() method and throws a method-not-implemented exception for all other methods (violating the rule that all classes implementing Map should follow Map semantics). Then I create a getChecksum() method on my backing bean, which returns this Map adapter and allows me to property-bind+map-bind to:
#{myBean.checksum[myObject]}
Now for every single method I want to implement, I have to create a whole new class that implements Map but really isn't a Map! Horrors! And this assumes, as you later note, that I only want to use one parameter---never more. Of course, for mutiple parameters, I could always create a map of maps, with each sub-map another custom class implementing Map just so that it can represent another parameter and allow:
#{myBean.checksum[myObject][myColor][myWeight]}
Disgusting---a fake semantics-violating map class for each parameter?
Can someone who designed JSF let us know why in the world that we can't pass parameters to a method?
Garret

Similar Messages

  • Parameter passing from Java to Jsp

    Hi all,
    I have an XML and a Java class. I have taken some values from XML into my Java class. Now I want to pass these parameters to a Jsp and display it as a link tag.
    Somebody please help me...

    You add them to the servlet Request object as attributes, then you use ServletContext.getRequestDispatcher(uri).forward(request, response) to transfer to the jsp.
    It's usually cleanest to use some kind of bean as a "Data transfer object" so that all your stuff goes accross as one attribute and you can get it with <jsp:useBean >

  • Passing array of Types to java class

    I am trying to pass a user defined type (that is an array) from PL/Sql to a javaclass. Here are the definitions that make-up the parameter to pass from PL/Sql to Java (uri_digest_array):
    CREATE OR REPLACE TYPE uri_digest as object (uri VARCHAR2(256),
    digest_value CLOB);
    CREATE OR REPLACE TYPE uri_digest_array AS VARRAY(10) OF uri_digest;
    In Oracle-land, java classes are published to PL/Sql by way of the following definition. Note that the intent here is to have compatible data-types.
    CREATE OR REPLACE FUNCTION SIGNRETURNINGXML (p_array IN uri_digest_array)
    RETURN LONG
    AS LANGUAGE JAVA
    NAME 'SignReturningXml.main(oracle.sql.Array) return java.lang.String';
    Here is a fragment of the java class code:
    class SignReturningXml {
    public static String main(String [] [] signItems ) // I have no idea what datatype to use here!
    { . . . . The code in here would process the passed array normally from first entry to last.
    Currently I get the following error:
    PLS-00311: the declaration of
    "SignReturningXml.main(oracle.sql.Array) return
    java.lang.String" is incomplete or malformed
    I could use some suggestions on resolving the datatype conflicts. Any ideas? Has anyone tried this kind of thing?
    Thanks,
    Michael

    Michael,
    At the risk of another [non] useful response, I meant that you should try searching the "Ask Tom" Web site, because usually you will find an answer to your question that has already been asked by someone else. Perhaps these will be helpful:
    [url=http://asktom.oracle.com/pls/ask/f?p=4950:8:1320383202207153292::NO::F4950_P8_DISPLAYID,F4950_P8_CRITERIA:8908169959941
    ]Can I Pass a nested table to Java from a pl/sql procedure
    [url=http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:712625135727
    ]passing arrays into pl/sql stored procedures
    Good Luck,
    Avi.

  • Call a portal component from a Command IU Java Class

    Hello,
    Please, how can I do to call a portal component from my Command IU Java Class?
    Thanks & Regards,
    Hassan

    Hi Hassan,
    a portal component can be called directly through URL.
    The general syntax to call the portal component (iView, page) is as follows:
    <http/https>://<server>:<port>/irj/servlet/prt/portal/prtroot/<pcd_path_of_iview_or_page>
    Replace all ":" in the pcd path by "!3a". Also replace all "/" by "!2f" in the pcd path in the URL.
    Hope this helps.
    Best regards,
    Denis

  • Parameter Passing from UWL to WebDynpro Component

    Hi Everyone,
    I m having a small problem in parameter passing from the UWL to the Webdynpro component(EP6 SP16).
    The UWL shows a list of shopping carts and I ve configured it such that the Shopping carts open in the webdynpro application. Now the requirement is that I want to pass the shopping cart number from the workitem container and retrieve it in the webdynpro component.
    The only thing that i m able to retrieve is the work-item ID. I ve followed the documentation on help.sap.com but I m not able to figure out how to move ahead with this.The code which i m using to retrive the dynamic parameter is
    String text = WDWebContextAdapter.getWebContextAdapter().getRequestParameter("DynamicParameter");
    Can somebody please help me with this..
    Regards,
    Prathamesh

    Have you looked at this weblog by Ginger Gatling?
    Create new UI's for existing workflow tasks with ABAP Web Dynpro and Universal Worklist!
    Hope this helps.
    Sudha

  • Parameter passing from servlet to jsp page

    Hi
    I m facing problem of parameter passing from servlet to jsp ..
    plz help me...
    I m using as ...
    in servlet code I m using ...
    request.setAttribute("string",parameter);
    and in jsp..
    request.getParameter("string");
    regard's
    JAI KUMAR

    Hi Jaykumar
    You should use
    <%= request.getAttribute("sting") %> or
    ${string}
    in your jsp. I think you are trying to retrive the parameter instead of attribute.
    Thanks

  • Calling a web service from a stand alone java class

    I need to invoke a web service from stand alone java class- Please let me know how to acheive this.
    Thanks

    Hi jazz123,
    There's an example in the [*Java Web Services Tutorial*|http://java.sun.com/webservices/docs/2.0/tutorial/doc/] : see Chapter 1: Building Web Services with JAX-WS - A Simple JAX-WS Client.

  • Is there any way to prevent web.xml from any change like java class?

    hi all,
    Is there any way to prevent web.xml from any change after making EAR(WAR)?
    One can easily make a change in web.xml and redeploy the application to get the result. Now we want to restrict the web.xml as java class for any change after making EAR(or WAR).
    Could some one help me to do this?
    thanks,
    dinesh

    hi,
    Not at development level. We want it after deploying the application on server .
    We want to create it (web.xml) at tomcat startup (or in any other web/app server ) before loading any context.
    Is there any way to run a simple java class(not servlet) on tomcat startup(before initializing the contexts)?
    Message was edited by:
    DP_java
    Message was edited by:
    DP_java

  • Is it possible to throw another Fault from Fault Policy handler Java Class?

    Hi,
    I am using SOA Suite 11g. My requirement is to catch any Fault that occurs in BPEL in the Fault Policy java handler, and then throw back another Fault (Which i want to create from the java class hander) by setting the Fault Part and other Fault details.
    I will be getting the Fault message and code etc for different kinds of faults from a .properties file.
    I tried creating a new BPELFault inside the handleFault method...
    BPELFaultRecoveryContextImpl bpelCtx = (BPELFaultRecoveryContextImpl) ctx;
    QName qName = new QName("http://xmlns.oracle.com/Application1_jws/FMF_Demo/FaultHandlerDemo","GenericFault");
    BPELFault flt = new BPELFault(qName);
    flt.setFaultName(qName);
    flt.setPart("<faultPartName>","Fault Message Text...");
    bpelCtx.setFault(flt);
    The new Fault is thrown back to the BPEL process, but i am not able to get the Fault details within the catch block (for GenericFault) that i have set in the Java Handler.
    Any help regarding this is highly appreciated.
    Regards,
    Shreyas

    Has anybody come across this issue? Please help.
    Regards,
    Shreyas

  • From PL/SQL call java class present in Application server

    Hi,
    I need to call a java class file which is present on the application server. the call has to be made from pl/sql.
    I do not want to make use of the java stored procedures for this.
    Is there a way to call a class file residing on the application server from a pl/sql.
    Please help me out.
    Thanks & Regards
    Kamlesh

    New idea. DDL isn`t working but if i would make some DQL ? Like select??
    I`m trying to deploy java class like this:
    public class test {
         public static String say()
              throws SQLException{
                   Connection conn = new OracleDriver().defaultConnection();
                   String sql = "Select names from pdb_proteins where numbers=61";
                   try {
                        // Load the Oracle JDBC driver
                        Class.forName("oracle.jdbc.OracleDriver") ;
                        System.out.println("Oracle JDBC driver loaded ok.");
                        } catch (Exception e) {
                        System.err.println("Exception: "+e.getMessage());
                   try {
                        ResultSet rset = null;
                        PreparedStatement pstmt = conn.prepareStatement(sql);
                        rset=pstmt.executeQuery(sql);
                        String wynik = null;
                        wynik = rset.getString(1);
                        return wynik;
              } catch (SQLException e) {
                   System.out.println("Connection Failed! Check output console");
                   e.printStackTrace();
                   return "nope";
    Then invoke with PL/SQL function
    and i`m getting error ORA-29534: object SYSTEM.oracle/jdbc/OracleDriver
    Could someone help me with this? How i could register jdbc driver inside Oracle db??
    Edited by: Rado_mir on 2013-06-03 02:42

  • Oracle forms 10g Parameter passing from forms to reports

    Hello Room,
    Please let me know what is wrong with this code. It is not passing parameter at all to the reports 10g parameter form from forms 10g, no matter what. I tried to delete the parameter from reports parameter form, I also tried to enable/disable restricted values from reports, I tried to hide the parameter from reports, but it is just not doing it.
    DECLARE
    pl_id PARAMLIST;
    repid REPORT_OBJECT;
    v_rep VARCHAR2(100);
    rep_status varchar2(20);
    report_job_id VARCHAR2(100);
    fill varchar2(100);
    reportname varchar2(200);
    ab varchar2(200);
    cursor c200 is select CONAME,LOCATIONMASTER.LOCNAME FROM USERCODETL,MULCOMP,LOCATIONMASTER
    WHERE MULCOMP.CO=USERCODETL.CO
    AND USERCODETL.USERID = SUBSTR(AB,1,50) AND USERCODETL.LOCCD = LOCATIONMASTER.LOCCD;
    begin
         AB := GET_APPLICATION_PROPERTY(USERNAME);
    OPEN C200;
    FETCH C200 INTO :block4.coname,:block4.locname;
    CLOSE C200;
    synchronize;
    pl_id:=GET_PARAMETER_LIST('paramlist');
    IF NOT ID_NULL(pl_id) THEN
    DESTROY_PARAMETER_LIST(pl_id);
    END IF;
    pl_id:=CREATE_PARAMETER_LIST('paramlist');
    Add_Parameter(pl_id, 'vcompany', TEXT_PARAMETER, :block4.coname);
         Add_Parameter(pl_id, 'vlocname', TEXT_PARAMETER, :block4.locname);
    repid := find_report_object('testreport');
    fill := GET_REPORT_OBJECT_PROPERTY(repid, report_server);
    reportname := GET_REPORT_OBJECT_PROPERTY(repid, report_filename);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,RUNTIME);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'pdf');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'repsrv');
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no'||'vcompany='||:block4.coname||'vlocname='||:block4.locname);
    v_rep := RUN_REPORT_OBJECT(repid,pl_id);
    WEB.SHOW_DOCUMENT('/reports/rwservlet?report='||reportname||'&desformat=pdf&destype=cache&userid=scott/tiger@servernew&paramform=yes');
    END;
    Please help. Thank you in advance.

    Hello Inol,
    Greetings !
    There seems to be a syntax error when I run your code:-
    REP-52251: Cannot get output of job ID 272 you requested on Fri Apr 08 02:37:25 GMT 2011.<P>REP-51026: No output for job 272
    when I run then command:-
    http://local-pc:8889/reports/rwservlet/showjobs
    Terminated with error: <br>REP-159: Syntax error on command line.
    Is there a error on your statement ?
    WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1) ||'?server=repsrv );
    it should be
    WEB.SHOW_DOCUMENT('/reports/rwservlet/getjobid'||substr(v_rep,instr(v_rep,'_',-1)+1) ||'?server=repsrv ' );
    then only it is getting compiled properly. A single quote in the end !
    And finally I changed this line
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no p_1='||:SP_USERCODE 'p_my_second_parameter='||:block.my_second_parameter);
    to this line
    SET_REPORT_OBJECT_PROPERTY(repid,REPORT_OTHER,'paramform=no p_1='||:SP_USERCODE|| *'p*mysecond_parameter='||:block.my_second_parameter);
    as it is giving error where highlighted in bold Is it necessary to change and add a concatenation there ?_
    But... But... even though I compile it properly the code is getting executed and it is giving the above error. Please note the same.
    Also please tell me what should be the status of the following things in report builder 10g.
    1. Shall I remove the parameters vcompany and vlocname from the parameter form and keep it just in parameters of report , There is a third parameter which I want the user to input while running the report other than these 2 parameters ?
    2. Shall I restrict the parameter to predetermined values ?
    3. Shall I hide the first column of the parameter in report builder.
    I have also tried to simulate the execution parameters from batch to runtime and comm mode to synchronous and asynchronous and vice versa. I have also given command rwserver server = repsrv on my pc and also server pc. please let me know about this also whether I need to give this command every time ? I mean for every booting ?
    As this problem is faced by many people. I think it should work across the fly as given by you or rather corrected by you. I would also like to know is there any patch available for the same released by oracle, as I have read somewhere in the forum here which I cannot locate the thread now. I do not mind paying for support if I find the need ?
    Please help me further. Thank you.

  • Parameter passing from master to subreport

    Is it possible to pass a multi-value parameter from a master report to one or more subreports? If so, how?
    Thanks for any help.
    Wayne E. Pfeffer

    Yes you can do this. I suggest the following: In your subreport make the report parameter a multi-value parameter. Test the subreport stand alone and make sure it works. Then drop the subreport into your main report, and map the subreport parameters to the main report parameters.
    Scenario 1 (multi value parameter pass through):
    The Main report has report parameter A which is a multi value parameter. You want to pass it to SubReport1 which has a report parameter B which is also defined as multi value parameter. In this case the mapping is just a simple parameter expression: =Parameters!A.Value
    The subreport RDL element would look like this:
              <Subreport Name="SubReport1">
                <Parameters>
                  <Parameter Name="B">
                    <Value>=Parameters!A.Value</Value>
                  </Parameter>
                </Parameters>
              </Subreport>  
    Scenario 2:
    The Main report has no report parameters. You have a SubReport1 with a report parameter B defined as multi value parameter. You want to pass e.g. three selected values "A", "B", "C" as parameter values to the subreport. You need to create a multidimensional object array on-the-fly, e.g. with the Split function, e.g.: =Split("A,B,C", ",")
    RDL example:
              <Subreport Name="SubReport1">
                <Parameters>
                  <Parameter Name="B">
                    <Value>=Split("A,B,C", ",")</Value>
                  </Parameter>
                </Parameters>
              </Subreport>
    Scenario 3:
    The Main report has a multi-value parameter A. You want to pass only the first selected value from the main report's parameter to the subreport and the subreport's report parameter B is a single-value parameter. You can do this by using e.g. =Parameters!A.Value(0)
    RDL example:
              <Subreport Name="SubReport1">
                <Parameters>
                  <Parameter Name="B">
                    <Value>=Parameters!A.Value(0)</Value>
                  </Parameter>
                </Parameters>
              </Subreport>
    -- Robert

  • How to use parameter passed from standard page in VO query of custom page

    Hi everyone,
    I have a custom page which needs to be called from a standard page. Now this custom page is based on some parameters passed from standard page.
    How do I catch those parameters i my custom page .
    And how to use those parameters in the VO query of my custom page.
    Edited by: Bunny on Nov 11, 2010 9:16 AM

    Hi,
    Bunny wrote:
    I have a custom page which needs to be called from a standard page. Now this custom page is based on some parameters passed from standard page.
    How do I catch those parameters i my custom page .---If standard page the button style is :Button,Then u can set Destination URL in personalization.
    Destination UR:"OA.jsp?page=/xxx/oracle/apps/po/msg/webui/CustomUpdatePG&Flag=" +Value  ---Like u can pass params
    ---IF the button style is :Submitbutton ,Then u need to customization of the co.
    ---In co processFormReq call a cutom page like below.
    pageContext.setForwardURL("OA.jsp?page=/xxx/oracle/apps/po/msg/webui/customUpdatePG&Flag=" +Value, null, (byte)0, null, null, true, "N", (byte)0);
    ---In custom page co in processRequest u can get these value :String value=pageContext.getParameter("Flag");
    And how to use those parameters in the VO query of my custom page.---Get the vo and set where clause
    String where="valueAttr="+value;
    vo.setWhereClauseParams(null);
    vo.setWhereClause(where);
    vo.executeQuery();
    Regards
    Meher Irk
    Edited by: Meher Irk on Nov 11, 2010 11:53 PM

  • (HELP) Is it possible to launch a seperate java app from W/I a java class?

    I have been struggling with this for two weeks now and I still can't get a seperate java application to launch from from w/i my java application. I've gotten my code to compile, and I have saved the output of the command (java ....) to an OutputStream. I tried an alternative to display output to the command prompt, but this will not work if I want to display a gui. If anyone knows how to do this please explain or direct me to some info. Until then the search continues.

    Hey Doc,
    I tried that, it executes the command, but does not launch the application. I've looked at previous posts, but it seems that no one has the answer. Well such is life, LOL.

  • Parameter passing from java applet

    Hi all.
    currently i'm trying to create online testing applet (like TOEFL exam) for fun.
    i've create basic testing rutine, but i got stuck on showing the results.
    i want to show the results on the HTML so that users can print it out easily. but i donw know how to pass parameter from Java to some other language.
    I've searched for JavaScript, but it seems that it's only possible when using NetScape. Also, I searched for PHP, but it's just not possible. HTML seems that it's only possible from "HTML to Java"...
    if anyone knows how i can do it, and which language i should use, please let me know.
    thanx!

    i want to print out the questions that user have mistaken. print out the question, wrong answer, and right answer.
    all the answers are created by radiobutton so i want to get the only the Strig values, which wouldn' be so difficult.
    I've searched about JSObject, but could u tell me where can i install the package (or SDK)?
    And do users need to install the package as well?
    thanks for your time.

Maybe you are looking for

  • Problem Editing/Deleting the Photos uploaded via iTunes

    I uploaded some photos via iTunes to my iPad as well as my iPhone. I wanted to take advantage of the photo edito, the devices will not allow me to edit the original photo uploaded photo file. It is asking I do "Duplicate and edit" which will leave me

  • Info record price history

    Dear Experts, If we go to inforecord> Environment>Order price history, we can find a order price history report. The Table in which this price history data is stored is EIPA. I there any transaction to upload past order price history in SAP while ini

  • JDBC-OCI (8.1.6) - Weblogic

    Hi, I am trying to get weblogic 4.5 to connect to an Oracle 8i database. The database and listener are operating fine, but so far I cannot connect from weblogic. 1) What type is the JDBC-OCI driver for 8.1.6 (supporting JDK 1.2)? 2) Do I need to inst

  • Weird "Trend" metric calculation in Tabular KPI

    Hi Experts , We have a tabular model in which we started designing the KPI to show Actual metric value vs its Target comparison by an Status indicator to know how good the metric has performed.  In the KPI calculation window of the tabular model , th

  • Make Delivery note mandatory in MIGO

    Hi Friends,                           My client want to make mandatory for Delivery note field  in the Goods reciept in MIGO. can you please explain how to do this?