How to delete a row in a session

Hi im new in jsp.
I want to create a webshop.
When i select my products it goos to a shopping cart.
After the customer confirms the order then it will be put in to a database.
Now i want to create a function in de shopping cart for the customer to delete the products he doesnt want to buy.
This is my shoppingcart code.
Sorry also for my english.
<%@ page language="java" %>
<jsp:useBean id ="bestellingBean" class="java.util.Vector" scope="session" />
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Winkelmandje</title>
<link href="Style.css" rel="stylesheet" type="text/css" />
</head>
<%@page
     import="java.util.Vector"
     import = "java.io.*"
     import = "java.lang.*"
     import = "java.sql.*"
     import =" com.xatrax.xatrax.vo.*"
%>
<body bgcolor="#FFFFFF">
<table border=0 align ="left" width="800" >
<tr>
<td>
     <table border = 2 width="750" align="center" bgcolor="00CCFF" >
          <tr>
               <td width="50">
                    <center>Aantal</center>
               </td>
               <td width="90">
                    <center>Artikelcode     </center>
               </td>
               <td width="350">
                    <center>Naam</center>
               </td>
               <td width="130">
                    <center>Prijs</center>
               </td>
               <td width="80">
                    <center>Lijntotaal</center>
               </td>
               <td width="50">
                    <center>Wis</center>
               </td>
          </tr>
     </table>
     <form>
     <table border = 2 width="750" align="center" bgcolor="66FFF" >
<% com.xatrax.xatrax.servlets.Bestel bTemp = new com.xatrax.xatrax.servlets.Bestel();%>     
     <% for (int i = 0; i<bestellingBean.size(); i++){%>
<%
     gProduct prodTemp = bTemp.getProductDetails(Integer.parseInt((String)bestellingBean.get(i)));
%>
          <tr>
               <td width="50">
                    <center><input type="text" name="aantal" size="3" >     </center>
               </td>
               <td width="90">
                    <center><%=prodTemp.getArtikelcode()%></center>
               </td>
               <td width="350">
                    <center><%=prodTemp.getNaam()%></center>
               </td>
               <td width="130">
                    <center><%=prodTemp.getPrijs()%></center>
               </td>
               <td width="80">
                    <center>test</center>
               </td>
               <td width="50">
                    <center><img src="image/delete.gif" width="21" height="20" border="0" /><a></center>
               </td>
          </tr>
          <%
               String delete = (String) session.getAttribute("delete");
               boolean del =("true".equals (delete));
          %>
     <% } %>
     </table>
     </form>
     <form>
     <table border=0 align ="left" width="800" >
     <tr>
     <td>
          <table width="750" border="0">
          <tr>
               <td width="15"></td>
               <td width="130"><input type="submit" value="Update aantal" name="update" /></td>
               <td width="330"></td>
               <td width="125">Subtotaal incl.BTW: </td>
               <td width="*"><center>test</center></td>
          </tr>
          <tr>
               <td width="15"></td>
               <td width="130"></td>
               <td width="330"></td>
               <td width="125"></td>
               <td width="*"></td>
          </tr>
          </table>
          <table>
          <tr>
               <td width="15"></td>
               <td width="130"></td>
               <td width="330"></td>
               <td width="125"></td>
               <td width="*"><center><input type="submit" value="Bevestig bestelling" /></center></td>
          </tr>
          </table>     
     </td>
     </tr>
     </form>
</td>
</tr>
</table>
</body>
</html>
The part that is bold is the link (image) that the user will see.
When he click on the symbol the row will be deleted.
The id is giving in the bestellingBean.
The data for the names of the products will be get from a database.
Now how can i delete the full row. I now that i need to use the id or is there a simpel way.
The row will be only deleted in the session, not in the database.
I dont now how i can delete a full row in a session.
My idee.
String delete =(String)session.getAttribute("delete");
boolean del =("true".equals(delete));
if(!del){
Can somebody help me with this.
Thanx allot.

from the Vector object? You need to know what row and call the removeElement method on the Vector.

Similar Messages

  • How to delete a row in the table in servlets

    I have met a problem in deleting a row in table using servlets.
    My table looks like this:
    ID Name Type
    12 Milienium S
    15 USIA O
    My code looks like this:
    String query = "SELECT * FROM tb_Funds";
    rs = statement.executeQuery(query);
    while(rs.next()) {          
    StdID=rs.getString("FundID");
    StdName=rs.getString("Name");
    StdType=rs.getString("Type");
    out.print("<td><INPUT TYPE=TEXT NAME=
    myName VALUE=" + StdID + "></td>");
    out.print("<td>" + StdName + "</td>");
    out.print("<td>" + StdType + "</td>");
    buf.append("<td>" + "<INPUT TYPE=SUBMIT
    NAME=Delete VALUE=DELETE>" + "</td></tr>");
    There is a delete button in every row. May I know how to delete the row that I want by getting the ID from the table and delete it from the database.
                                       

    Deleting from a table is simple -> delete from tb_funds where id = <value>. Obviously replace <value> with the appropriate ID or use a bind variable (a ?) and prepared statements.
    Are you asking how to pass the id associated with the table row from the browser when the button is pressed?

  • How to delete multiple rows from ADF table

    How to delete multiple rows from ADF table

    Hi,
    best practices when deleting multiple rows is to do this on the business service, not the view layer for performance reasons. When you selected the rows to delete and press submit, then in a managed bean you access thetable instance (put a reference to a managed bean from the table "binding" property") and call getSeletedRowKeys. In JDeveloper 11g, ADF Faces returns the RowKeySet as a Set of List, where each list conatins the server side row key (e.g. oracle.jbo.Key) if you use ADF BC. Then you create a List (ArrayList) with this keys in it and call a method exposed on the business service (through a method activity in ADF) and pass the list as an argument. On the server side you then access the View Object that holds the data and find the row to delte by the keys in the list
    Example 134 here: http://blogs.oracle.com/smuenchadf/examples/#134 provides you with the code
    Frank

  • How To Delete a Row From a TableView !!!!

    Hi,
    Does any know how to delete a row from a table view model.
    I have a TableViewModel being displayed, when the user select the particular row and click delete i want that particular row to be deleted.
    Any Suggestions How.
    Thanks,
    Emmanuel.

    If u want to delete single row, then set the property of TableView - selectionMode="SINGLESELECT". Select the radio button and click on delete button. In the main program, you can get the row value like...
    public void onDeleteButtonClicked(Event event) throws PageException {
    TableView table = (TableView) this.getComponentByName ("idTableView");
    DefaultTableViewModel dmodel = myBean.beanModel;
    String pid = "", row_selected;
    // Get the first visible row
    int firstVisibleRow = table.getVisibleFirstRow();
    // Get the last visible row
    int lastVisibleRow = table.getVisibleLastRow();
    for (int i = firstVisibleRow; i <= lastVisibleRow; i++) {
    if (table.isRowSelected(i)) {
      row_selected = i;
      pid = dmodel.getValueAt(i, 1).toString();
    "i" will give you the row no, pid has the value of the row at first column.
    Hope this helps.
    Thanks,
    Praveen

  • How to Delete duplicates rows without using rowid/distinct.

    How to delete duplicates rows present in a table without using rowid or even distinct.

    How about:
    SQL> SELECT * FROM t1;
             A          B
             1          2
             2          3
             1          2
             4          4
             4          4
             4          4
    SQL> DELETE FROM t1
      2  WHERE (a, b) IN (SELECT a, b FROM t1
      3                   GROUP BY a, b
      4                   HAVING COUNT(*) > 1) and
      5        rownum = 1;
    1 row deleted.
    SQL> /
    1 row deleted.
    SQL> /
    1 row deleted.
    SQL> /
    0 rows deleted.
    SQL> SELECT * FROM t1;
             A          B
             2          3
             1          2
             4          4Although, if I was asked a similar question with all those restrictions, my first response would be along the lines of: Is this question indicative of the way I will have to work if I join this company? If so, there is no point answering because I wouldn't touch this job with a ten foot pole.

  • Urgent!! How to delete a row with OrdImage (New)!!!

    I got a problem when I attempt to delete a row that contains a Image in a view object:
    I am using JDeveloper 3.2. And also I use BC4J for my project. I use a web bean to delete a row from a view object:
    For example, the web bean contain the following method "deletePic", the part code is following:
    try {
    JSPApplicationRegistry jr = JSPApplicationRegistry.getInstance ();
    ApplicationModule ei = jr.getAppModuleFromContexts("Testpackage_Test_TestAM", session, null);
    ViewObject s = ei.findViewObject ("PicVO");
    s.executeQuery ();
    if (s.hasNext ())
    s.next ().remove ();
    ei.getTransaction().commit();
    } catch (java.lang.Exception e) {
    System.out.println (e.toString ());
    I simply use the Row remove method to delete a row that contain a ORDImage Field. But I got the following error that is:
    oracle.jbo.DMLException: JBO-26041: Failed to post data to database during "Delete": SQL Statement " DELETE FROM TESTTABLE Testtable WHERE TESTID=:1".
    I check for this error only know this error ocurr when try to commit the transaction, but don't know how to solve it....
    pls help me..thx.
    null

    Hi Akira,
    I created a table using the following SQL statement:
    create table timg (id number primary key, image ordsys.ordimage);
    Then I inserted some records. Next, I populated the images in some rows.
    Then, I created a Business Components project. At last, I created a web bean and used this web bean in a JSP page.
    In the web bean, I used your code but modified the applicationId string and view name string to reflect the ones on my machine.
    The JSP ran successfully. The rows were deleted from the table by the web bean. I didn't see the exception. The database I am using is 817, the JDeveloper version is 3.2.3.
    thanks,
    Richard

  • How to delete a row in target when corresponding row in source is deleted

    Greetings
    Environment:
    Repository - OWB 10.1.0.4 - going to 10gR2 very soon
    - IBM RS6000 running AIX 5.3
    I have a target table being updated with an INSERT/UPDATE. The user deleted a row in the source table and I want to delete the corresponding row in the target table.
    How do I do this in the map?
    Many thanks.
    -gary

    Thanks very much for the responses. Now that I have thought it through more carefully I see I can still have a single instance of the source table and send it through the MINUS operator with the target table followed by a DELETE into the target table and still have the existing logic for the INSERT/UPDATE into a second occurrence of the target table.
    It won't matter what order OWB puts together the two operations on the target table:
    - if it does the DELETE first the new rows that haven't been added to the target table will come out of the MINUS operator but not be found yet in the target table so not deleted.
    - if it does the INSERT/UPDATE first the newly added rows will not come out of the MINUS operator and hence not deleted from the target.
    Must have been a brain fart.
    Thanks again.
    -gary

  • HOW TO DELETE THE ROW FROM DATABASE

    hI,
    Iam pasting my code below.My problem isi retrieve rows from database and display them in jsp page in rows.For each row there is delete hyperlink.Now when i click that link i should only delete the row corresponding to that delete link temporarily but it should not delete the row from database now.It should only delete the row from database when i click the save button.How can i do this can any one give some code.
    thanks
    naveen
    [email protected]
    <%@ page language="java" import="Utils.*,java.sql.*,SQLCon.ConnectionPool,java.util.Vector,java.util.StringTokenizer" %>
    <html>
    <head>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>Item Details</title>
    <script>
    function submitPage()
    document.details.action = "itemdetails.jsp" ;
    document.details.submit();
    </script>
    </head>
    <body>
    <form name="details" action="itemdetails.jsp" method="post">
    <%
    ConnectionPool pool;
    Connection con = null;
    Statement st;
    ResultSet rs =null;
    %>
    <table border="0" cellpadding="0" cellspacing="0" width="328">
    <tr>
    <td width="323" colspan="4"><b>Reference No :</b> <input type="text" name="txt_refno" size="14">
    <input type="submit" value="search" name="search" ></td>
    </tr>
    <tr>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item Code</b></font></td>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Item No</b></font></td>
    <td width="81" bgcolor="#000099"><font color="#FFFFFF"><b>Amount </b></font></td>
    <td width="80" bgcolor="#000099"> </td>
    </tr>
    <%
    pool= new ConnectionPool();
    Utils utils = new Utils();
    double total =0.00;
    String search =utils.returnString(request.getParameter("search"));
    if(search.equals("search"))
    try
    String ref_no =utils.returnString(request.getParameter("txt_refno"));
    String strSQL="select * from ref_table where refno='" + ref_no + "' ";
    con = pool.getConnection();
    st=con.createStatement();
    rs = st.executeQuery(strSQL);
    while(rs.next())
    String itemcode=rs.getString(2);
    int item_no=rs.getInt(3);
    double amount= rs.getDouble(4);
    total= total + amount;
    %>
    <tr>
    <td width="81"><input type=hidden name=hitem value=<%=itemcode%>><%=itemcode%></td>
    <td width="81"><input type=hidden name=hitemno value=<%=item_no%>><%=item_no%></td>
    <td width="81"><input type=hidden name=hamount value=<%=amount%>><%=amount%></td>
    <td width="80"><a href="delete</td>
    </tr>
    <%
    }catch(Exception e){}
    finally {
    if (con != null) pool.returnConnection(con);
    %>
    <tr>
    <td width="323" colspan="4">
    <p align="right"><b>Total:</b><input type="text" name="txt_total" size="10" value="<%=total%>"></td>
    </tr>
    <tr>
    <td width="323" colspan="4">                   
    <input type="button" value="save" name="save"></td>
    </tr>
    </table>
    </form>
    </body>
    </html>

    You mean when you click on the hyperlink you want that row to disappear from the page, but not delete the row from the database until a commit/submit button is pressed?
    Personally, I think I'd prefer that you have a delete checkbox next to every row and NOT remove them from the display if I was a user. You give your users a chance to change their mind about their choice, and when they're done they can see exactly which rows will be deleted before they commit.
    You know your problem, of course, so you might have a good reason for designing it this way. But I'd prefer not removing them from the display. JMO - MOD

  • How to delete a row in ADF Table by pressing "Delete" Key

    I want to delete a row in my ADF table by pressing the "Delete" key..How can i achieve it?

    hai ,
    I write clientListener and ServerListener..But in the script i printed the event.getKeyCode() ...*When i press Delete Key or EnterKey ,it is not printing the value*..
    The code i write is pasted below..
    In the code backing_Comm is my backingbean..Is there any problem in the code that i had written?I want to delete a selected row from my table using keypress Event...pls advice..
    <script type="text/javascript">
    onPressDeleteKey=function(event){
    alert(event.getKeyCode()); // *Here i am not getting the alert, when i press Delete Key or Enter Key..But getting alert when i press A- Z or 1 - 0*
    if(event.getKeyCode()==AdfKeyStroke.ENTER_KEY) {
    var source = event.getSource();
    AdfCustomEvent.queue(source,performDeleteOnPress,{},false);
    </script>
    <*af:table* value="#{bindings.ComMastVO.collectionModel}"
    var="row"
    rows="#{bindings.ComMastVO.rangeSize}"
    emptyText="#{bindings.ComMastVO.viewable ? 'No rows yet.' : 'Access Denied.'}"
    fetchSize="#{bindings.CompMastVO.rangeSize}"
    rowSelection="single"
    id="tblCom"
    columnStretching="last" inlineStyle="width:100%;"
    width="273"
    selectionListener="#{backing_Comm.rowSelectCom}"
    binding="#{backing_Comm.tblCom}"
    clientComponent="true" >
    <*af:column* sortProperty="Com" sortable="true">
    <*af:inputText* value="#{row.bindings.Com.inputValue}"
    label="#{bindings.ComMastVO.hints.Com.label}"
    required="#{bindings.ComMastVO.hints.Com.mandatory}"
    columns="150"
    maximumLength="#{bindings.ComMastVO.hints.Com.precision}"
    shortDesc="#{bindings.ComMastVO.hints.Com.tooltip}">
    valueChangeListener="#{backing_Comm.onValueChange}"
    autoSubmit="true" >
    <f:validator binding="#{row.bindings.Com.validator}"/>
    *</af:inputText>*
    *<af:serverListener type="performDeleteOnPress"*
    *method="#{backing_Comm.goDeleteCurrentRow}"/>*
    </af:column>
    *<af:clientListener type="keyPress"*
    *method="onPressDeleteKey"/>*
    </af:table>
    =================================================
    anybody pls help??
    Edited by: Briston Thomas on Jun 3, 2009 2:25 AM

  • How to delete datawindow row by loop?

    I try to go through datawndow rows by for loop and delete those rows I found with condition.  Something like:
    For i = 1 to dw_1.RowCount()
      if expression then 
        dw_1.DeleteRow(i)
      end if
    Next
    Looks like not working properly. if DeleteRow dynamically change RowCount()? how to resolve this problem?

    If you must go from row 1 to RowCount(), then try this:
    long ll_Row
    ll_Row = 1
    DO WHILE ll_Row <= dw_1.RowCount()
         IF expression THEN
              dw_1.DeleteRow(ll_Row)
         ELSE
              ll_Row++
         END IF
    LOOP
    HTH,
    Manuel Marte

  • NEW DEBUGGER: How to delete selected rows is one shot

    Hi Specialists,
    I have a small question. While debugging a program I have an internal table having 300 records .
    Now I wish to delete 290 records during debugger session in one shot instead of choosing 1 by one.
    Is there way I can select & do .
    I searched but could not locate "SELECT ALL " button.
    -Abhinav.

    Hello here is one example
    please follow this formula.
    here selection is in terms of 
    itab-mblnr = itab1-lfbnr.
    itab-zeile = itab1-lfpos . "
    and system delete selected row of itab using
    "DELETE TABLE itab FROM itab."
    IF sy-subrc = 0.
      itab-mblnr = itab1-lfbnr.
    itab-zeile = itab1-lfpos .
      DELETE TABLE itab FROM itab.
      endif.
    Edited by: riten patel on Feb 12, 2010 11:33 AM

  • How to delete zero rows from a matrix?

    Hi,
    I have a 2D datamatrix and there are some zero rows. My original program should recognize all zero rows and delete them. How to do that?
    I have tried with the Delete From Array function but no success. I also tried with the OpenG array functions but...no.
    I attached a vi which simulates my problem. There is one zero row and I want to delete it and have a matrix without zero rows.
    Kudos for any good help!
    Solved!
    Go to Solution.
    Attachments:
    DeleteZeroRows.vi ‏19 KB

    Christian_M wrote:
    The idea was to give a hint that people try using their brain....
    Stilll, I think your code is fundamentally flawed and will thus lead the student into a deep swamp.
    Have you actually tried it with multiple rows of zeroes?
    Since "delete from array" rearranges the array indices with each deletion, the code will break if there is more than one row to be deleted. For example if a row is already deleted and it needs to also delete the last row, it would try to delete a row that no longer exists. If a later row still exists, it will delete the wrong row.
    Also, since NaN gets coerced to a valid index (2147483647), it's probably not such a good idea. "-1" would be a better choice. (Well, it's an unlikely implossible possibility in LabVIEW 32 bit, but still....)
    I also don't understand your logic with "search array". You need to test all elements for zero.
    LabVIEW Champion . Do more with less code and in less time .

  • How to delete the row in table control with respect to one field in module pool programming?

    Hi,
    Can I know the way to delete the row in table control with respect to one field in module pool programming
    Regards
    Darshan MS

    HI,
    I want to delete the row after the display of table control. I have created push button as delete row. If I click on this push button, the selected row should get deleted.
    I have written this code,
    module USER_COMMAND_9000 input.
    DATA OK_CODE TYPE SY-UCOMM.
    OK_CODE = SY-UCOMM.
    CASE OK_CODE.
         WHEN 'DELETE'.
            LOOP AT lt_source INTO ls_source WHERE mark = 'X'.
                APPEND LS_SOURCE TO LT_RESTORE.
                DELETE TABLE LT_SOURCE FROM LS_SOURCE.
                SOURCE-LINES = SOURCE-LINES - 1.
            ENDLOOP.
    But I'm unable to delete the selected rows, It is getting deleted the last rows eventhough I select the other row.
    So I thought of doing with respect to the field.

  • How to delete empty row without validation error in ADF Table(EMP)

    Hi Everyone,
    I am using EMP Table in ADF jspx page to insert the data into database.when i insert a row into table by createInsert operation,it inserting the row.But I need to delete that row immediately with out entering any value.
    But it showing some validation error at empno.Is there any ways to delete the empty row?if not,what are the reasons that we can't delete the row.
    could any one tell me the reasons!!
    Thanks in advance!!
    With Best Regards,
    Amar
    Edited by: 973755 on Dec 11, 2012 6:42 AM

    Amar,
    I am little confused with your logic here.....
    but if you are trying to remove the row by clicking Remove button, you can set the immediate property to true and that remove function will run without executing any entity validation.......
    -R

  • How to delete a row in Numbers on iPhone?

    I'm pulling my hair out on this one.  The "Help" for Numbers for iPhone both in-app and on the web states that to:
    Delete a row anywhere in the table: Tap the bar left of the row, then tap Delete.
    So here is what I see before I tap the bar left of the row:
    There is no bar left of the row unless I first tap into one of the cells.  Then, when I tap the bar left of the row, this is what I get:
    I see no "Delete" on which to tap.  Nor do I see "Hide" or "Insert", which, according the the Help, should also be available options once I've tapped that left side bar.  The only things I am able to do with the row are move it up or down, and change its height.
    Am I missing something, doing something wrong, or is this a bug in Numbers?  I'm on an iPhone 5s with auto app updates, so I have the latest version of Numbers.
    Thanks

    Hi Varcar,
    Usually when I tap the bar, as you did, I get a popup menu with some choices. Cut, Copy, Paste then an arrow taht I can then tap to reveal Delete, Hide, Chart. Have you tried to retap on the blue highlight on that bar? It might just want more attention.
    Quinn

Maybe you are looking for

  • Connecting to zon- fon free Internet

    I have been with Bt since bt openworld and recently had trouble with their router, well actually when it broke it was my router. Bt eventually supplied another one when I purchased another package. I don't really need another package as I don't use a

  • Exporting 29.97 FPS To Use In 25 FPS Project.

    I have a number of projects to mash together as one. Annoyingly, whereas 5 of the 6 sequences are 25fps, one of them is 29.97fps. I've exported the video to HDV25fps, and it plays fine using QT, but as soon as I drop it into FCP the video runs faster

  • Back ground run for Modal program

    HI friends, i need to do a background run for modal program (not a executable program) can somebody give your idea on how to. many thnaks iver.

  • PSE 7 System Requirements

    Hello I would like to know, if my computer IBM TP R50 Intel Pentium M Processor 1.5 GHz Centrino (Windows XP SP3) is capable of running PSE 7? Adobe System Requirements just says: Processor speed min. 2 GHz. I have tried to get a more detailed answer

  • Re. Is a 192kHz sample rate via TOSlink available on all current Mac's?

    I'm looking for a music server that will output audio at a sample rate of 192kHz via TOSlink (optical digital), the only device I'm aware of that supports 192kHz is the late 2013 MBPR. Could someone please tell me the sample rate of the TOSlink outpu