jsp and bean problem

jsp and bean problem

Hi i have the following jsp code... Can you plz help me in separating the code to bean? I'm new to bean and need it for my project...Plz help...Its quite urgent... Regards Priya

<%@ page import="java.sql.*" %> 
<%@ page import="java.io.*" %> 


<head>
<link rel="stylesheet" type="text/css" href="cintel.css">
<title>Category1</title>
</head>

<body>
<%

try {
String connectionURL = "jdbc:mysql://200.0.0.153:3306/snms"; 
Connection connection = null;
ResultSet rs=null;
ResultSet rs1=null;
Statement statement=null;
// Load JBBC driver "com.mysql.jdbc.Driver". 
Class.forName("com.mysql.jdbc.Driver").newInstance(); 
connection = DriverManager.getConnection(connectionURL, "root", "root");
int updateQuery = 0;

//Connection con=null;

// check weather connection is established or not by isClosed() method 
//if(!connection.isClosed())
statement = connection.createStatement();

          // sql query to retrieve values from the secified table.
          //rs = statement.executeQuery(QueryString);



int v_TS     = 1;


String v_RGPC;         
String v_CETR;         
String v_DR;           
String v_CS;           
String v_CP;           
String v_TOp;          
String v_Ddeb;         
String v_COEIE;        
String v_CAtt;         
String v_IDAtt;        
String v_NI;           
String v_UP;           
String v_Centre;       
String v_CodeO;        
String v_CGest;        
String v_TEq;          
String v_Dfin;         
String v_Zone;         
String v_CTrx;         
String v_NChan;        
String v_Code;         
String v_QtL;          
String v_Large;        
String v_Haut;         
String v_Des;          
String v_Maj;          
String v_Qt;           
String v_Cout;         
String v_Tot; 
String v_codeProduit;

%>

<form method="post" action="insertdata.jsp">
<h2>Saisie Attachement</h2>
<table width="1300">
    <tr>
    <th colspan="2" scope="col">Attachement Sur l'OT/L'OEIE: ATT_GDP_01</th>
    <th colspan="3" scope="col">Etat1</th>
    <th colspan="3" scope="col">Flux</th>
  </tr>

  <tr>
    <th width="242" scope="row">Type de Situation</th>
    <td colspan="4">
    <select name="selSit"><option value=""><---Select---></option>
    <%
    PreparedStatement psmnt = connection.prepareStatement("select * from xx_situation ");
    ResultSet results = psmnt.executeQuery();
    while(results.next()){
        String name = results.getInt(1)+" "+results.getString(2);
        int id = results.getInt(1);%>
        <option value="<%= name %>">
        <% out.println(name); %>
        </option>
        <%} results.close(); psmnt.close(); %>
        </select>
    <%String option=request.getParameter("selSit");
        if(option==null){
        }
        else{%>
        <input type="text" name = "txtTS"value="<%=option%>">
        <%
        }
        %>   
  </td>
  </tr>

  <%
  String QueryString = "SELECT co.codebase,co.codeproduit,co.agentetl,co.CommentaireADO,co.numint,co.refot,cm.libellecommutateur,ui.codeui,zi.LibelleZoneIntervention FROM code_ot co,commutateur cm, ui,Zone_intervention zi ,Equipement eq WHERE cm.equipementid=co.codere AND ui.uiid=co.uiid AND co.codere = eq.equipementid AND zi.Zone_InterventionID = eq.Zone_InterventionID AND co.code_codeot=12";
  rs = statement.executeQuery(QueryString);

    while (rs.next()) {


        v_RGPC   = rs.getString("codebase");
        v_CETR   = rs.getString("agentetl");
        v_codeProduit = rs.getString("codeproduit");

        if (v_codeProduit == "FTH")
        {
        v_DR     = "RF";
        }
        else
        {
        v_DR ="L";
        }

        if (rs.getString("CommentaireADO")==null)
        {
        v_CS     = "";
        }
        else
        {
        v_CS     =rs.getString("CommentaireADO").substring(2, 5);
        }

        v_CP     = "";//A saisir
        v_TOp    = "";//DCA ou DGC. Comment determiner laquelle des 2 valeurs?
        v_Ddeb   = "";//rs.getString(2);

        if (rs.getString("CommentaireADO")==null)
        {
        v_CodeO     = "";
        }
        else
        {
        v_CodeO     =rs.getString("CommentaireADO").substring(5, 11);
        }

        v_COEIE     = "";//A saisir
        v_CAtt   = "";//A saisir
        v_IDAtt  = "";//??
        v_NI     = rs.getString("NUMINT");
        v_UP     = "";//A saisir
        v_Centre = rs.getString("libellecommutateur");//rs.getString(63);
        v_CGest  = "";//"Y a t'il une aide a la saisie (Code -> libelle)Je me renseigne sur cette partie."

        if (v_codeProduit == "FTH")
        {
        v_TEq     = "D";
        }
        else
        {
        v_TEq ="CU";
        }

        v_Dfin   = "";//rs.getString(2);

        v_Zone   = "";//rs.getString(2);

        if (rs.getString("CommentaireADO")==null)
        {
        v_CTrx     = "";
        }
        else
        {
        v_CTrx     =rs.getString("CommentaireADO").substring(12, 16);
        }

        v_NChan  = "";//rs.getString(2);
        v_Code   = "";//rs.getString(2);
        v_QtL    = "";//rs.getString(2);
        v_Large  = "";//rs.getString(2);
        v_Haut   = "";//rs.getString(2);
        v_Des    = "";//rs.getString(2);
        v_Maj    = "";//rs.getString(2);
        v_Qt     = "";//rs.getString(2);
        v_Cout   = "";//rs.getString(2);
        v_Tot    = "";//rs.getString(2);

    %>
  <tr>
    <th scope="row">Reference GPC</th>
    <td width="150"><input type="text" name="txtRGPC" value="<%=v_RGPC%>"/>
      </td>
    <th width="189">Numint</th>
    <td width="151"><input type="text" name="txtNI" value="<%=v_NI%>"/></td>
  </tr>
  <tr>
    <th scope="row">Code ETR</th>
    <td><input type="text" name="txtCETR" value="<%=v_CETR%>"/></td>
    <th>Unite de Production</th>
    <td><input type="text" name="txtUP" value="<%=v_UP%>"/></td>
  </tr>
  <tr>
    <th scope="row">Domaine Reseau</th>
    <td><input type="text" name="txtDR" value="<%=v_DR%>"/></td>
    <th>Centre</th>
    <td><input type="text" name="txtCentre" value="<%=v_Centre %>"/></td>
    <th width="133">Zone</th>
    <td width="146"><input type="text" name="txtZone" value="<%=v_Zone%>"/></td>
  </tr>
  <tr>
    <th scope="row">Code Secteur</th>
    <td><input type="text" name="txtCS" value="<%=v_CS%>"/></td>
    <th>Code OEIE</th>
    <td><input type="text" name="txtCodeO" value="<%=v_CodeO%>"/></td>
    <th>Famille Cat de Tvx</th>
    <td><input type="text" name="txtCTrx" value="<%=v_CTrx%>"/></td>
    <th width="94">No Chantier</th>
    <td width="159"><input type="text" name="txtNChan" value="<%=v_NChan%>"/></td>
  </tr>
  <tr>
    <th scope="row">Code Prometee</th>
    <td><input type="text" name="txtCP" value="<%=v_CP%>"/></td>
    <th>Code de Ch de Gestion</th>
    <td><input type="text" name="txtCGest" value="<%=v_CGest%>"/></td>
  </tr>
  <tr>
    <th scope="row">Type d'Operation</th>
    <td><input type="text" name="txtTOp" value="<%=v_TOp%>"/></td>
    <th>Type d'Equipement</th>
    <td><input type="text" name="txtTEq" value="<%=v_TEq%>"/></td>
  </tr>
  <tr>
    <th scope="row">Date de Debut</th>
    <td><input type="text" name="txtDdeb" value="<%=v_Ddeb%>"/></td>
    <th>Date de Fin</th>
    <td><input type="text" name="txtDfin" value="<%=v_Dfin%>"/></td>
  </tr>
  <tr>
    <th scope="row">Commentaire de l'OEIE</th>
    <td colspan="2"><input type="text" name="txtCOEIE" size="57" value="<%=v_COEIE%>"/></td>
  </tr>
  <tr>
    <th scope="row">Commentaire de l'Attelem</th>
    <td colspan="2"><input type="text" name="txtCAtt" size="57" value="<%=v_CAtt%>"/></td>
  </tr>
  <tr>
    <th scope="row">Indicateur du dernier Attelem</th>
    <td><input type="text" name="txtIDAtt" value="<%=v_IDAtt%>"/></td>
  </tr>
  <tr></tr>
<tr></tr>
</table>
<br>
  <table width="1300">
  <tr>
    <th colspan="8" scope="col">Saisie de Code de travaux et/ou materiels associes</th>
   </tr>
   <tr>

   </tr>
   <tr>
   <th>Code</th>
   <td><input type="text" name="txtCode"/></td>
   <th>Qt/Long</th>
   <td><input type="text" name="txtQtL"/></td>
   <th>Large</th>
   <td><input type="text" name="txtLarge"/></td>
   <th>Haut</th>
   <td><input type="text" name="txtHaut"/></td>
   </tr>
   <tr>
     <td colspan="8" rowspan="2">Lignes ASP et Materiel</td>
   </tr>
</table>
  <br>
  <table width="1300">
  <tr>
    <th colspan="10">Saisie de lignes des factures</th>
   </tr>
    <tr>
     <td colspan="10"> </td>
   </tr>
   <tr>
   <th>Designation</th>
   <td><input type="text" name="txtDes"/></td>
   <th>Maj</th>
   <td><input type="text" name="txtMaj"/></td>
   <th>Qt</th>
   <td><input type="text" name="txtQt"/></td>
   <th>Cout</th>
   <td><input type="text" name="txtCout"/></td>
   <th>Total</th>
   <td><input type="text" name="txtTot"/></td>
   </tr>
   <tr>
     <td colspan="10"> </td>
   </tr>
   <tr>
     <td colspan="3.9"><input type="submit" name="btnsub"></td>
     <td colspan="3.9"> </td>
     <td colspan="4"> </td>
   </tr>
  </table>
  <%   }    
  // close all the connections.
    rs.close();
    statement.close();
%>

</form>
<%connection.close();
}
catch (Exception ex) {
            out.println("Error :" + ex);


            }
%>
</body>
</html>

Plz help me else i'll fail my project...Thx a lot

View Answers









Related Tutorials/Questions & Answers:
jsp and bean problem
jsp and bean problem  Hi i have the following jsp code... Can you plz help me in separating the code to bean? I'm new to bean and need it for my project...Plz help...Its quite urgent... Regards Priya <%@ page import
How to get Output for a Bean problem
How to get Output for a Bean problem  Hello Kindly tell me a simple Program on Bean to get the Output using JSP code
Advertisements
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..." action="http://localhost:8080/examples/jsp/insertdata.jsp"> <table> <
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..." action="http://localhost:8080/examples/jsp/insertdata.jsp"> <table> <
Problem in jsp.
Problem in jsp.  hello friends, I have a problem in jsp.I want to insert data, which is given by user through a html page into a table.And the table..." action="http://localhost:8080/examples/jsp/insertdata.jsp"> <table> <
Jsp problem
Jsp problem  Hello friends.I want to share my jsp problem.I want to show all of my database(mysql) tables except two(user,manufacturer) in a jsp page.plssss help me
jsp problem
jsp problem  problem:::::::: On JSP form ,when i insert data in text field........at that time action is perform and data is retriev from data base and get assign to other field on that form........ when data is assign to other
jsp problem
jsp problem  Hello Friends, I want to show one page for 5 seconds and after that i want to redirect the page to another URL
jsp problem
jsp problem  Hi every one plz give me answer for below question ASAP I created one JSP(used pre defined javascript in jsp to get rtf format in browser) which creats RTF Format in browser to enter data. MY question is after i
JSP Problem - JSP-Servlet
JSP Problem  Hi, I have problem,this is my senario I have one jsp,this jsp having the 3 fields.let me take 3fields userName,emailAddress... for more information, http://www.roseindia.net/jsp Thanks
bean - JSP-Interview Questions
bean  what is use bean in jsp?  Hi Friend, Please visit the following links: http://www.roseindia.net/jsp/using-bean-counter.shtml http://www.roseindia.net/jsp/java-bean-example-jsp.shtml Hope
jsp problem - JSP-Servlet
jsp problem  here is a code for Retrieving image from mysql database through jsp. but i cann't set size of image when it was display so what should... working but my problem is size of image. so can u just help?? code
jsp problem - JSP-Servlet
jsp problem  here is a code for Retrieving image from mysql database through jsp. but i cann't set size of image when it was display so what should... working but my problem is size of image. so can u just help?? code
jsp usebean problem - Struts
popupwindow jsp below code run.. ...here iam getting the problem..in the below... bean class... first of all i didn't put jsp:usebean..it didn't access the dto(bean...jsp usebean problem   --Select
jsp problem - JSP-Servlet
jsp problem  hi, i am working on a project of developing a shopping cart for online book store.can it be done using jsp?if yes, can u please help me doing so?  Hi Friend, Please visit the following link: http
problem in jsp programming - JSP-Servlet
problem in jsp programming  Write a JSP program which displays a webpage containing arrival of new items within a particular month in the different... in solving the problem : Connection with mysql database
problem in programming - JSP-Servlet
problem in programming  Hi! I am new with jsp. I am facing a problem in programming to calculate the time interval between login time and logout time of user
jsp code problem - JSP-Servlet
jsp code problem  Hi, I have employee details form in jsp. After... have a problem with open the next form. plz, help me. thanks,  Hi.... http://www.roseindia.net/jsp/ Thanks
Session Problem in JSP - JSP-Servlet
Session Problem in JSP  I have developed a online feedback form in JSP platform. I have created normal session in JSP page. It is running in my... normally from Remote machine by only writing JSP code.  Hi friend
login problem in java bean - Java Beginners
login problem in java bean  login.jsp no longer redirects to the appropirate page. my bean code is correct and while seeing in error logs... immediately  Hi friend, Please give in details of problem
jsp reload current page problem
jsp reload current page problem  Hi, i am facing problem while reloading the JSP page
jsp reload current page problem
jsp reload current page problem  Hi, i am facing problem while reloading the JSP page
logout problem?? - JSP-Servlet
logout problem??  sir, the logout code which u have send is not the proper solution coz,by using this code the browser get closed which shuold.../Logout.shtml http://www.roseindia.net/jsp/loginstatus.shtml Thanks
jsp image problem - JSP-Servlet
jsp image problem  hi everyone, How to display multiple images from mysql database to jsp page. please help me
logout problem.. - JSP-Servlet
logout problem..  hi... first of all thanks for ur... but their is some problem with the the logout,i m not able to logout when... done in the code i have used session object in project's servlet and jsp
coding problem - JSP-Servlet
coding problem  dear sir i m very new to JSP sir i m getting problem in dynamically changing the option of combobox from database(ms acess) .and after that option being selected for that the record from the databse should
JSP code problem - JSP-Servlet
JSP code problem  Hi friends, I used the following code...: <% //to get the content type information from JSP... of: Please can somebody rectify this problem........  
jsp problem - Java Server Faces Questions
jsp problem  step by step processing of bean and forms processing in jsp
Jsp Code Problem - JSP-Servlet
Jsp Code Problem  I use DocType in my Jsp Page. The Links are not functioned after Applying the DocType. Could you tell me any way to activate the link. Thank You.   Hi Friend, Please send your code. Thanks
JSP code problem - JSP-Servlet
JSP code problem  HI.. I have a DB2 stored procedure wich return a result set. I have made a report basing on this procedure using Crystal Reports. How to pass parameters to this procedure with java code in a JSP page
jsp code problem - JSP-Servlet
jsp code problem  i want to make the bill from the barcode. how do i convert a barcode into a decimal number
Jsp ,Servlet Problem - JSP-Servlet
Jsp ,Servlet Problem  hi, m new to jsp n Servlet. i really find ur tricks very effective.Last time u had helped me to connect my java program with oracle. it worked wonders. now i m starting jsp n servlet learning.. pls
Java Problem - JSP-Servlet
Java Problem  How to run a Simple JSP program ? what steps... the webapps folder of apache tomcat. 5)Create a jsp file 'hello.jsp'.You can put your jsp file either inside the web application folder along with WEB-INF or you
jsp code problem - JSP-Servlet
jsp code problem  hi, I am going to execute the following code which has been given your jsp tutorial. retrive_image.jsp: but while I...) org.apache.jsp.retriveimage_jsp._jspService(retriveimage_jsp.java:115
Radio Button Problem in jsp.
Radio Button Problem in jsp.  I have a small doubt in my application, my requirement is to get a "single selectible row", I generated a radio button... radio button values from jsp to action using javascript
tomcat problem - JSP-Servlet
perfectly. Kindly let me know what is the problem at an earliest. Thanking... found your problem.. http://www.roseindia.net/web-application-server/tomcat
coding problem - JSP-Servlet
coding problem  dear sir will u plz tell me how can we delete a record from the database(MSaccess) when option in the combobox is selected(jsp)  If u want to delete the record from database, by seleting
Statistical charts in JSP - problem
Statistical charts in JSP - problem  hey! i get this error when i run... to compile class for JSP: An error occurred at line: 9 in the generated.... org.jfree.data.jdbc.JDBCCategoryDataset resolves to a package An error occurred at line: 11 in the jsp
Jsp include page problem
Jsp include page problem  I have included footer.jsp in all my pages. It is working in all pages except search.jsp. In search.jsp (Old footer.jsp content is displayed ) How can I rectify this?   Hi, You have to delete
resultset problem - JSP-Servlet
resultset problem  hi I have one problem with resultset? ResultSet rs=st.execute("select subjname,staffname from staffdetails"); while(rs.next()) { st.executeUpdate("update CSEFIRSTYEARTIMETABLE set p2
coding problem - JSP-Servlet
coding problem  Dear sir i m very new to JSP .I am using two conbobox .if any option is selected in first combobox then only its data from the database should be displayed in other combobox, means how can we refresh
JSP run problem
JSP run problem  type Exception report message description... this request. exception org.apache.jasper.JasperException: Exception in JSP...) root cause java.lang.NullPointerException org.apache.jsp.bb_jsp
Array problem - JSP-Servlet
.. Bur my problem is that if the pop up window contains only 1 record
Problem in inserting clob data in jsp
Problem in inserting clob data in jsp  how to insert any rich text editor data (which have more than 32766 characters) in a clob type column of oracle database with jsp
PROBLEM IN ACCESSING JSTL - JSP-Servlet
PROBLEM IN ACCESSING JSTL   hii i m vikram ... i am using jsp application with tomcat 4.1 .and i want to use JSTL in my jsp page ...so how can i use JSTL in my page .. and i install jakaerta-taglibs-standard-1.1.2 in directory
pagination problem - JSP-Servlet
(),my problem is that where i have to put & how to do pagination? my code
pagination problem - JSP-Servlet
(),my problem is that where i have to put & how to do pagination? my code
arraylist problem - JSP-Servlet
arraylist problem  hello thanx a lot for ur reply. i m sending u my code once again only in which i m facing the problem. /* * To change this template, choose Tools | Templates * and open the template in the editor
arraylist problem - JSP-Servlet
. It would be good for me to provide you the solution if problem is clear. Thanks
JSP bean get property
JSP bean get property   ... in JSP page. The JSP page uses bean get property and return the value stored... package. class is used to give the reference of the bean class. <jsp

Ads