Passing object as parameter in JSF using h:commandLink tag

Hi ,
I have a scenario in which i need to pass objects from one jsp to another using h:commandLink. i read balusC article "Communication in JSF" and found a basic idea of achieving it. Thanks to BalusC for the wonderful article. But i am not fully clear on the concepts and the code is giving some error. The code i have is
My JSP:
This commandlink is inside a <h:column> tag of <h:dataTable>
<h:commandLink id="ol3"action="ManageAccount" actionListener="#{admincontroller.action}" >
               <f:param id="ag" name="account" value="#{admincontroller.account}" />
               <h:outputText id="ot3" value="Manage Account" rendered="#{adminbean.productList!=null}" />
               </h:commandLink>
Also a binding in h:dataTable tag with the  binding="#{admincontroller.dataTable}"
                  My Backing Bean:
public class CompanyAdminController {
          private HtmlDataTable dataTable;
          private Account account=new Account();
public HtmlDataTable getDataTable() {
        return dataTable;
public Account getAccount() {
         return this.account;
public void setAccount(Account account) {
          this.account = account;
      public void action(){
            account= (Account)this.getDataTable().getRowData();
       } faces-config.xml
<navigation-rule>
    <from-view-id>/compadmin.jsp</from-view-id>
    <navigation-case>
      <from-outcome>ManageAccount</from-outcome>
      <to-view-id>/manageAccount.jsp</to-view-id>
    </navigation-case>
  </navigation-rule>
<managed-bean>
          <managed-bean-name>admincontroller</managed-bean-name>
          <managed-bean-class>com.forrester.AdminController</managed-bean-class>
          <managed-bean-scope>request</managed-bean-scope>
          <managed-property>
               <property-name>account</property-name>
               <property-class>com.model.Account</property-class>
               <value>#{param.account}</value>
         </managed-property>
     </managed-bean>My account object:
public class Account {
string name;
  public String getName()
    return this.name;
  public void setName(String name)
       this.name=name;
  }I need to display #{admincontroller.account.name} in my forwarded jsp. But I am not sure whether the code i wrote in commandlink is correct. I get an error if i use <f:setActionListener> . No tag "setPropertyActionListener" defined in tag library imported with prefix "f"
Please advise.
Edited by: twisai on Oct 18, 2009 11:46 AM
Edited by: twisai on Oct 18, 2009 11:47 AM
Edited by: twisai on Oct 18, 2009 11:48 AM

Yes.. iam removed the managedproperty from faces-config. But still i get the null pointer exception on main jsp itself and i am taken to second jsp manageaccount.jsp. Did you find anything wrong in my navigation case in the action method??
                                 public String loadAccount(){
           Account account = (Account)this.getDataTable().getRowData();
            return "ManageAcct";And also can you please answer this question i have
The AdminController is the backing bean of 1st JSP and manageAccontController is the backing bean of forwarded JSP .
Can i put this action method and dataTable binding in a 2nd manageAccontController backing bean instead of AdminController. But if i do that way dataList binding in h:dataTable tag will be in first JSP backing bean and dataTable binding to 2nd JSP. Not sure how to deal with this.
{                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

Similar Messages

  • Will passing object as parameter increase memory usage?

    Hi,
    Will passing an object as a parameter increase the mmory usage? will it affect the performance of the application any means. Please share your view.
    Regards,
    A.

    Ananth.durai wrote:
    Hi ,
    Just to precise my question, suppose i have an object called Student.I want to pass the Student Object to a method called addStudent().Now rather than passing Student Object, i am passing it's super class "Object". (i.e)
    addStudent(Object object) instead of addStudent(Student student)will it make any difference in performance?Those are declarations, not method passing. You'd still be passing the same thing, if it's just a question about how you declare the method.
    And it will make no difference in performance, except when you start getting bugs. You might start getting bugs because you declared the parameter with a more general type than is really necessary. If the method takes a Student, then declare it as taking a Student. Making it say it takes an Object will just make things worse.
    But as per Cogniac,
    when you pass a parameter or use an accessor function (get() function) or something of that sort, it's actually just passing a pointer that points to the memory location of the Object you want, not actually passing the Object itself to you, nor is it instantiating a new instance of the Object for your use.if i pass Object itself instead of Student,which memory address it will point out?That question makes no sense. You pass what you pass. If it's a Student object, then the reference the method gets will point to that object, regardless of whether the method knows that it's a Student or just an Object generally.

  • Passing object as parameter

    Hi All,
    I have a procedure that takes IN an object as the parameter. I'm using SQL Developer , and also have SQL*plus.
    The type is
    create or replace
    TYPE TY_RAILROAD_OPERATOR AS OBJECT
    RRX_RAILROAD_OPERATOR_CD VARCHAR2(6 BYTE),
    RRX_RAILROAD_OPERATOR_NM VARCHAR2(60 BYTE) ,
    RRX_RAILROAD_OPERATOR_DSC VARCHAR2(2000 BYTE),
    STATUS CHAR(1 BYTE),
    LAST_UPDATE_DT DATE,
    LAST_UPDATE_USER VARCHAR2(60))
    procedure set_Railroad_Operator(p_TY_Railroad_Operator IN TY_Railroad_Operator, p_Railroad_Operator_Id OUT NUMBER) IS
    v_Railroad_Operator_Id NUMBER;
    BEGIN
    I have to execute the procedure. How should I pass the parameters?
    I would like to test the procedure, and I have no idea how to test it.
    Any help is appreciated.
    Thanks in advance
    N

    sample:
    SQL> CREATE OR REPLACE TYPE ty_railroad_operator AS OBJECT(
      2     rrx_railroad_operator_cd    VARCHAR2(6 BYTE),
      3     rrx_railroad_operator_nm    VARCHAR2(60 BYTE),
      4     rrx_railroad_operator_dsc   VARCHAR2(2000 BYTE),
      5     status                      CHAR(1 BYTE),
      6     last_update_dt              DATE,
      7     last_update_user            VARCHAR2(60)
      8  );
      9  /
    Type created.
    SQL> CREATE OR REPLACE PROCEDURE set_railroad_operator(
      2     p_ty_railroad_operator   IN       ty_railroad_operator,
      3     p_railroad_operator_id   OUT      NUMBER
      4  )
      5  IS
      6     v_railroad_operator_id   NUMBER := 10;
      7  BEGIN
      8     DBMS_OUTPUT.put_line(p_ty_railroad_operator.rrx_railroad_operator_cd);
      9     DBMS_OUTPUT.put_line(p_ty_railroad_operator.rrx_railroad_operator_nm);
    10     DBMS_OUTPUT.put_line(p_ty_railroad_operator.rrx_railroad_operator_dsc);
    11     DBMS_OUTPUT.put_line(p_ty_railroad_operator.status);
    12     DBMS_OUTPUT.put_line(p_ty_railroad_operator.last_update_dt);
    13     DBMS_OUTPUT.put_line(p_ty_railroad_operator.last_update_user);
    14  END;
    15  /
    Procedure created.
    SQL>
    SQL> DECLARE
      2     v_ty_railroad_operator   ty_railroad_operator
      3        := ty_railroad_operator('OP_CD', 'OP CODE NAME', 'OP CODE DESC', 'S',
      4                                SYSDATE, 'OP CODE USER');
      5     a                        NUMBER(10);
      6  BEGIN
      7     set_railroad_operator(p_ty_railroad_operator => v_ty_railroad_operator,
      8                           p_railroad_operator_id => a);
      9  END;
    10  /
    OP_CD
    OP CODE NAME
    OP CODE DESC
    S
    15-JUN-10
    OP CODE USER
    PL/SQL procedure successfully completed.
    SQL>

  • Method design question...and passing object as parameter to webserice

    I am new to webservice...one design question
    i am writing a webservice to check whether a user is valid user or not. The users are categorized as Member, Admin and Professional. For each user type I have to hit different data source to verify.
    I can get this user type as parameter. What is the best approach to define the method?
    Having one single method �isValidUser � and all the client web service can always call this method and provide user type or should I define method for each type like isValidMember, isValidAdmin ?
    One more thing...in future the requirement may change for professional to have more required field in that case the parameter need to have more attribute. But on client side not much change if I have a single isValidUser method...all they have to do is pass additional values
    isValidUser(String username, String usertype, String[] userAttributes){
    if usertype == member
    call member code
    else if usertype = professional
    call professional code
    else if usertype = admin
    call admin code
    else
    throw error
    or
    isValidMember(String username, String[] userAttributes){
    call member code
    One last question, can the parameter be passed as object in web service like USER object.

    First of all, here is my code
    CREATE OR REPLACE
    TYPE USERCONTEXT AS OBJECT
    user_login varchar2,
    user_id integer,
    CONSTRUCTOR FUNCTION USERCONTEXT (
    P_LOGIN IN INTEGER
    P_ID_ID IN INTEGER
    ) RETURN SELF AS RESULT
    Either your type wont be compiled or this is not the real code..

  • Pass an hidden parameter to the BI Publisher

    Hi guru,
    I need to pass a value (parameter) to a BI Publisher report without to show the value to the user. I tried to create an hidden parameter, and tried to pass the value but don't work. I tried to call the report in GET and POST without success.
    If the parameter is visible, it works.
    Any idea to do it with another method?
    Thanks in advance
    Alessandro Sabelli

    Hi,
    Thanks a lot for your answers.
    The link http://www.it-eye.nl/weblog/2006/06/12/passing-a-url-parameter-to-model-using-adf/ is no more reachable.
    The following EL expression work for displaying the parameter inside an outputText component :
    #{facesContext.externalContext.requestParameterMap[’yourParameter&#8242;]}
    The parameter is not sent to the business service when the button is clicked.
    Thanks,
    Seb.

  • ADF Faces + ADF BC : how to pass an url parameter to a backend business ser

    Hi,
    I'm using latest JDev studio version SU 3.
    My project is using ADF Faces with BC4J in the service layer.
    I have a backend application module which exposes a method taking a String parameter as an input (ex: void setUsername(String username))
    I need to have a jspx page which reads a parameter passed in the url (http://localhost/faces/registerUser.jspx?username=john) and send it to the backend service method when a submit is raised on a clicked button.
    It's pretty simple when using inputtext for example but not obvious if I want to use urm param instead of inputtext.
    How do I do this ?
    Thanks

    Hi,
    Thanks a lot for your answers.
    The link http://www.it-eye.nl/weblog/2006/06/12/passing-a-url-parameter-to-model-using-adf/ is no more reachable.
    The following EL expression work for displaying the parameter inside an outputText component :
    #{facesContext.externalContext.requestParameterMap[’yourParameter&#8242;]}
    The parameter is not sent to the business service when the button is clicked.
    Thanks,
    Seb.

  • How to pass Cascading Parameter in SSRS using Java

    How to pass Cascading Parameter in SSRS using Java---
    We are having a problem with dependent parameters.There are three drop down--
    1.first dropdown is of Country.When we select a country--Accordingly next dropdown(State)will populate
    2.Second dropdown is of State. When we select a state--Accordingly next dropdown(City)will populate.
    I have three data sources are
    CountryList-
    SELECT CountryRegionCode, Name
    FROM Person.CountryRegion
    ORDER BY Name
    StateList
    SELECT StateProvinceID, StateProvinceCode, CountryRegionCode
    FROM Person.StateProvince
    WHERE CountryRegionCode = @CountryRegionCode
    ORDER BY StateProvinceCode
    CityList
    SELECT StateProvinceID, City
    FROM Person.Address
    GROUP BY StateProvinceID, City
    HAVING (StateProvinceID = @StateProvinceID)
    ORDER BY City
    Ihave to show report that has been deployed on server on the besis of these parameters
    I am using ReportViewer in JSP Page through url--
    http://192.168.90.149/ReportServer/Pages/ReportViewer.aspx?%2fReport+Project1%2fCascading_Parameters&rs:Command=Render&rs:parameter=true&Country="+Country+"&State="+State;
    But it is not accepting parameter if they are cascaded.It is working fine if Both parameters are independent.
    Edited by: kaushlee on May 11, 2010 9:22 PM

    Take a look at set_custom_property:
    public static final ID SETTEXT = ID.registerProperty("SETTEXT");
    public boolean setProperty(ID pid, Object value)
        if (pid == SETTEXT)
    String text = value.toString();
    and in forms
    set_custom_property('beans.bean_item', 1, 'SETTEXT', 'some text');
    cheers

  • Hoe to pass object as a parameter thru webSerive

    I need to pass Object as a parameter to web service:
    example:
    public calss returnCodes{
    int ret_code;
    String ret_string;
    public retrunCodes(int ret_code, String ret_string){
    this.ret_code = ret_code;
    this.ret_string = ret_string;
    public int getret_code()
    return this.ret_code;
    public String getret_string {
    return this,ret_string
    and other repc holder class to hold returnCodes
    public class retrunCodesHolder implents javax.xml.rpc.Holder
    returnCode value;
    pubic returnCodesHolder(){
    public returnCodesHolder(returnCodes value) {
    this.value = value;
    In Webservice I use returnCodesHolder as parameter.
    WebService getReturnCodesWs I have
    returnCodes retCodes = new returnCodes(04,"Good return code)
    returnCodesHolder retholder = new returnCodesHolder(retCodes)
    return myString;
    When I am calling above webService in servlet I have code:
    org.test.mytest.returnCodesHolder retHolder = new org.test.mytest.returnCodesHolder();
    String result = port.getReturnCodesWs(retHolder);
    How to I access /get values of returnCodes class in my calling servlet?
    I am using Tomcat v 6.0

    I believe (although have never used, so if I'm wrong,
    correct me please!) you can do it with implicit
    dynamic cursors, such as:
    For rec in 'select col1, col2 from table 1 '||lstr
    loop
    Not really:
    michaels>  declare
       lstr   varchar2 (30) := ' where empno = 7788';
    begin
       for rec in 'select * from emp e ' || lstr
       loop
          null;
       end loop;
    end;
    Error at line 1
    ORA-06550: line 5, column 4:
    PLS-00103: Encountered the symbol "LOOP" when expecting one of the following:
       . ( * @ % & - + / at mod remainder rem .. <an exponent (**)>
       ||

  • Passing a Parameter to JSF / ADF

    Hi,
    I am using the MVC architecture with the model provided by ADF business components and the view/controller provided by JSF. Any help would be great since this project was due 'yesterday'. Thanks.
    I want going to pass a few parameters to a JSF (ex. test.jspz?userid=JOHN) using ADF business components for the database query (ex. select * where userid = 'JOHN').
    1) How to pass or accept parameters for JSF?
    2) How to parameterized the ADF business component to accept the parameter and run the query?
    Thanks,
    A Lucky Guy

    Shay, I'm looking at the same problem - legacy application needs to pass parameters to new ADF Faces application in the URL's query string. The problem is that it needs to use the parameter to build the page. So how do I get a method with the code that you suggested to run before rendering the page?
    I'm still in the midst of working on this, but the approach that I'm working on is based on a custom ADF Page Lifecycle as described in the ADF Developers Guide for Forms-4GL Developers section 10.5.4.3. I'm also looking at Steve Muench's not yet documented sample #60: http://radio.weblogs.com/0118231/stories/2004/09/23/notYetDocumentedAdfSampleApplications.html#60
    Some pages don't need to use this method. If you are using the page parameters as NamedData elements in an action or methodAction, you can set the NDValue attributes to ${param.parameterName}. Make sure that you include an invokeAction in the executables section of your pageDef to make it execute the action when it renders the page.

  • What is the use of passing object reference to itself ?

    What is the use of passing object reference to itself ?
    regards,
    namanc

    There is an use for returning an object reference from itself, for instance:
    class C {
    public:
         C append(C c) {
             // do something interesting here, and then:
             return this;
    }You can "chain" calls, like this:
    C c = new C();
    C d = new C();
    C e = new C();
    c.append (d).append (e);Maybe the OP has "inverted" the common usage, or thought about a static method of a class C that requires a parameter of type C (effectively being a sort of "non-static method").
    class C {
        static void doAnotherThing (C c) {
            c.doSomething(); //-- effectively C.doAnotherThing(c) is an "alternative syntax" for c.doSomething()

  • Can a Servlet be used for Storing Objects with both JSP and JSF used on it?

    Hi,
    Pages I have:
    SearchEmployee.jsp
    This page has a search engine that search out the Employee. This Employee Object will be stored inside a Servlet(controller) for future references by other pages. I used JSP, html tags for forms, and request.getParameter() to built this search engine.
    Problem:
    I have a JSF Form that wants to DISPLAY the employee which I have found in my Search Engine. How can I get the JSF's value="#{Controller.employeeObj.name}" to get the value from the object?
    This seems logical as my JSF form is just retrieving the stored object in the Controller. I currently cant seem to output it

    The servlet shouldn't be used to store ANY data, let alone data to be accessed by other sevlets. Put the object into the Session object.

  • Problem when using WEB.SHOW_DOCUMENT and passing in lexical parameter

    Hi,
    I got a blank page with error "An error has occured while trying to use this document" when I tried to use web.show_document and passing a lexical parameter to 10g report on 10gAS. The URL in the web.show_document is:
    http://<srvname>:<portnum>/reports/rwservlet?server=repserver90&report=myrpt.rdf&destype=Cache&desformat=pdf&userid=<usr>/<pw>@<db>&where_clause=where%20product_type%20in%20('REPORT')
    If I change the desformat to htmlcss, it is fine to display the report. But doesn't work with desformat=pdf. The pdf file has been generated in the cache. Why can't it display on the screen.
    Also I tried to use double quote the value for where_clause. The pdf report showed up. But it ignored the where clause.
    Experts please help.
    Ying

    I use lexical parameters and they work fine, but I use a parameter list. The code is contained in a form that is called by all forms that wish to run a report. This way you only need the logic for printing in a single form. If you want the form, email me at [email protected]

  • Pass tablespace(s) as a parameter to RMAN using batch file (windows2000)

    I want to make a backup of one or more than one tablespaces.
    For Example:
    Backup tablespace USERS,TOOLS;
    Backup tablespace USERS;
    In this regards I am using windows batch file. Below you find the code of batch file which I am using to perform this operation (windows 2000)
    Batch file (c:\rman.cmd)
    set tbs1=%1
    set tbs2=,%2
    if exist tbs1 == goto usage
    if exist tbs2 == goto usage
    echo BACKUP tablespace %tbs1% %tbs2% ; > c:\temp\tbs.rman
    rman TARGET / @ c:\temp\tbs.rman
    Problem
    I run this batch file on command line .
    When I issue this command its ok and backed up both the tablespaces.
    Host @c:\rman.cmd USERS,TOOLS
    But when I want to backup only one tablespace and issue the command like that:
    Host @c:\rman.cmd USERS
    It gave the following error
    BACKUP tablespace users , ;
    Found comma after first tablespace.
    Point of focus
    How to get rid of the comma after first tablespace on run time, when I want to backup only one tablespace.
    BACKUP tablespace users , ;
    How to avoid that comma on run time when I only want to make a backup of single tablespace.
    Please check this matter it is only the batch file side problem.
    With Best Regards
    Fawad Ahmed

    I am not expert is DOS but I think you can fix this with
    a simple programming logic elements in the script.
    You have 2 cases:
    1 case ) When you have only one parameter
    2 case ) When you have more or equal than two parameters
    if exist tbs1 == goto mark1
    if exist tbs2 == goto mark2
    mark2:
    echo BACKUP tablespace %tbs1% %tbs2% ; > c:\temp\tbs.rman
    goto end
    mark1:
    echo BACKUP tablespace %tbs1% ; > c:\temp\tbs.rman
    goto end
    end:
    rman TARGET / @ c:\temp\tbs.rman
    This can be one the case for 1 or 2 parameters . If
    you think to pass more parameters you have to use
    another logic.
    I hope this can help you!
    Joel P�rez

  • From scorecard Pass parameter to be used as Measure in query of analytic Grid report in PPS in SP2013

    From scorecard Pass parameter  to be used as Measure in query of analytic grid report in PPS
    Any idea of how we can pass this parameter while connecting scorecard and report
    any use of MDX in connection formula ?
    Parameter needs to be assigned on click of scorecard cell

    Hi,
    That API has restrictions on its usage. Please see http://docs.oracle.com/cd/E23903_01/doc/doc.41/e21676/apex_util.htm#CHDICGDA
    The lines to be referred to are Also, this method requires that the parameters that describe the BLOB to be listed as the format of a valid item within the application. That item is then referenced by the function.Regards,
    PS: Your report must be on Page 98 , so it is able to reference the item P98_NAV_IMAGE. List being a Shared Component it may not be able reference that Item.
    Edited by: Prabodh on May 28, 2012 3:16 PM

  • How to pass SQL command parameter using OpenDocument

    Hi !
    I have a dynamic List of values configured in Business View manager, used across multiple reports.
    The data source for this LOV is a SQL Command which accepts a static parameter named stringParam. I need to pass this static parameter in the URL using OpenDocument command. How can I do this?
    I tried
    http://bobjdev/businessobjects/enterprise115/InfoView/scripts/opendocument.aspx?spath=[ReportFolder]&sDocName=WebReport.rpt&stype=rpt&lsSstringParam=ABC
    but it still prompts me to select the parameter. I need to avoid this prompt.
    Any help, please.

    Hi,
    I would recommend to take a look at the documentation in order to identify the correct syntax for your URL
    [http://help.sap.com/businessobject/product_guides/boexir31/en/xi3-1_url_reporting_opendocument_en.pdf]
    Regards,
    Shweta

Maybe you are looking for

  • Error while posting the transaction in F-02

    Dear Friends, Kindly give me acceptable solution to the below error/ticket while user posting a transaction in F-02. ERROR: " system error in routine FI_TAX_CHK_PRICING_DATA_ error code 13 function builder TAX2"

  • My g3 using mac os 8.6 is completely locked out HELPPPPPPP

    i'm using mac os 8.6, when i start up the machine, the start up screen goes to a normal start up screen but theres a little lock that shows up in the bottom left hand corner, and it locks, and the screen goes blank... then it goes to another startup

  • Mac Pro 5,1 mid 2010 motherboard memory module pins damaged

    Hi everyone, This morning, after another computer crash I've decided to get rid of the dust inside of the tower. When I put back the bottom, memory bodule I've noticed that it wasn't going in very smoothly - to realise that I've damanged some pins co

  • No fullscreen? Seriously???

    Is there any feature more standard on any software intended to display anything? Is there any activity less in need of a GUI than reading a book? This software is sorely lacking in options to make PDFs adaptable to the wide variety of displays likely

  • Mac and Microsoft Office 07

    I'm taking a computer class in college that requires Microsoft Office 2007. I would like to install it on my Mac, but I can't figure out how to do so. When I put the DVD rom in, it doesn't prompt me to install it. Thanks for the help