logic-iterate

logic-iterate

in my code i am using for-each loop for displaying data i want use tag to display data how to use plase help me

<%@ page import="java.sql.*" %>
 <%String[] id = (String[])session.getAttribute("ids"); %>
<%try{ %>
<% Class.forName("oracle.jdbc.driver.OracleDriver"); %>
<HTML>
    <head>

    </head>
       <BODY BGCOLOR="baba21">
    <table>   
    <tr>
    <th><h4>UserName:<%=session.getAttribute("username")%></h4></th>
    <th align="right"colspan="200"><a href="logout.jsp">Logout</a></th>
    </tr>
    </table>
       <H1 align="center">MyCart</H1>
      <form action="logout.jsp">
      <%!
      Connection connection=null;
       %>

       <%     

            connection = DriverManager.getConnection(
            "jdbc:oracle:thin:@localhost:1521:xe","bms","abc");
            Statement statement = connection.createStatement() ;
         %>

      <TABLE BORDER="1"align="center">
       <TR>
      <TH>Selected Books</TH>
      </TR>
      <%
        for(String i : id){
        ResultSet rs = statement.executeQuery("select * from books where bookname='"+i+"'") ;
      %>
      <% while(rs.next()){%>
      <TR>
      <td><%=rs.getString(1)%></td>
      </TR>
      <% } } %>
      <%}catch(Exception e){ } %>
      </TABLE>
      <%
      try{
      String name=(String)session.getAttribute("username");
      for(String i : id){
      PreparedStatement ps=connection.prepareStatement("insert into buy values(?,?)");
      ps.setString(1,name);
      ps.setString(2,i);
      ps.executeUpdate();
      }
      }
      catch(Exception se){ }
       %>
      </form>
     </BODY>
</HTML>
View Answers

Ads









Related Tutorials/Questions & Answers:
Logic Iterate.
Logic Iterate.  I have one doubt about logic:iterate. I use text feild inside of logic:iterate , there is possible will generate N no of rows (text feild) inside of iterate. my doubt is how to get the Paritcular rows text
Logic Iterate.
Logic Iterate.  logic iterate Struts I have one doubt about logic:iterate. I use text field inside of logic:iterate , there is possible... the Particular rows text value. for example: print("<logic:iterate id="xid
Advertisements
Struts logic iterate
; <body> <h1> Search </h1> <logic:iterate name...;tr> <td align="center"> <logic:iterate name="listMs...Struts logic iterate  This is my jsp page in which i used 3 logic
logic-iterate
logic-iterate  in my code i am using for-each loop for displaying data i want use tag to display data how to use plase help me <%@ page import="java.sql.*" %> <%String[] id = (String[])session.getAttribute("ids
How to handle the list dynamically in struts inside logic:iterate tag
How to handle the list dynamically in struts inside logic:iterate tag  I am having following code in JSP <table> <tr> <logic:iterate name="loginForm" id="inutParams" property="inutParams" indexId="i"> <
i want to know how a slide will hide
i want to know how a slide will hide  when im click on the button then im getting a slide, but when im click on the another button this slide will be hide.. and here im using logic iterate to getting the values from action class
i want to know how a slide will hide
i want to know how a slide will hide  when im click on the button then im getting a slide, but when im click on the another button this slide will be hide.. and here im using logic iterate to getting the values from action class
please tell anybody how can i set a value in hiperlink for edit n delete link
please tell anybody how can i set a value in hiperlink for edit n delete link  <logic:present name="allRecords"> <logic:notEmpty name="allRecords"> <logic:iterate id="user" name
jsp page to Showuser details
;Last Name</b></td> </tr> <logic:iterate id..." prefix="logic" %> <%@page contentType="text/html" pageEncoding="UTF-8"%>...; </tr> </logic:iterate> <tr>
Struts iteraor
;%@taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%> <html>...;body> <h1> Search </h1> <table> <tbody> <logic:iterate name="listMsg" id="listMsgId"> <tr> <bean:write name
jsp pages for dispatchaction for adding user to database
;b>Last Name</b></td> </tr> <logic:iterate...-logic.tld" prefix="logic" %> <%@page contentType="text/html" pageEncoding="UTF-8...;/td> </tr> </logic:iterate> <tr>
struts validation
="multipleselect"> <logic:iterate id...; <logic:iterate id="statusMasterBe...="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <
struts validation
="multipleselect"> <logic:iterate id...; <logic:iterate id="statusMasterBe...="html" %> <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %> <
How to pass Array of string from action class to jsp page
;logic:iterate name="print" id="print" indexId="i"> <tr>...://struts.apache.org/tags-logic" prefix="logic" %> Institute of Preventive...;/logic:iterate> </table> <% String[] str = (String
how can i hide and show tables
; <logic:present name="list"> <logic:iterate id...="totZoneRecord"> <logic:iterate id="ZoneRecord" name="totZoneRecord...; <logic:iterate id="TerritoryRecord" name="listTerr">
fetch database value to text box based on selected value my code given below pls correct my code
(){ <logic:notEmpty name="form" property="arrPriceLis"> <logic:iterate...; <%@taglib uri="WEB-INF/struts-logic.tld" prefix="logic" %> <html...= 'pricelist' property= 'priceList' />"; </logic:iterate> <
fetch database value to text box based on selected value my code given below pls correct my code
; <%@taglib uri="WEB-INF/struts-logic.tld" prefix="logic" %> <html...(){ <logic:notEmpty name="form" property="arrPriceLis"> <logic:iterate name="form" property="arrPriceLis" id="priceList "> destArray ["<
use struts 1.0 to view sql table value on JSP page
/tags-logic" prefix="logic"%> <logic:iterate name..."/> </fieldset> </logic:iterate> <
use struts 1.0 to view sql table value on JSP page
/tags-logic" prefix="logic"%> <logic:iterate name..."/> </fieldset> </logic:iterate> <

Ads