How to access an object in a bean

I am looking for a way to access an object in a bean and make available to the page.
for example if i have a Bean called User and it contains an attribute Called Company as an attribute in User. Now I have User.getCompany(). and I can do this
<%User user = request.getUser();
Company company = user.getCompany();
request.setAttribute("comp", company); %>
how do I do this with useBean ?

I am looking for a way to access an object in a bean
and make available to the page.
for example if i have a Bean called User and it
contains an attribute Called Company as an attribute
in User. Now I have User.getCompany(). and I can do
this
<%User user = request.getUser();
Company company = user.getCompany();
request.setAttribute("comp", company); %>
how do I do this with useBean ?You can access a JavaBean Object property of another JavaBean inside the JSP with the use of EL (Expression Language)
So if you are using JSP 2.0 or higher try this:
<jsp:useBean id="user" class="your.package.User" scope="request"/>
${user.company.id}I tested the above and it works.
Note that you need to set the Company object in the User object before trying to access it inside the JSP.
You can also set it in the JSP if you want, (before trying to access it), but its cleaner to do it in a Servlet.
Both User and Company must follow JavaBeans notation.
So in the above case the User object is something like this:
package your.package;
public class User{
   private Customer customer;
   public User(){}
   public Customer getCustomer(){
      return customer;
   public void setCustomer(Customer customer){
     this.customer = customer;
}And your Customer JavaBean is something like this:
package your.package;
public class Customer{
   private int id;
   public Customer(){}
   public int getId(){
     return this.id;
   public void setId(int id){
     this.id = id;
}

Similar Messages

  • How to access Business Objects Explorer?

    I am new to Business Objects and would like to know how to access Business Objects Explorer from my local system. I have Business Objects XI 3.1 installed on my system.
    I would like to know if BO explorer requires a separate installation package? If yes, how can I acquire it?
    If No, what are the steps to integrate the BO Server with the BO explorer?
    Edited by: Bhavani I on Jan 28, 2010 11:23 AM

    Hi,
      You can refer to the below link for more details on BO EXplorer,
    https://cw.sdn.sap.com/cw/servlet/JiveServlet/previewBody/119973-102-1-220562/BO%20Explorer%20Implementation%20checklist.pdf
    Regards,
    Balajee
    Edited by: Balajee Sivakumar on Apr 27, 2011 6:30 PM

  • ListCellFactory - how to access an object's data associated with list cell?

    I am new to javafx and building a sample app to learn the basics. The app has a list view control and used listcellfactory to create listcells. Each list cell is composed of few labels and image. I populated list view with listViewItems function, where in it sends object[]; I have my own object with data that needs to be populated in the list cell. I have hard coded the object[] and that size is reflected in list view items size. However, I am not able to populate the object data in individual labels.
    In the following code, I can only get the string representation of the object and I am unable to figure out how to individually access the object's data. Please help me with this.
    function listCellFactory(): javafx.scene.control.ListCell {
    var listCell: javafx.scene.control.ListCell;
    def offerLbl: javafx.scene.control.Label = javafx.scene.control.Label {
    text: bind "{listCell.item}"
    def descriptionLbl: javafx.scene.control.Label = javafx.scene.control.Label {
    text: bind "{listCell.item}"
    def friendLbl: javafx.scene.control.Label = javafx.scene.control.Label {
    text: bind "{listCell.item}"
    def offerImgView: javafx.scene.image.ImageView = javafx.scene.image.ImageView {
    image: imagetrial
    fitWidth: 300.0
    fitHeight: 250.0
    def offerVerticalBox: javafx.scene.layout.VBox = javafx.scene.layout.VBox {
    content: [ offerLbl, descriptionLbl, friendLbl, offerImgView, ]
    spacing: 6.0
    listCell = javafx.scene.control.ListCell {
    node: offerVerticalBox
    return listCell
    }

    If I understand you question, it should be (listCell.data as YourClassName)
    Edited by: AigarsP on Oct 21, 2010 2:10 PM

  • How to access last object in a Collection.

    Hello. I'm trying to figure out how to access the last element in a collection. This is how I have it coded now:
    Collection coll = someMethodThatReturnsACollectionOfMyTypes( );
    Iterator It = coll.iterator( );
    MyType myType = null;
    while ( It.hasNext( ) )
    myType = ( MyType) It.next( );
    At this point myType should reference the object I'm interested in, but there has to be an easier way. Any suggestions would be greatly appreciated.
    -Jason

    Containers either are or aren't expected to support random access, depending on the container. For those containers that do support it, like ArrayList, you can do the following:
    public Object getLast(AbstractList a) {
      if (0==a.size()) return null;
      return a.get(a.size()-1);
    }

  • How to access Captivate Objects From Widget

    Using the widget factory, is there a way to access a specific property such as a button or textbox in a captivate movie from an widget?
    The button in captviate does have an instance name called button_mc. In my widget, I do have
    myRoot = MovieClip(root);
    mainMov = MovieClip(myRoot.parent.root);
    Also, how can you get the slide properties such as total frames?
    Can't seem to find out how or I am just missing something
    Thanks

    Hi Ukie,
    Here's an article on how to access objects on the Captivate slide with WidgetFactory: http://www.infosemantics.com.au/widgetking/2010/10/slip-sliding-away/
    In short, pass in the instance name of the button into the getSlideObjectByName() method:
    var myButton:Sprite = getSlideObjectByName("button_mc");
    Also, WidgetFactory has a property widgetSlide wich gives you access to the slide that the Captivate Author placed the widget on. This is a MovieClip, so if you wanted to read its total frames, you'd write:
    widgetSlide.totalFrames;
    Hope that answers your questions.

  • How to access COM+ Objects From JSP

    Friends,
    We have a requirement to access COM+ objects from JSP. Please guide me on this.
    Thanks in advance.
    Tarani

    Sanyam wrote:
    if there is any .dll extension file, how can we read that file in labview?
    You can use Call Library Function node to call that dll file and use it in LabVIEW. Read the help and you will get more details.

  • How to access Business object type attribute from a method/function modul ?

    Hello,
    i have created a business object type object along with attributes and methods. Now inside the method i want to access the attributes. inside the method i am writing:
    data a type XXX.
    a = me->attribute
    this is creating a compilation error.
    Now the method is defined as a function module in some package, so can anyone inform me how to access object attributes from the function module ?
    pointes are awarded
    Regards

    Hello,
    thanks for your answer, but this too did not work, "=>" is for static attributes and the attributes i have are not static. Moreover, i tried it but it gave the same error :
    the abap error was when i was checking the code is :
    the type me=>documenttype is unknown
    as you know in SWO1 i created an object and when i create a method you link it to a function module and this is where you have the implementation of the method, so from this method how can i access the attributes on the main object that i created in SWO1
    regards

  • How to access an object's variable from native code

    i am passing an object in a native method.i have to change the value of the object's variable.how do i access the variable of object and assign it new value from c++ code.when i try to access it i get a message that the variable must have a class/sruct/union type.
    pl. help.

    I'll tell You if You send me the structure of this object in Java. And a name of field what are You thinking about.
    Maciek

  • How to link 2 objects and how to access entities objects

    Hi,
    I have 2 tables "Person" and "Adress". Person has a foreign key to Adress. The tables have a primary key (person_id and adress_id) associated with a sequence table. I use entites objects from tables and i defined a creation form for "Person" and a creation form for "Adress".
    While the commit, i would like to link person with adress via the foreign key. So i don't know how to obtain "adress_id" from the entity object for setting the foreign key in the object "person".
    More, how can i access to the entites objects for accessing information via getter methods.
    Thank for your help.

    Hi,
    documented in http://download-uk.oracle.com/docs/html/B25947_01/toc.htm it is explained in http://download-uk.oracle.com/docs/html/B25947_01/bcentities008.htm#sthref464
    Exactly the same question got answered yesterday: Re: How I can acess to master entity object from detail entity object
    Frank

  • How to access View object programmatically and ...

    Hi,
    I have a hypothetical situation. I have for example a VO based on Emp and a data table in the UI with a button.
    When pressing this button I want to call a method that will programmatically read in teh values of the current row and then update a field in the UI (say an outputText).
    My problem is I am not sure where to pu this logic. I thought I shouldI create a new method in the Application module then bind that methid to the button. By having the code in the AM then it can easily access the VO attributes. But how can the method in the AM access the values in my backing bean and set them or read them ?
    I am not sure where to put the code - I could put it in teh backing bean and call teh application module from there but the manual doesn't really recommend that I think.

    This is probably logic that should be in the backing bean in a method that is activated from your button.
    The ADF Developer Guide shows you how to do it here:
    http://download.oracle.com/docs/html/B25947_01/bcservices005.htm#sthref681

  • How to access ServletContext object of a webapp on remote server?

    Hi!
    I have a webapp, runs on tomcat, loads information from local db server, keeps them in servlet context, and publish these datas to web via jsp pages.
    I make run the same webapp on different location, different webserver and db server with different datas.
    Is it possible to link both ServletContext to each other, or access one from the another?
    What is the right solution, if I want to access all stored Objects of these independent webapplications, summarize and show them in one browser page, in one jsp?
    sorry for my poor english
    and thanks for any help,
    kind regards,
    henpanta

    It is not possible to access another servletcontext glueless using HTTP or any transfer protocol. Would be a potential security hole too. If you want to let communicate 2 webapps on different servers with each other, consider webservices.

  • How to access custom object as property in yField

    Hi All,
    I have a stacked column chart. The data provider (dp) has an
    array of object DataObject which has array of custom objects of
    class ClientRev:
    public function ClientRev(name: String, rev : Number)
    cName = name;
    cRev = rev;
    // data provider
    public class DataObject
    public var clientRev : Array;
    Now I have to use cRev property of clientRev elements of
    DataObject (DataObjects makes data provider) in yField of
    ColumnSeries.
    if i write,
    yField="{clientRev[0].cRev}",
    It doesn't work. Please lemme know how can I achieve my goal.
    Thanks for help.

    "vaibhav.chauhan" <[email protected]> wrote
    in message
    news:gdmhok$2eq$[email protected]..
    > Hi All,
    > I have a stacked column chart. The data provider (dp)
    has an array of
    > object
    > DataObject which has array of custom objects of class
    ClientRev:
    > public function ClientRev(name: String, rev : Number)
    > {
    > cName = name;
    > cRev = rev;
    > }
    >
    > // data provider
    > public class DataObject
    > {
    > public var clientRev : Array;
    > }
    >
    > Now I have to use cRev property of clientRev elements of
    DataObject
    > (DataObjects makes data provider) in yField of
    ColumnSeries.
    >
    > if i write,
    > yField="{clientRev[0].cRev}",
    >
    > It doesn't work. Please lemme know how can I achieve my
    goal.
    Use a dataFunction

  • How to access servlet objects from OA page controller class

    Hi everybody!
    I need to put some value into servlet attribute in OA page controller class to read it from ordinary servlet later.
    How can i do it? Is it possible to get HttpServletRequest and HttpServletResponse objects from page controller?
    Thank you.

    I have a servlet which receives uploaded files with special attributes (something like tags for file) using POST request.
    This attributes created when user open page in standard OAF page via page controller.
    On client side I have an applet which uploads user selected file to my servlet and passes this file attributes.
    Now this attributes passes as plain text. I want to encrypt this attributes to hide attribute details from user. To do this I need to share some information between OAF page and my servlet.
    I know that OAF supports URL encryption, but to decrypt it I should use standard pageContext object.
    But in ordinary servlet I can't use it.

  • How to access form objects from different class?

    Hello, I am new to java and i started with netbeans 6 beta,
    when i create java form application from template i get 2 classes one ends with APP and one with VIEW,
    i put for example jTextField1 with the form designer to the form and i can manipulate it's contents easily from within it's class (let's say it is MyAppView).
    Question>
    How can i access jTextField1 value from different class that i created in the same project?
    please help. and sorry for such newbie question.
    Thanks Mike

    hmm now it says
    non static variable jTree1 can not be referenced from static context
    My code in ClasWithFormObjects is
    public static void setTreeModel (DefaultMutableTreeNode treemodel){
    jTree1.setModel(new DefaultTreeModel(treemodel));
    and in Class2 it is
    ClasWithFormObjects.setTreeModel(model);

  • How to access HttpRequest Object from Axis web service?

    Hi all,
    I have Axis web service named shoppingcartService,
    and i have ShoppingCartImpl as implemention class which
    implements passfamily() method
    When client access my web service, ShoppingCartImpl's passFamily method is executed.
    I have one more servlet under my axis web application which implements business logic.
    problem is that i want to call/invoke this servlet from passfamily method of ShopingCartImpl class.
    So how can i call/invoke servlet from passFamily method of ShoppingCartImpl class ?
    (All stuff is under Axis web application under Tomcat).

    hi
    the following link may helpful to you
    http://e-docs.bea.com/wls/docs81/webserv/anttasks.html#1111537
    Regards
    Prasanna Yalam

Maybe you are looking for

  • Error while copying files to Zen Visio

    Hello everyone, I just bought the zen vision m a couple days ago. Since the first connection w/ the PC I've had problems because windows would not recognize the player. By now I downloaded a fixup file so that that is working pretty well. But now my

  • How to control a WHERE CLAUSE

    I am converting our BO Universe to OBIEE. There exist in the Universe an object which select COUNT(DISTINCT inventory_item_id) and has a WHERE CLAUSE that gives a date range. Going to OBIEE, how can I apply this WHERE CLAUSE to the object only? I can

  • Printing of sap script

    Hi frnds, i want to print 1 tp 100 in sapscript in a single page in a vertical manner 1 6 2 7 3 8 how will i do it                                          regards,                                           karthik

  • Saving an updated numbers spreadsheet to icloud

    Hi Everybody! I'm trying to learn how to use the icloud and numbers to seamlessly move between i-devices. I use Numbers a lot on my ipad, and have installed it on my desktop as well.  I would like it if I could create a spreadsheet on my ipad and the

  • Sales Contract Base Price with Vailidity Period

    Hi all, My client business process is there creating Sales Contracts base on validity period pricing Sales Contracts are created for long periods.The base price changes every year / for defined period. For Example: Contract created for 10 years. Firs