Passing Multiple values from jsp to servlet

Dear all,
I am trying to do a very simple thing. I need to pass names of all products that have been added to the cart.
Below is my jsp. Basically I am trying to make something very basic using ajax, and later actually build it.
heres my code with 2 questions... all I need to do is to pass the names of the products.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
     pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<TITLE>ShowCart.jsp</TITLE>
</HEAD>
<script>
xhr = null
var flag = false;
var amount = 0;
function getData(url,divid,prodName){
          var as = "added"+divid // this is the divid
          if (document.getElementById(as)!=null)
               document.getElementById(as).innerHTML ="adding"
       if (window.XMLHttpRequest){
         xhr=new XMLHttpRequest()
       else if (window.ActiveXObject){
         xhr=new ActiveXObject("Microsoft.XMLHTTP")
       if (xhr){
          xhr.onreadystatechange=callback       
         xhr.open("GET",url,true)
         xhr.send(null)
         setDivid(as);
         updateCart(divid,prodName);
       else{
         alert("XMLHTTP not supported")
function setDivid(as){
if(flag){
     document.getElementById(as     ).style.backgroundColor = "RED";
        document.getElementById(as).innerHTML = "item added";
function updateCart(divid,prodName){
amount += divid;
document.getElementById("amount").innerHTML = "price is "+amount;
udpateSubmitData(prodName);
function updateSubmitData(prodName){
var = document.getElementById("Hidden"+prodName).value;
//do I need to do something here to submit the data ? ------------------1
function callback(dd){
       // when finished
       if (xhr.readyState==4){
              //  OK
              if (xhr.status==200){
             // process the result.
              flag = true;
       else{
              alert("error")
</script>
<BODY>
<P>Place content here.</P>
The products are :
<%
if(request.getAttribute("Products")!= null){
java.util.ArrayList list = new java.util.ArrayList();
list = (java.util.ArrayList)request.getAttribute("Products");
for(int i=0; i<list.size(); i++){
com.deere.sc.bean.ProductBean pb1 = new com.deere.sc.bean.ProductBean();
pb1 = (com.deere.sc.bean.ProductBean)list.get(i);;
%>
<table>
<td>
<% out.println(pb1.getProductName());
     out.println(pb1.getProductPrice());
     %> <td> <div id="added<%= i %>"> </div> </td>
<td>     <a href = "javaScript:getData('/SC/AddToCart?name=<%= pb1.getProductName() %>',<%= i %>,<%= pb1.getProductName() %>);"> add to cart</a>  </td>
     <input type="hidden" id="Hidden<%= pb1.getProductName() %>" value ="<%= pb1.getProductName() %>">
     </td>
     <%
}//end for
}//end if
%>
</table>
Thank you for shopping at the looters .. heh ;)
Total amount of money in your cart is <div id ="amount"> </div>
     <a href = "/SC/CheckOut">Check out cart</a>
<!-- OR may be just add Hidden tags here ?  ______________________2 -->
</BODY>
</HTML>Any help on tips for proceeding from here will be helpful.
thanks in advance

Dear all,
I am trying to do a very simple thing. I need to pass names of all products that have been added to the cart.
Below is my jsp. Basically I am trying to make something very basic using ajax, and later actually build it.
heres my code with 2 questions... all I need to do is to pass the names of the products.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
     pageEncoding="ISO-8859-1"%>
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<TITLE>ShowCart.jsp</TITLE>
</HEAD>
<script>
xhr = null
var flag = false;
var amount = 0;
function getData(url,divid,prodName){
          var as = "added"+divid // this is the divid
          if (document.getElementById(as)!=null)
               document.getElementById(as).innerHTML ="adding"
       if (window.XMLHttpRequest){
         xhr=new XMLHttpRequest()
       else if (window.ActiveXObject){
         xhr=new ActiveXObject("Microsoft.XMLHTTP")
       if (xhr){
          xhr.onreadystatechange=callback       
         xhr.open("GET",url,true)
         xhr.send(null)
         setDivid(as);
         updateCart(divid,prodName);
       else{
         alert("XMLHTTP not supported")
function setDivid(as){
if(flag){
     document.getElementById(as     ).style.backgroundColor = "RED";
        document.getElementById(as).innerHTML = "item added";
function updateCart(divid,prodName){
amount += divid;
document.getElementById("amount").innerHTML = "price is "+amount;
udpateSubmitData(prodName);
function updateSubmitData(prodName){
var = document.getElementById("Hidden"+prodName).value;
//do I need to do something here to submit the data ? ------------------1
function callback(dd){
       // when finished
       if (xhr.readyState==4){
              //  OK
              if (xhr.status==200){
             // process the result.
              flag = true;
       else{
              alert("error")
</script>
<BODY>
<P>Place content here.</P>
The products are :
<%
if(request.getAttribute("Products")!= null){
java.util.ArrayList list = new java.util.ArrayList();
list = (java.util.ArrayList)request.getAttribute("Products");
for(int i=0; i<list.size(); i++){
com.deere.sc.bean.ProductBean pb1 = new com.deere.sc.bean.ProductBean();
pb1 = (com.deere.sc.bean.ProductBean)list.get(i);;
%>
<table>
<td>
<% out.println(pb1.getProductName());
     out.println(pb1.getProductPrice());
     %> <td> <div id="added<%= i %>"> </div> </td>
<td>     <a href = "javaScript:getData('/SC/AddToCart?name=<%= pb1.getProductName() %>',<%= i %>,<%= pb1.getProductName() %>);"> add to cart</a>  </td>
     <input type="hidden" id="Hidden<%= pb1.getProductName() %>" value ="<%= pb1.getProductName() %>">
     </td>
     <%
}//end for
}//end if
%>
</table>
Thank you for shopping at the looters .. heh ;)
Total amount of money in your cart is <div id ="amount"> </div>
     <a href = "/SC/CheckOut">Check out cart</a>
<!-- OR may be just add Hidden tags here ?  ______________________2 -->
</BODY>
</HTML>Any help on tips for proceeding from here will be helpful.
thanks in advance

Similar Messages

  • Method to pass multiple values from jsp

    Hi All,
    There are multiple rows in the jsp form with each having a unique id.
    I want to update some fields in all the rows. Then pass all the data to the controller. From the controller all the data should go to the database one row at a time .How do i do this........
    Any help would be appreciated
    Thanks

    You can make use of ArrayList
    In CO
    OAApplicationModlue am = pageContext.getApplicationModule(webBean);
    ArrayList values = (ArrayList) am.invokeMethod("PassArray");In AM
    public ArrayList PassArray
    ArrayList values = new ArrayList();
    values.add("value")
    values.trimToSize();
    return values;
    }Thanks
    AJ

  • How to pass multiple parameters from jsp to servlet using iframe

    function updGrade(grd,actDetID,sID)
    updateFrame.location="/clucas/updateServ?s_id="+sID.value+" &act_ID="+actDetID.value+" &grade="+grd.value+";
    hi, i have this javascript on my jsp and try to send those three params to updateServ servlet inorder to update a grade value to database, but for some reasons it does not work. It is only work when I pass one parameter only.
    Can anybody help me with this please?
    thanks

    You have spaces before the & signs. They can't be there:
    function updGrade(grd,actDetID,sID)
      updateFrame.location="/clucas/updateServ?s_id="+sID.value+
                                           "&act_ID="+actDetID.value+
                                            "&grade="+grd.value;
    }

  • How to pass multiple values from workbook to planning function ?

    Hi,
    I have created Planning function in Modeler and it has one parameter(Variable represents = Multiple single values).
    When executing the planning function by create planning seq. in the web template : I see value of variable store data like ...
        A.) input one value -> V1
        B.) input three values -> V1;V2;V3
    This function execute completely in web.
    However, I want to use the planning function in workbook(Excel).
    The value of variable can't input V1;V2;V3... I don't know how to pass multiple values from workbook to parameter(Multiple single values type) in planning function ?
    thank you.

    Hi,
    Please see the attached how to document (page no 16).
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f0881371-78a1-2910-f0b8-af3e184929be">how to</a>
    Hope this was helpful
    thanks

  • How to pass multiple values from master to child report

    Hello,
    How would I pass multiple prompts from the master to child report? So for example, say I want to pass a 'Country' value along with a 'City' value
    Would it be?
    ="<a href=\"../../opendoc/openDocument.jsp?iDocID=ASQlgCemIOlEid1HHUlzyPs&sDocName=DocTest&sIDType=CUID&sType=wid&sWindow=Same&lsSCountry="+[Country]+"&lsSCity="+[City]+"\</a>"
    Thanks,
    Carter

    Carter,
    what is the syntax for this?
    It is exactly how you have posted in your original note.
    "&lsSCountry="+[Country]+"&lsSCity="[City]
    This will work providing the target report has a prompt called "Country" and another prompt called "City".  Note that your prompt and what you pass between the &lsS and the equal (=) must match exactly, otherwise OpenDocument will not communicate the prompt title to InfoView properly and InfoView will stop and execute the prompt to get the info it needs before running the report.  Have you tried what you've posted originally to see if it executes without a problem?
    Thanks,
    John

  • Passing Multiple Values from Multi Select

    Hi,
    My requirement is simple. I have created a simple Multi Select Option in parameter form and i want to send multiple selected values from the multi select option (in parameter form) to reports.
    eg:
    I want to send multiple countries code as input .........'US', 'CA', 'IND', 'UK'
    Can i do it in Oracle 6i reports, Thanks in Advance.
    Regards,
    Asgar

    Hi Thanks Again,
    For such a nice response. I got the Lexical Where condition properly running but still getting problems in catching the multiple values to be passed from form. just i will give u an insight of wat i have done:
    SQL:
    SELECT ALL FROM EMPLOYEES &cond_1* -- Working FIne
    in my Html Parameter Form i have an Multi Select component (the Problem is here) it is not passing more than i value from the form once i am accessing it from web or running it in paper report. In paper report layout it is not allowing me to select more than one value. but in HTML it is allowing to select multiple values but at the server end (After Parameter Form Trigger) it is giving a single value not multiple values.
    In PL/SQL when i checking the length of country_id i m getting it as one.
    Here is my SQL code
    srw.message(10, LENGTH(:country_id_1));
    :cond_1 := 'where country_id = '''|| :country_id_1 ||'''';
    This is passing the condition properly to SQL but only with single value but i want to pass multiple values
    I am struck in this+_
    WHERE CONTRY_COLUMN IN ('USA','UAE') -- This variable you have to pass from you form...
    Here as you said you gave multiple selection in your parameter form to generate report. So before generation report just prepare variable like this as it is bold above.
    and pass parameter through your runtime form to the report as you pass the normal parameter...liket this i gave you example...
    ADD_PARAMETER(PARAMETER_LIST_NAME,'P_CONT_PARAM',TEXT_PARAMETER,vString);
    Sorry for troubling you for a small thing but please help me to solve this issue.
    Thanks Again............
    Asgar.

  • Passing Multiple Values from a worksheet to PL/SQL function.

    Hi All,
    Is there any way to pass multiple values selected in a worksheet to a PL/SQL function ?
    I will try to explain the scenario:
    We have a crosstab report that showing all the customer details, deposit sum of a customer in each date in a date range selected. With the customer details we are showing the Rank of a customer based on the deposit in the latest date selected. Filtering is based on the rank, ie Top50 or Top60 etc.( As I said rank is calculating based on the deposit in the latest date).This is working fine.
    Now the new requirement is to : For example, in Top50 report, list all the customers, who were in the Top50 list, in any of the dates selected. We are able to display the daywise rank, but when giving a condition like daywiserank <= 50, the result becomes uncertain. Some blank lines, wrong amounts etc..
    As a work around we tried to find out the rank in a PL/SQL function. But the issue there is : we have some multiple value parameters used in the worksheet.
    Is there any way to pass multiple values selected in a worksheet to a PL/SQL function ?
    Or any other work arounds for the scenario explained?
    Reagrds,
    Jeneesh

    Hi Russ,
    Thanks for the response.
    Russ Proudman wrote:
    1. I thought there was an analytical function similar to rank - or maybe an option of rank - that if there are duplicate records to have them all considered the same rank. So if you had 3 records all the same as rank=2 then a condition saying where rank=2 would return the 3 records. You could check into this.
    We are already using DENSE_RANK. But the issue is the output contains incorrect null values nd repeated rows.
    We got it solved as I explained in the previous post. But will that AGGREGATION MODE setting ( Which discoverer says - not recommended) have any issue? I mean side effects?
    Russ Proudman wrote:
    2. Another thought is that you can create a PL/SQL routine - that's called from a SQL function registered in Discoverer - where a table is created that does the first part of your query. Then a worksheet is created to use the data from that table. So, in essence, the table would have your top50 ranked customers. Then you can write any kind of worksheet against that table. However, DBAs are loath to allow tables - that they didn't create! - many times in a PROD environment.
    Here also the same problem will occur: as the top 50 will depend upon the parameters. I cannot pass those parameters to PL/SQL Function.And storing the top50 ( itmay be top100 or to 150 also) for all combinations of the parameters is impossible
    Russ Proudman wrote:
    3. Finally, are you sure you're rank function is correct in that if you're getting blank lines, maybe the 'over' part is not considering all columns needed to determine the rank?
    Yes the query we are using is correct. The output QUERY of discoverer gives correct results in Sqlplus.
    Regards,
    Jeneesh

  • How to pass the value from JSP or HTML  to Applet

    Plz reply ....How can we pass the value from the JSP Page or from HTML page to Applet embedded in same page....

    Hi,
    <applet codebase = "."
    archive = foo.jar"
    code = "com.bar"
    name = "bar"
    id = "bar"
    width = "<%=Request["width"] %>"
    HEIGHT = "<%=Request["appHeight"] %>"
    hspace = "0"
    vspace = "0"
    align = "middle"
    alt     = "Applet is Loading..."
    >
         <param name="LANGUAGE"                value="<%=Request["lan"] %>">          
         <param name="LOGOUT_USER_URL"           value="EndSession.asp">
         <param name="DATA_READ_INTERVAL"      value="10000">
         <param name="REFRESH_INTERVAL"           value="5000">     
         <param name="DEFAULT_FONT"           value="Arial">
    </applet>
    pass values @ ur html or jsp page to Applet as parameters.
    Refer above code. By using getParameter() method of Applet, u can take values inside applet.

  • How To Pass the value from JSP to Applet

    plz reply how can we pass the value from the JSP to Applet ...the applet is embedded in JSP page....

    Hi,
    <applet codebase = "."
    archive = foo.jar"
    code = "com.bar"
    name = "bar"
    id = "bar"
    width = "<%=Request["width"] %>"
    HEIGHT = "<%=Request["appHeight"] %>"
    hspace = "0"
    vspace = "0"
    align = "middle"
    alt     = "Applet is Loading..."
    >
         <param name="LANGUAGE"                value="<%=Request["lan"] %>">          
         <param name="LOGOUT_USER_URL"           value="EndSession.asp">
         <param name="DATA_READ_INTERVAL"      value="10000">
         <param name="REFRESH_INTERVAL"           value="5000">     
         <param name="DEFAULT_FONT"           value="Arial">
    </applet>
    pass values @ ur html or jsp page to Applet as parameters.
    Refer above code. By using getParameter() method of Applet, u can take values inside applet.

  • How do I pass multiple values from a text box to an update statement

    I hope this does not sound to lame. I am trying to update multiple values Like this:
    Code|| Computer Desc || Computer Price || Computer Name
    SEL1 || Apple macbook || 1564 || Apple Macbook Basic
    SEL2 || Dell 630 || 1470 || Dell Latitude
    I want to change all six values at once in one update statement based on the Code, I can't find a good tutorial/example to help me.
    Can anyone point me in the right direction?
    Thanks so much,
    Laura

    You can do conditional updates with decode or case statements e.g.
    SQL> create table t as
      2  select 'SEL1' as code, 'Apple macbook' as comp_desc, 1564 as comp_price, 'Apple Maxbook Basic' as comp_name from dual union
      3  select 'SEL2', 'Dell 630', 1470, 'Dell Latitude' from dual
      4  /
    Table created.
    SQL>
    SQL> update t
      2  set comp_desc = CASE code WHEN 'SEL1' THEN 'Test1' Else 'Test2' END,
      3      comp_price = CASE code WHEN 'SEL1' THEN 1234 Else 2345 END,
      4      comp_name = CASE code WHEN 'SEL1' THEN 'Test1 Name' Else 'Test2 Name' END
      5  /
    2 rows updated.
    SQL>
    SQL> select * from t
      2  /
    CODE COMP_DESC     COMP_PRICE COMP_NAME
    SEL1 Test1               1234 Test1 Name
    SEL2 Test2               2345 Test2 Name
    SQL>

  • I cant pass an array from JSP to Servlet

    I have a JSP which creates a table when it is loaded doing a query on a database and showing the content of the result set.
    The data showed are some items' names and at the end of each row there is a text field where the user can write the quantity of each item to buy.
    I need to send to a servlet the name and the quantity of each item with a quantity value > 0.
    This is what I think to do:
    in the text field I've put an onChange event which calls a javascript function, the function inserts the item and the quantity inside an array if the quantity is > 0, removes the item if the quantity is <= 0.
    The submit button calls another function which put the array in the session
    session.setAttibute("daAcquistare",daAcquistare);
    daAcquistare is my array created in the JSP
    var daAcquistare = new Array();
    Inside the servlet I don't know how to take that array since if I do like this
    String[] ingrediente = new String[i*2];
    HttpSession session = request.getSession();
    ingrediente = session.getAttribute("daAcquistare");
    I obtain "Cannot convert from Object to String[]"
    How can I do to have that array inside the servlet?

    Thankyou for your reply.
    This is my form:
    <form name="rimanenze" action="VerificaRimanenze" method="post">
    <table width="650" border="0" cellpadding="6">
         <tr>
              <td width="25%"><b>Ingrediente</b></td>
              <td width="25%"><p align="center"><strong>Unit� di misura</strong></p></td>
              <td width="20%"><p align="center"><strong>Disponibilit�</strong></p></td>
              <td width="20%"><p align="center"><strong>Soglia</strong></p></td>
              <td width="10%"><p align="center"><strong>Acquista</strong></p></td>
         </tr>
              <% rs = IngrController.getInEsaurimento();
                 while(rs.next()) { %>
         <tr>
              <td><%= rs.getString("nome") %> </td>
              <td><%= rs.getString("unitaDiMisura") %></td>
              <td><%= rs.getString("disponibilita") %></td>
              <td><div align="center"><%= rs.getString("soglia") %></div></td>
              <td><div align="center"><input type="text" id="ingrediente<%= i %>" name="<%= rs.getString("nome") %>" value="0" onChange="selezionato(this)" /></div></td>
         </tr>
              <%i++; } %>
         <tr>
              <td> </td>
              <td> </td>
              <td> </td>
              <td><input type="hidden" name="totale_selezionati" value="0"/> </td>
              <td><input type="submit" name="acquista" value="Acquista" /></td>
         </tr>
    </table>
    </form>and this is the servlet's doPost method
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              int i = Integer.parseInt(request.getParameter("totale_selezionati")); //nuber of item with quantity value > 0
              int j = 0, aux = 0; //j counts the number of items with quantity > 0 found, aux loops on each item id
              String[] ingrediente = new String;
              while (j < i) { //while stops when number of item with quantity value > 0 found is the same of the known number of those items
                   if(Integer.parseInt(request.getParameter("ingrediente"+aux)) > 0) {
                        ingrediente[j] = request.getParameter("ingrediente"+aux); //takes the attribute value of the item, how to thake the name too?
                        j++;
                        aux++;
                   else
                        aux++;               
              IngrController.aggiungiIngredienteMagazzino(ingrediente,i);
              RequestDispatcher dispatcher = request.getRequestDispatcher("/verificarimanenze.jsp");
              dispatcher.forward(request, response);
    I can't use the items' names to loop on the form because the form is dinamically generated, I need to use the id attribute for that and then, take the name and value in the servlet... I can only take the value, I don't know how to take the name.
    Edited by: Kumidan on Jul 24, 2008 9:16 AM
    modified an instruction inside the while in the doPost method.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Passing value from JSP to scriptlet

    Hi
    I am trying to find a way to pass a value from jsp to the scriptlets, i.e.
    <c:set var="testValue" value="123" />
    <%
    System.out.println(testValue);
    %>
    the above code just demonstrates what I was trying to achieve, by passing the value from the jsp into the scriptlet.
    Can someone tell me if there's an easy way to do this?
    Thank you.

    Note, using scriptlet code on your page is generally something to be avoided. 99% of what you should be doing on a JSP page can be done with EL/JSTL. If you can't do it with EL/JSTL then it probably belongs in a servlet/bean.
    I always aim for 100% scriptlet free jsp pages.
    Having said that, I can still answer your question: EL attributes are stored in the scope - page, request, session, application
    ${testValue} is equivalent to pageContext.findAttribute("testValue").
    The <c:set> tag example doesn't specify a scope, so therefore you could get it like this:
    <c:set var="testValue" value="123" />
    <%
    String testValue = (String)pageContext.getAttribute("testValue");
    System.out.println(testValue);
    %>alternatively exploit the feature of the useBean tag that creates a scriptlet variable:
    <c:set var="testValue" value="123" />
    <jsp:useBean id="testValue" type="java.lang.String"/>
    <%
    System.out.println(testValue);
    %>Note that the EL variable and the Scriptlet variable are initially pointing at the same String.
    But changing the string in scriptlet code will change the value it is pointing at, while leaving the EL variable untouched.
    If you have a List in scope, and sharing it between EL and scriptlet variables then any changes to the list would be reflected because they both point at the same List object.
    cheers,
    evnafets

  • Passing multiple values to a parmeters in Discoverer 4i

    Hi Friends,
    I have a requirement of passing multiple values (Operating Unit Names) to the parameter(P_Opr_Unit) in Discoverer.
    I am using PL/SQL function to get the data in Discoverer.Function is working fine for multiple values from Database(SQL Developer).
    When i am trying to pass multiple values from discoverer ...it is accepting only the first parameter value of Operating Unit.
    Need your Expertise on this issue.
    Thanks In Advance.
    Thanks & Regards
    Ramya Nomula

    Hi,
    You can only pass one parameter value into a function. When you have a multi-valued parameter it enables you to create the condition: item IN (:param) which Discoverer expands to the condition: item IN ('val1', 'val2', 'val3') where these are the values the user has picked from the list of values.
    Now if you have a calculation containing a function and a parameter: my_func(:param) then Discoverer has to map the parameter in the function an item in the worksheet. So if the param is from a multi-valued list it can only pass one value and so expands the calculation to my_func('val1') where val1 is the first item picked from the list.
    Rod West

  • Passing value from JSP to JApplet

    Hello,
    I am stuck up with a problem, can anyone please tell me how do i pass a value from a JSP page
    to a JApplet,
    and the parameter passed through JSP should be displaed in the JTextArea.
    It would be kindful if any of you could help.
    Thanks
    Sanam

    hello,
    thanks for reply.
    I know how to pass parameters from html,
    I want to pass values from jsp page,
    and i dono how to do it, may be we cann pass values through url connection but i dono how.
    if anone knows plz help me in solving this.
    i hvae posted my applet code.
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.JToolBar;
    import javax.swing.JButton;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.JPanel;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    <applet code = "DocApplet" width = 500 height =5000>
    </applet>
    public class DocApplet extends JApplet
         private JPanel jp;
         private Container cp;
         private JTextArea jt;
         private JToolBar tb;     
         private JScrollPane sp;
         private String annotation;
         private String url;
         private Connection con;
         private Statement stmt;
         public void init()
              jp = new JPanel();
              cp = getContentPane();
              jt = new JTextArea();
              tb = new JToolBar();
              sp = new JScrollPane(jt);
              repaint();
         public void start()
              jp.setLayout(new BorderLayout());
              jp.add(tb, BorderLayout.NORTH);
              jp.add(sp, BorderLayout.CENTER);
              jt.setBackground(Color.BLACK);
              jt.setForeground(Color.WHITE);
              setContentPane(jp);
              addButtons(tb);
              repaint();
         public void run()
              repaint();
         public void paint()
         private void addButtons(JToolBar tb)
              JButton button = null;
              button = new JButton("Save");
              button.addActionListener(new ActionListener()
                   public void actionPerformed(ActionEvent e)
              tb.add(button);
    }

  • I am facing a problem in passing multiple values as out parameters from fo

    Hi All,
    i am facing a problem in passing multiple values as out parameters from for loop.
    EX:
    i have a select statment inside a loop like.....
    PACKAGE SPEC:
    create or replace PACKAGE EMP_PKG AS
    TYPE TAB_NUM IS TABLE OF SCOTT.EMP.EMPNO%TYPE;
    TYPE TAB_NAME IS TABLE OF SCOTT.EMP.ENAME%TYPE;
    TYPE TAB_JOB IS TABLE OF SCOTT.EMP.JOB%TYPE;
    temp_table TAB_NUM;
    procedure test(temp_TAB_e_no OUT TAB_NUM,
    temp_TAB_e_name OUT TAB_NAME,
    temp_TAB_e_job OUT TAB_JOB);
    END EMP_PKG;
    PACKAGE BODY:
    create or replace PACKAGE BODY EMP_PKG AS
    v_e_no NUMBER;
    procedure test(temp_TAB_e_no OUT TAB_NUM,
    temp_TAB_e_name OUT TAB_NAME,
    temp_TAB_e_job OUT TAB_JOB) IS
    BEGIN
    select EMPNO bulk collect into temp_table from emp;
    for i in 1..temp_table.count loop
    v_e_no := temp_table(i);
    select empno,
    ename,
    job
    into temp_TAB_e_no(i),
    temp_TAB_e_name(i),
    temp_TAB_e_job(i)
    from emp
    where empno = v_e_no;
    end loop;
    end test;
    END EMP_PKG;
    PROBLEM FACING IS:
    I am expecting all rows returning from bellow select statment ...
    select empno,
    ename,
    job
    into temp_TAB_e_no(i),
    temp_TAB_e_name(i),
    temp_TAB_e_job(i)
    from emp
    where empno = v_e_no;
    But,while running the SP , i am getting error like
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at "SCOTT.EMP_PKG", line 16
    why i am not getting all values as out parameters.please provide a solution for me.
    Thanks in advance my friend.

    user9041629 wrote:
    Hi All,
    i am facing a problem in passing multiple values as out parameters from for loop.
    EX:
    i have a select statment inside a loop like.....
    PACKAGE SPEC:
    create or replace PACKAGE EMP_PKG AS
    TYPE TAB_NUM IS TABLE OF SCOTT.EMP.EMPNO%TYPE;
    TYPE TAB_NAME IS TABLE OF SCOTT.EMP.ENAME%TYPE;
    TYPE TAB_JOB IS TABLE OF SCOTT.EMP.JOB%TYPE;
    temp_table TAB_NUM;
    procedure test(temp_TAB_e_no OUT TAB_NUM,
    temp_TAB_e_name OUT TAB_NAME,
    temp_TAB_e_job OUT TAB_JOB);
    END EMP_PKG;
    PACKAGE BODY:
    create or replace PACKAGE BODY EMP_PKG AS
    v_e_no NUMBER;
    procedure test(temp_TAB_e_no OUT TAB_NUM,
    temp_TAB_e_name OUT TAB_NAME,
    temp_TAB_e_job OUT TAB_JOB) IS
    BEGIN
    select EMPNO bulk collect into temp_table from emp;
    for i in 1..temp_table.count loop
    v_e_no := temp_table(i);
    select empno,
    ename,
    job
    into temp_TAB_e_no(i),
    temp_TAB_e_name(i),
    temp_TAB_e_job(i)
    from emp
    where empno = v_e_no;
    end loop;
    end test;
    END EMP_PKG;
    PROBLEM FACING IS:
    I am expecting all rows returning from bellow select statment ...
    select empno,
    ename,
    job
    into temp_TAB_e_no(i),
    temp_TAB_e_name(i),
    temp_TAB_e_job(i)
    from emp
    where empno = v_e_no;
    But,while running the SP , i am getting error like
    ORA-06531: Reference to uninitialized collection
    ORA-06512: at "SCOTT.EMP_PKG", line 16
    why i am not getting all values as out parameters.please provide a solution for me.
    Thanks in advance my friend.Probably not a bad thing that this isn't working for you.
    This is a horrible way to return the contents of a table.
    Are you doing this for educational purpose, or ... what is your goal here? If you just want to return a result set to a client you'd want to look in to using a REF CURSOR and not a bunch of arrays combined with horribly procedural (slow) code.

Maybe you are looking for

  • Bottom toolbar is not visible

    bottom toolbar is not visible

  • Macros and Data View time bucket difference

    Hi, Our client is having a macro for a dataview wherein in one of the macro step, we have a condition where the values are checked for a bucket which I dont see in the data view. For example, in the macro, we have a condition for W06/2009 while in th

  • PNPCE for LSO

    I've set up an infoset for ad-hoc reporting using PNPCE and I'm having trouble getting any LSO data out of it.  (Tasks, Qualifications from the Org Structure).  Is it possible to use PNPCE for this?  I can get that data out of PCH but I need PA data

  • Desktop Manager fails during launch

    When I first got my Alltel Blackberry Pearl 8130 some months ago, I used BlackBerry Desktop Manager 4.5 (installed from the included disk) to synchronize my Blackberry with my contacts, tasks and notes I keep with my desktop PC using Microsoft OutLoo

  • Latest versions of SAP Reach

    Hi Experts, Pl. let me know the latest versions of SAP Reach Solutions. Sunil