Passing an object into a tag

Hello
I have a tag file called foo.tag
<%@tag description="some tag" pageEncoding="UTF-8"%>
<%@tag import="java.util.*"%>
<%@attribute name="list" type="java.util.List" required="true"%>
<h4>I am a list</h4>
<p>Class: <%=list.getClass()%></p>And in my index.jsp I do:
<%@ taglib prefix="jc" tagdir="/WEB-INF/tags" %>
<%
      List bar = new ArrayList();
      bar.add("test");
%>
<jc:foo list="<%=bar%>"/>..in order to pass the reference of bar in my tag. That works, but I know that it's "bad" practice to have <%= %> inside your JSPs. How could I improve the parameter passing? If I say <jc:foo list="bar"/> then I only get a "bar" String on the tag file.
thanks

Thanks for your reply.
But is there a better way of doing this? Yeah, there is a slightly better way if you are using JSP 2.0 (properly configured). Then you can do:
<% List bar = new ArrayList();
   bar.add("foo");
   request.setAttribute("bar", bar);
%>
<jc:foo list="${bar}"/>
    public void setList(List theList) { ... }
Can't I just
feed the object into the tag as an object?Not directly. The List you create in the scriptlet has a limited scope, just inside the _jspService method.  This scope isn't really available to things like tags and EL, so you have to put it in a scope where it can be found - something like the request, or page scopes.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Similar Messages

  • How to pass src value into img tag in ADF

    Hi,
    My Dev : 11.1.2.3.0
    How to pass row values into <img> tag.,I used the below code but it's taking empty.,
    I tried both ways like #{row.CdFilePath}   and   ${row.CdFilePath}
    <af:iterator var="row"
                      value="#{bindings.xxx.collectionModel}"
                     id="i2">
         <img src='/ShowImage?src=#{row.CdFilePath}' border='0' style="width:100px; height:100px; margin:5px;"/>
    </af:iterator>
    Please tell me any other option is there..
    Thanks

    This works if you use a normal table so I guess it should work here too.
    Are you sure the el #{row.CdFilePath} return something?
    Why don't you use the adf image tag <af:image source="/ShowImage?src=#{row.CdFilePath}".../> instead of the html img tag?
    Should the src property not be enclosed with " instead of your '?
    Timo

  • How do u pass an object into a method

    I want to create a method getData that takes an object of type Helper and returns an object of the same type.
    how do u pass objects into a method and how do u get objects as returns im a bit confused

    That will just allow you to pass a parameter. If you want to return a helper object
    Helper paramHelper = new Helper();
    Helper someHelper = callMethod(paramHelper);
    public Helper callMethod(Helper hobj) {
        //<some code>
        Helper retHelper = new Helper();
        //<blah, blah>
        return retHelper;

  • Passing Complex Object into Grid Component

    OK here is what i am trying to do.
    I have a grid component, and I wanted to display on the grid,
    a list of ship objects. Think of this like a cruise liner.
    I am retrieving these objects from a java/hybernate/spring
    adapter using remote object, and it works ok. I get back an
    arrayCollection, then I build a new array, populatate it with
    Actionscript ship objects, which has an embedded port object.
    Ship has attributes like Name, id, comments etc. And it has
    an embedded homeport object also.
    The port, has name, country and comments too.
    I can get the object to come back, and its being built
    correctly. I have ship objects and each one has its own port
    object, I see in the debugger the objects and thier embedded
    objects and the embedded object values. So I know the constructor
    is working fine. Here is the problem.
    I set the dataprovider attribute to match the array of
    completed ships, and I can get the grid, to display all the ship
    data, but not the port data.
    So Here is my code:
    <mx:DataGrid id="ShipListDataGrid" width="978"
    height="190" dataProvider="{initDG}"
    creationComplete="loadAllShips()" selectedIndex="0" >
    <mx:columns>
    <mx:DataGridColumn headerText="Name"
    dataField="name"/>
    <mx:DataGridColumn headerText="Class"
    dataField="clazz"/>
    <mx:DataGridColumn headerText="Comments"
    dataField="comments"/>
    <mx:DataGridColumn headerText="Port Country"
    dataField="port.country" />
    </mx:columns>
    </mx:DataGrid>
    Now the colums name, clazz, comments all work perfectly, as
    they are attributes of ship. However, port.country does not work,
    it just shows a blank column, even though that is the correct
    notation to get to that data field, for the attribute of that ships
    port home country. Its just a string, so for the port called miami,
    the country is "USA". This does not display.
    However if I remove port.country, and only put in port, then
    it shows that whats in that column displays as Object : Port.
    So it seems that the grid knows theres an object in there.
    But not what to do with it?
    I have created a masterViewList and a masterDetails
    component, and the viewList is the grid, and the details is the
    details section of the ship. So there it shows a form, and the form
    shows all the details of the ship selected in the list above. Heres
    the interesting thing. using a label field, I can change the
    selected list item on the grid, and show the ship.port.country in a
    label on the bottom, so it can transverse the ship object, but just
    not seemingly in the grid.
    What can I do? Why does it work with a label field, and not
    in the grid? Why will the grid not show an embedded string
    attribute for an embedded object, but a label or text box will?
    What am I doing wrong?

    You will need to use a label function for this.
    For example:
    <mx:DataGridColumn headerText="Port Country"
    dataField="{calcPortCountry}" />
    private function calcPortCountry(item:Object,
    col:DataGridColumn):String
    return item.port.country;

  • Passing user info into precompiled flex2 .swf

    Hello all,
    Using flex builder to precompile my .swf how do I then pass
    client info to the SWF when a user accesses it? I have information
    like profile_id and user_id that need to accompany all of my remote
    calls, so how do I get them loaded into the swf if it is
    precompiled? We are running CF 7.02. I thought maybe URLLoader to
    hit a .cfm page, but I am wondering if the request would carry any
    header info...no header means I could not identify who made the
    request and then I am back where I started.
    Thanks for any Help.
    -Mark

    Thanks inlineblue. that is exactly what i was looking for.
    Although now am curious if there is any way to pass an object into
    the swf. My guess is no...not on the init, but if anyone knows how
    to, that would be great.
    I know how to pass objects through remoting, just not on the
    init. I could loop over the struct (it is really a named array) and
    create name value pairs, but I was hoping to avoid that.

  • Pass JTextArea objects

    All,
    I have a tabbed pane application, in one of the tabs I have a logging JTextArea that I would like to be able to externalize through a non-modal JDialog. However, when I pass the object into the JDialog, the object goes grey in my JTabbedPane. Is there anyway to create a copy of the JTextArea and push logging results to both the JDialog and JTabbedPane at the same time or do I have to maintain two different JTextAreas for this type of application?
    Thanks.

    Swing components can only be added to a single container. However you can share the model:
    JTextArea textArea1 = new JTextArea();
    JTextArea textArea2 = new JtextArea();
    textArea2.setDocument( textArea1.getDocument() );

  • How to pass a locale object into another function?

    Greetings,
    i like to pass a locale object into another function. These are my code below
    import java.util.*;
    public class Locales{
         public static void main(String[] args){
              Locale locale= new Locale("EN", "US");
              convert(locale);
    public void convert(Locale convert)
         String language = convert.getDisplayLanguage();
         System.out.println(language);          
    }I got this error:
    Locales.java:6: non-static method convert(java.util.Locale) cannot be referenced from a static content
                    convert(locale);
                    ^How do i correct it?
    Thanks

    Did you bother to do a search?
    Did you bother to read any of the material that the search would have linked you to?
    If you had then you would be able to understand where you are going wrong and how to fix it yourself. Instead of being spoonfed by us.

  • Passing objects into a class constructor

    I've created a frame for inputting a patient's medical results. There are lots of buttons for temperature, blood pressure, etc. I've created a separate, inner class that creates a NumberPad frame to enter the patient's results. Press the "Temp." button, for example, a NumberPad appears, you enter the temperature, press the "Enter" button on the NumberPad and the number appears in a Label next to the "Temp." button.
    The problem is that I've written the constructor of the NumberPad with a label parameter so that the right label gets updated. e.g.
    class NumberPad extends Frame implements ActionListener
    public NumberPad(Label aLabel)
    However, because I've implemented ActionListener, I've had to override the actionPerformed method and I don't know how to pass the aLabel object that I give to the NumberPad constructor into the actionPerformed method so that, for example
    public actionPerformed(ActionEvent evt)
    String s = evt.getActionCommand
    if (s.equals("ENTER")
    aLabel.setText(display of numberpad);
    How do I transfer the aLabel object into the actionPerformed method so that the correct label gets updated?

    Store the label as an instance variable.
    class NumberPad extends Frame implements ActionListener {
        private Label aLabel;
        public NumberPad(Label aLabel) {
            this.aLabel = aLabel;
        public actionPerformed(ActionEvent evt) {
            String s = evt.getActionCommand;
            if (s.equals("ENTER") {
                aLabel.setText(display of numberpad);
    }[/code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to pass any type of objects into Portal's rules engine?

    Is that possible to pass any type of objects into Portal's rules engine? Or BEA's Portal service rules engine can only allow to pass a limited number of objects?
    Are there any information about BEA's rules engine? and Can we use its rules engine without using its Portal service?
    Thank you.

    I worked on BEA rules engine 4 months back. I'm sure you can pass any JAVA object to it's working meomory. I am giving my sample rules here, hope it will be helpful for you.
    I just replace pcakage name, other than that everything is from wroking project. Open in xml spy, it should be clear from the desc. If you have any questions post back.
    <cr:rule-set is-complete="true" xmlns="http://www.bea.com/servers/p13n/xsd/expression/expressions/2.1.1" xmlns:cr="http://www.bea.com/servers/p13n/xsd/rules/core/2.1.1" xmlns:literal="http://www.bea.com/servers/p13n/xsd/expression/literal/1.0.1" xmlns:string="http://www.bea.com/servers/p13n/xsd/expression/string/1.0.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/p13n/xsd/rules/core/2.1.1 rules-core-2_1_1.xsd">
         <cr:rule is-complete="true">
              <cr:name>TaxForm1040</cr:name>
              <cr:description>If salary is 70,000 then this rule makes 1040 as required form</cr:description>
              <cr:conditions>
                   <multi-and>
                        <multi-and>
                             <equal-to>
    <instance-method>
    <variable>
    <name>SalaryField</name>
    <type-alias>com.blah.field.REInputObject</type-alias>
    </variable>
    <name>getKey</name>
    </instance-method>
    <literal:string>Salary</literal:string>
    </equal-to>
    <equal-to>
    <instance-method>
    <variable>
    <name>SalaryField</name>
    <type-alias>com.blah.field.REInputObject</type-alias>
    </variable>
    <name>getValue</name>
    </instance-method>
    <literal:integer>70000</literal:integer>
    </equal-to>
                        </multi-and>
                   </multi-and>
              </cr:conditions>
              <cr:actions>
                   <new-instance>
                        <type-alias>com.blah.field.RequiredField</type-alias>
                        <arguments>
                             <literal:string>1040</literal:string>
                        </arguments>
                   </new-instance>
              </cr:actions>
         </cr:rule>
    </cr:rule-set>

  • Passing object into form

    I have a workflow where I check out a configuration object and I need to pass it to a form for updating, then check it back in at the workflow level. Does anyone have a snippet of code where they have successfully passed the object to the form and back again? I know I'm getting the components of the object correctly, it's just not passing up to the form.
    Thanks in advance for any help.
    -T-

    Now I'm getting " com.waveset.util.WavesetException: Suspended case with no WorkItems!"
    Here is the workflow minus start and end: (Remember, the object displays fine on the form)
    <Activity id='1' name='Checkout Object'>
    <Action id='0' application='com.waveset.session.WorkflowServices'>
    <Argument name='op' value='checkoutObject'/>
    <Argument name='type' value='Configuration'/>
    <Argument name='name' value='ADServerLookupTable'/>
    <Argument name='authorized' value='true'/>
    <Variable name='object'/>
    <Return from='object' to='ADobject'/>
    </Action>
    <Transition to='Show Form'/>
    <WorkflowEditor x='215' y='59'/>
    </Activity>
    <Activity id='2' name='Show Form'>
    <Action id='0' name='Clear Form Button'>
    <expression>
    <set name='formButton'>
    <null/>
    </set>
    </expression>
    </Action>
    <ManualAction id='1' name='Show ADconfigMgmt Form' syncExec='true'>
    <Owner name='$(WF_CASE_OWNER)'/>
    <FormRef>
    <ObjectRef type='UserForm' id='#ID#UserForm:ADconfigMgmt' name=' UserForm AD Configuration Mgmt'/>
    </FormRef>
    <Return from='ADobject' to='ADobject'/>
    <ExposedVariables>
    <List>
    <String>ADobject</String>
    </List>
    </ExposedVariables>
    <EditableVariables>
    <List>
    <String>ADobject</String>
    </List>
    </EditableVariables>
    </ManualAction>
    <Transition to='Checkin Object'>
    <eq>
    <ref>formButton</ref>
    <s>Save</s>
    </eq>
    </Transition>
    <Transition to='Unlock Object'>
    <eq>
    <ref>formButton</ref>
    <s>Cancel</s>
    </eq>
    </Transition>
    <Transition to='Unlock Object'>
    <ref>WF_ACTION_TIMEOUT</ref>
    </Transition>
    <WorkflowEditor x='301' y='59'/>
    </Activity>
    <Activity id='3' name='Checkin Object'>
    <Action id='0' application='com.waveset.session.WorkflowServices'>
    <Argument name='op' value='checkinObject'/>
    <Argument name='object' value='$(ADobject)'/>
    <Argument name='authorized' value='true'/>
    </Action>
    <Transition to='end'/>
    <WorkflowEditor x='59' y='10'/>
    </Activity>
    <Activity id='4' name='Unlock Object'>
    <Action id='0' application='com.waveset.session.WorkflowServices'>
    <Argument name='op' value='unlockObject'/>
    <Argument name='object' value='$(ADobject)'/>
    <Argument name='authorized' value='true'/>
    </Action>
    <Transition to='end'/>
    </Activity>
    Edited by: TD_ROC on May 6, 2008 12:03 PM

  • Passing Opaque Objects from Oracle to Java

    Hi all
    I am trying to write a stored procedure that needs to be called from different triggers. Each triggers needs to pass a different set of data to the stored procedure. Now the problem is that i need to pack the different set of data into one opaque object type that i can pass onto java. Is there any way of doing this. I am using Oracle 9i running on Linux 2.4.9. I tried using the Object datatype in Oracle 9i. But am not able to pass a object datatype to java directly.

    Didn't know that. Guess the way this API handles the struct is it puts it on the heap, since this idea (with passing a 32-bit var back and forth with a memory location) worked.
    My next problem - I can't figure out a way to destroy a jstring: whenever I do an env->GetStringUTF((char*)charBuff), it seems to simply copy the bytes from the buffer
    into the same String object up the length of the buff (so I get the extra bytes from the previous String if it was longer at the end).
    Here's how it works: I have a loop in C code that parses tags inside a file, then depending on what tag it is, I create a new jobject and call a Java method to do stuff
    to that object. As one of the parameters in the constructor I pass in a String that I create (as you can see above) from a character array, however I am getting
    massive artifacts when I print out that String inside the Java method.
    Thoughts? :(

  • Is it possible to pass dynamic values to custom tag?

    Hi there, I'm trying to build a calendar custom tag so I can drop the calendar into an existing webpage easily.
    I have got the calendar displaying on the page but the problem I have is when I try to create 'previous' and 'next' links. Is it possible to pass parameters to a custom tag that have dynamic values?
    In PHP it would looks something like:
    <a href="bla.php?page=$pagenumber">next page</a>When I create the calendar object I set it to the current date so when I try to increase or decrease the month (next/prev month) it doesn't work because the code is run again and hence setting the current date again.
    Any ideas?
    Cheers in advance
    Message was edited by:
    MajorMahem

    for eg
    <a href=" Display.jsp?id='+<%=customerId%>">Result Page</a>
    Please try this,
    i didn't work out, any how apply this sample to your code

  • How can I insert values from table object into a regular table

    I have a table named "ITEM", an object "T_ITEM_OBJ", a table object "ITEM_TBL" and a stored procedure as below.
    CREATE TABLE ITEM
    ITEMID VARCHAR2(10) NOT NULL,
    PRODUCTID VARCHAR2(10) NOT NULL,
    LISTPRICE NUMBER(10,2),
    UNITCOST NUMBER(10,2),
    SUPPLIER INTEGER,
    STATUS VARCHAR2(2),
    ATTR1 VARCHAR2(80),
    ATTR2 VARCHAR2(80),
    ATTR3 VARCHAR2(80),
    ATTR4 VARCHAR2(80),
    ATTR5 VARCHAR2(80)
    TYPE T_ITEM_OBJ AS OBJECT
    ITEMID VARCHAR2(10),
    PRODUCTID VARCHAR2(10),
    LISTPRICE NUMBER(10,2),
    UNITCOST NUMBER(10,2),
    SUPPLIER INTEGER,
    STATUS VARCHAR2(2),
    ATTR1 VARCHAR2(80),
    ATTR2 VARCHAR2(80),
    ATTR3 VARCHAR2(80),
    ATTR4 VARCHAR2(80),
    ATTR5 VARCHAR2(80)
    TYPE ITEM_TBL AS TABLE OF T_ITEM_OBJ;
    PROCEDURE InsertItemByObj(p_item_tbl IN ITEM_TBL, p_Count OUT PLS_INTEGER);
    When I pass values from my java code through JDBC to this store procedure, how can I insert values from the "p_item_tbl" table object into ITEM table?
    In the stored procedure, I wrote the code as below but it doesn't work at all even I can see values if I use something like p_item_tbl(1).itemid. How can I fix the problem?
    INSERT INTO ITEM
    ITEMID,
    PRODUCTID,
    LISTPRICE,
    UNITCOST,
    STATUS,
    SUPPLIER,
    ATTR1
    ) SELECT ITEMID, PRODUCTID, LISTPRICE,
    UNITCOST, STATUS, SUPPLIER, ATTR1
    FROM TABLE( CAST(p_item_tbl AS ITEM_TBL) ) it
    WHERE it.ITEMID != NULL;
    COMMIT;
    Also, how can I count the number of objects in the table object p_item_tbl? and how can I use whole-loop or for-loop to retrieve values from the table object?
    Thanks.

    Sigh. I answered this in your other How can I convert table object into table record format?.
    Please do not open multiple threads. It just confuses people and makes the trreads hard to follow. Also, please remember we are not Oracle employees, we are all volunteers here. We answer questions if we can, when we can. There is no SLA so please be patient.
    Thank you for your future co-operation.
    Cheers, APC

  • Trying to pass and object variable to a method

    I have yet another question. I'm trying to display my output in succession using a next button. The button works and I get what I want using test results, however what I really want to do is pass it a variable instead of using a set number.
    I want to be able to pass the object variables myProduct, myOfficeSupplies, and maxNumber to method actionPerformed so they can be in-turn passed to the displayResults method which is called in the actionPerformed method. Since there is no direct call to actionPerformed because it is called within one of the built in methods, I can't tell it to receive and pass those variables. Is there a way to do it without having to pass them through the built-in methods?
    import javax.swing.JToolBar;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import java.net.URL;
    import java.awt.BorderLayout;
    import java.awt.Dimension;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    public class Panel extends JPanel implements ActionListener
         protected JTextArea myTextArea;
         protected String newline = "\n";
         static final private String FIRST = "first";
         static final private String PREVIOUS = "previous";
         static final private String NEXT = "next";
         public Panel( Product myProduct, OfficeSupplies myOfficeSupplies, int maxNumber )
                 super(new BorderLayout());
              int counter = 0;
                 //Create the toolbar.
                 JToolBar myToolBar = new JToolBar( "Still draggable" );
                 addButtons( myToolBar );
                 //Create the text area used for output.
                 myTextArea = new JTextArea( 450, 190 );
                 myTextArea.setEditable( false );
                 JScrollPane scrollPane = new JScrollPane( myTextArea );
                 //Lay out the main panel.
                 setPreferredSize(new Dimension( 450, 190 ));
                 add( myToolBar, BorderLayout.PAGE_START );
                 add( scrollPane, BorderLayout.CENTER );
              myTextArea.setText( packageData( myProduct, myOfficeSupplies, counter ) );
              setCounter( counter );
         } // End Constructor
         protected void addButtons( JToolBar myToolBar )
                 JButton myButton = null;
                 //first button
                 myButton = makeNavigationButton( FIRST, "Display first record", "First" );
                 myToolBar.add(myButton);
                 //second button
                 myButton = makeNavigationButton( PREVIOUS, "Display previous record", "Previous" );
                 myToolBar.add(myButton);
                 //third button
                 myButton = makeNavigationButton( NEXT, "Display next record", "Next" );
                 myToolBar.add(myButton);
         } //End method addButtons
         protected JButton makeNavigationButton( String actionCommand, String toolTipText, String altText )
                 //Create and initialize the button.
                 JButton myButton = new JButton();
                     myButton.setActionCommand( actionCommand );
                 myButton.setToolTipText( toolTipText );
                 myButton.addActionListener( this );
                   myButton.setText( altText );
                 return myButton;
         } // End makeNavigationButton method
             public void actionPerformed( ActionEvent e )
                 String cmd = e.getActionCommand();
                 // Handle each button.
              if (FIRST.equals(cmd))
              { // first button clicked
                          int counter = 0;
                   setCounter( counter );
                 else if (PREVIOUS.equals(cmd))
              { // second button clicked
                   counter = getCounter();
                      if ( counter == 0 )
                        counter = 5;  // 5 would be replaced with variable maxNumber
                        setCounter( counter );
                   else
                        counter = getCounter() - 1;
                        setCounter( counter );
              else if (NEXT.equals(cmd))
              { // third button clicked
                   counter = getCounter();
                   if ( counter == 5 )  // 5 would be replaced with variable maxNumber
                        counter = 0;
                        setCounter( counter );
                      else
                        counter = getCounter() + 1;
                        setCounter( counter );
                 displayResult( counter );
         } // End method actionPerformed
         private int counter;
         public void setCounter( int number ) // Declare setCounter method
              counter = number; // stores the counter
         } // End setCounter method
         public int getCounter()  // Declares getCounter method
              return counter;
         } // End method getCounter
         protected void displayResult( int counter )
              //Test statement
    //                 myTextArea.setText( String.format( "%d", counter ) );
              // How can I carry the myProduct and myOfficeSupplies variables into this method?
              myTextArea.setText( packageData( product, officeSupplies, counter ) );
                 myTextArea.setCaretPosition(myTextArea.getDocument().getLength());
             } // End method displayResult
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event dispatch thread.
         public void createAndShowGUI( Product myProduct, OfficeSupplies myOfficeSupplies, int maxNumber )
                 //Create and set up the window.
                 JFrame frame = new JFrame("Products");
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                 //Add content to the window.
                 frame.add(new Panel( myProduct, myOfficeSupplies, maxNumber ));
                 //Display the window.
                 frame.pack();
                 frame.setVisible( true );
             } // End method createAndShowGUI
         public void displayData( Product myProduct, OfficeSupplies myOfficeSupplies, int maxNumber )
              JTextArea myTextArea = new JTextArea(); // textarea to display output
              JFrame JFrame = new JFrame( "Products" );
              // For loop to display data array in a single Window
              for ( int counter = 0; counter < maxNumber; counter++ )  // Loop for displaying each product
                   myTextArea.append( packageData( myProduct, myOfficeSupplies, counter ) + "\n\n" );
                   JFrame.add( myTextArea ); // add textarea to JFrame
              } // End For Loop
              JScrollPane scrollPane = new JScrollPane( myTextArea ); //Creates the JScrollPane
              JFrame.setPreferredSize(new Dimension(350, 170)); // Sets the pane size
              JFrame.add(scrollPane, BorderLayout.CENTER); // adds scrollpane to JFrame
              JFrame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); // Sets program to exit on close
              JFrame.setSize( 350, 170 ); // set frame size
              JFrame.setVisible( true ); // display frame
         } // End method displayData
         public String packageData( Product myProduct, OfficeSupplies myOfficeSupplies, int counter ) // Method for formatting output
              return String.format( "%s: %d\n%s: %s\n%s: %s\n%s: %s\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f\n%s: $%.2f",
              "Product Number", myOfficeSupplies.getProductNumber( counter ),
              "Product Name", myOfficeSupplies.getProductName( counter ),
              "Product Brand",myProduct.getProductBrand( counter ),
              "Number of Units in stock", myOfficeSupplies.getNumberUnits( counter ),
              "Price per Unit", myOfficeSupplies.getUnitPrice( counter ),
              "Total Value of Item in Stock is", myOfficeSupplies.getProductValue( counter ),
              "Restock charge for this product is", myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ),
              "Total Value of Inventory plus restocking fee", myOfficeSupplies.getProductValue( counter )+
                   myProduct.restockingFee( myOfficeSupplies.getProductValue( counter ) ) );
         } // end method packageData
    } //End Class Panel

    multarnc wrote:
    My instructor has not been very forthcoming with assistance to her students leaving us to figure it out on our own.Aren't they all the same! Makes one wonder why they are called instructors. <sarcasm/>
    Of course it's highly likely that enough information was imparted for any sincere, reasonably intelligent student to actually figure it out, and learn the subject in the process.
    And if everything were spoonfed, how would one grade the performance of the students? Have them recite from memory
    public class HelloWorld left-brace
    indent public static void main left-parenthesis String left-bracket right-bracket args right-parenthesis left-brace
    And everywhere that Mary went
    The lamb was sure to go
    db

  • How can I convert table object into table record format?

    I need to write a store procedure to convert table object into table record. The stored procedure will have a table object IN and then pass the data into another stored procedure with a table record IN. Data passed in may contain more than one record in the table object. Is there any example I can take a look? Thanks.

    I'm afraid it's a bit labourious but here's an example.
    I think it's a good idea to work with SQL objects rather than PL/SQL nested tables.
    SQL> CREATE OR REPLACE TYPE emp_t AS OBJECT
      2      (eno NUMBER(4)
      3      , ename  VARCHAR2(10)
      4      , job VARCHAR2(9)
      5      , mgr  NUMBER(4)
      6      , hiredate  DATE
      7      , sal  NUMBER(7,2)
      8      , comm  NUMBER(7,2)
      9      , deptno  NUMBER(2));
    10  /
    Type created.
    SQL> CREATE OR REPLACE TYPE staff_nt AS TABLE OF emp_t
      2  /
    Type created.
    SQL> Now we've got some Types let's use them. I've only implemented this as one public procedure but you can see the principles in action.
    SQL> CREATE OR REPLACE PACKAGE emp_utils AS
      2      TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
      3      PROCEDURE pop_emp (p_emps in staff_nt);
      4  END  emp_utils;
      5  /
    Package created.
    SQL> CREATE OR REPLACE PACKAGE BODY emp_utils AS
      2      FUNCTION emp_obj_to_rows (p_emps IN staff_nt) RETURN EmpCurTyp IS
      3          rc EmpCurTyp;
      4      BEGIN
      5          OPEN rc FOR SELECT * FROM TABLE( CAST ( p_emps AS staff_nt ));
      6          RETURN rc;
      7      END  emp_obj_to_rows;
      8      PROCEDURE pop_emp (p_emps in staff_nt) is
      9          e_rec emp%ROWTYPE;
    10          l_emps EmpCurTyp;
    11      BEGIN
    12          l_emps := emp_obj_to_rows(p_emps);
    13          FETCH l_emps INTO e_rec;
    14          LOOP
    15              EXIT WHEN l_emps%NOTFOUND;
    16              INSERT INTO emp VALUES e_rec;
    17              FETCH l_emps INTO e_rec;
    18          END LOOP;
    19          CLOSE l_emps;
    20      END pop_emp;   
    21  END;
    22  /
    Package body created.
    SQL>Looks good. Let's see it in action...
    SQL> DECLARE
      2      newbies staff_nt :=  staff_nt();
      3  BEGIN
      4      newbies.extend(2);
      5      newbies(1) := emp_t(7777, 'APC', 'CODER', 7902, sysdate, 1700, null, 40);
      6      newbies(2) := emp_t(7778, 'J RANDOM', 'HACKER', 7902, sysdate, 1800, null, 40);
      7      emp_utils.pop_emp(newbies);
      8  END;
      9  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM emp WHERE deptno = 40
      2  /
         EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM
        DEPTNO
          7777 APC        CODER           7902 17-NOV-05       1700
            40
          7778 J RANDOM   HACKER          7902 17-NOV-05       1800
            40
    SQL>     Cheers, APC

Maybe you are looking for

  • Transferring Playli

    I already searched the forum and am unable to find out how to transfer playlists created in Mediasource to my Zen Vision:M. Can someone please give me a simple explanation of how to do it's I tried using the sync function in Zen Explorer but all that

  • Camera Light Blink after update to os x 10.10 Yosemite

    Hi, I am having a 13" macBook Pro Early 2011 edition, I recently upgraded the OS 10.9 Mavericks to OS X 10.10 Yosemite. After the update the machine has slowdown drastically and the green light beside the camera of the macbook blinks every times the

  • Send a FAX through F110 transaction

    hELLO , I.m a FI Consultant and I don´t know very much about programming , so I have to know how to send a FAX through the F110 transaction and I imagine I need to use programming, so please could you help me telling the response step by step? Thank

  • ODI Agent Test Error

    I'm having difficulty setting up ODI. I've been following John's excellant blog. so far I've created the master repository. In topology manager, I have created the connection, the dataserver ,the work repository, the agent & context. When I try to te

  • Unable to Create System from System template

    Dear All, I am planning to Integrate my Lotus Notes Web mail thru Portal(using SSO). For that  I have uploaded file <b>com.sap.portal.howtos.webapp.par</b> into my development portal, and created a System template , but When i am going to create Syst