Home Answers Viewqa Java-Beginners jsp and bean problem

 
 


Boolaky Priya
jsp and bean problem
0 Answer(s)      2 years and 2 months ago
Posted in : Java Beginners

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 Pages:
Bean
Bean  i have this problem when i registry after that check the valid... visit the following links: http://www.roseindia.net/jsp/simple-jsp-example/UseBean.shtml http://www.roseindia.net/tutorial/java/jsp/usebean-setproperty.html
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
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
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 - Java Server Faces Questions
jsp problem  step by step processing of bean and forms processing in jsp
Java Bean
Java Bean  What is Java Bean?   I got my answer already here: http://www.roseindia.net/jsp/usingbeansinjsp.shtml Thanks a lot
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 problem - Java Server Faces Questions
jsp problem  where we have to save java bean classes in jsp?  If u are using the tag first u have to create java bean class...-application. the code like this //to set the java bean values // to get
bean object
bean object  i have to retrieve data from the database and want... in jsp page.   1)Bean.java: package form; import java.sql.*; import java.util.*; public class Bean { public List dataList(){ ArrayList list=new
saving form bean with Array of objects (collection) - Struts
thanks..:) I am facing problem to capture my array of objects(Order) in form bean... (action class)- populates my form bean 2.SaveAction.java (action class)- jsp... what user selected. Is there any problem with my JSP page? Am I missing any thing
javascript code problem - JSP-Servlet
; "> in above code which is jsp and struts form bean
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 bean get property
JSP bean get property   ... in JSP page. The JSP page uses bean get property and return the value stored... to locate and search an instance of the bean. Attributes used in <jsp
Compilation Error in Java Bean - Java Beginners
my problem... When I deploy the Jsp Application on weblogic application... >Jsp file >WEB-INF> classes>...; Parsing of JSP File '/myfirstjavabean.jsp' failed
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
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  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 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
Problem displaying resultset in jsp(no frameworks used) - JSP-Servlet
Problem displaying resultset in jsp(no frameworks used)  Problem... to display the bean elements within the arraylist within my JSP. Suppose if the resultset return 25 rows, these 25 records are to be displayed in my jsp. My problem
Java Bean Properties
Java Bean Properties  What are the properties of a normal java Bean(Not EJB)   HI Friend, Please visit here: http://www.roseindia.net/jsp/usingbeansinjsp.shtml Thanks
Java bean example in JSP
Java bean example in JSP     .... The next step is to create a JSP page. This JSP page uses My bean package . Let.... scope - This is used to specify that bean can be called in any jsp page
Input in Stateless Bean - EJB
Input in Stateless Bean  Hello, I am having problem in taking the input in stateless bean, when I am trying to get integer or double type input from the user in the client file, It shows me the error
Stateless Bean - EJB
Stateless Bean  Hi everybody, I m encountring a problem in stateless bean. I have taken a Integer type input in Client file, at the time of running the program it gives error java.lang.NumberFormatException : null. Please
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
how to Use jsp:setProperty to set one bean in other bean while to be set bean is of type java.util.List<beantype>
how to Use jsp:setProperty to set one bean in other bean while to be set bean...; private int numOfPages; // Getters and Setters I have a single jsp (a.jsp) containing input fields for all the 3 classes, and action of that jsp
JSP bean set property
JSP bean set property   ... you a code that help in describing an example from JSP bean set property...:useBean> -  The  < jsp:use Bean> instantiate a bean class
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
Using Bean Counter in JSP
Using Bean Counter in JSP       In this section you will learn how the counter bean can be used... bean with a jsp. Here is an example which explains the purpose.     Code
Jsp count and java bean - JSP-Servlet
Jsp count and java bean  Please am on a project and i want to create a countdown timer that will have this format HH:MM:SS. Am working with jsp and java beans please somebody help.  Hi Friend, Try the following
java bean code - EJB
java bean code  simple code for java beans  Hi Friend... the Presentation logic. Internally, a bean is just an instance of a class. Java Bean Code: public class EmployeeBean{ public int id; public
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
How to get the output of JSP program using Bean
visit the following link: http://www.roseindia.net/jsp/using-bean-counter.shtml...How to get the output of JSP program using Bean  Hi Kindly go...; <jsp:useBean id="counter" scope="session" class="CounterBean" /> <
how to create bean using jsp and servlet
how to create bean using jsp and servlet  public class SampleBean... the following links: http://www.roseindia.net/jsp/usingbeansinjsp.shtml http://www.roseindia.net/jsp/loginbean.shtml
How to get the output of jsp program using Bean
; Next i created JSP program for the above one by using Bean and i opened...How to get the output of jsp program using Bean  Hello my Roseindia..." %> <HTML> <HEAD> <TITLE>Use Bean Counter Example <
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
Assigning a value to JSP variable from a bean class. - JSP-Servlet
Assigning a value to JSP variable from a bean class.  Hi, I want to know how we can assign value to a JSP variable from a Java Bean. I am using Struts, JSTL. Which tags should I use to assign the value. e.g Kindly
Bean
Bean  what is bean? how to use bean   HTML Code: Contents MOBILE STORE HOME PRODUCTS IMAGES COMPANY BRANCHES DEALERS FEEDBACK       Username       Password
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
Hibernate code problem - Hibernate
(HQL_GET_USERS); }} -------------------------here is my DVO(bean... is my spring-servlet.xml----------------- .jsp
user Registration form using bean
user Registration form using bean   In this code,password and confirm password does n't matches.Every time an error occured if i entered same string for both.Please help to sort my problem
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
How to connect to dao n bean classes with jsp
How to connect to dao n bean classes with jsp  I have made this edao...()); System.out.println("Bean set"); stmt.executeUpdate... = totalvillagearea; } } **how to connect with this edao and ebean pkg with my jsp
jsp image problem - JSP-Servlet
jsp image problem  hi everyone, How to display multiple images from mysql database to jsp page. please help me
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.