Not to sound rude but where do I start with this.  You have variable
that are incorrectly scoped.  Your code is very hard to follow.  I
would suggest that you buy Core Servlets and visit the New to Java at

http://developer.java.sun.com/developer/onlineTraining/new2java/

and while your at it visit the Coding Conventions available at

http://java.sun.com/docs/codeconv/html/CodeConvTOC.doc.html

----- Original Message -----
From: Anita Lopez <[EMAIL PROTECTED]>
Date: Sunday, March 25, 2001 9:30 am
Subject: Non display of data!!!

> Hi all,
> I'm just a beginner and learning that's why i am  mailing a code which
> is getting connected to servlet but not displaying anything.
> i am using msaccess insertion
> plz let me know as to what is wrong.
> Thanks in advance,
> Anita.
>
>
>
> import javax.servlet.*;
> import javax.servlet.http.*;
> import java.io.*;
> import java.sql.*;
> public class hospital_servletJdbc extends HttpServlet
> {
> Statement smt;
> Connection con1;
>        public void doGet(HttpServletRequest
> req,HttpServletResponse res)throws
> ServletException,IOException
>        {
>        doPost(req,res);
>        }
>        public void init(ServletConfig con)
>        {
>        try
>        {
>        super.init(con);
>        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
>
> con1=DriverManager.getConnection("jdbc:odbc:hos","","");
>        //smt=con1.createStatement();
>        }
>        catch(Exception e)
>        {}
>        }
>
>        public  void doPost(HttpServletRequest
> req,HttpServletResponse res)throws
> ServletException,IOException
>        {
>        try
>        {
>        res.setContentType("Text3/html");
>        PrintWriter pw=res.getWriter();
>
>        String str1=req.getParameter("hospitalname");
>        String str2=req.getParameter("category");
>        String str3=req.getParameter("autho_person");
>        String str4=req.getParameter("regis_date");
>        String str5=req.getParameter("timings");
>        String str6=req.getParameter("add1");
>        String str7=req.getParameter("add2");
>        String str8=req.getParameter("add3");
>        String str9=req.getParameter("city");
>        String str10=req.getParameter("city1");
>        String str11=req.getParameter("state");
>        String str12=req.getParameter("pin");
>        String str13=req.getParameter("phone");
>        String str14=req.getParameter("fax_no");
>        String str15=req.getParameter("email");
>        String str16=req.getParameter("linkpage");
>        String str17=req.getParameter("no_beds");
>        String str18=req.getParameter("facilites");
>
>
>
>        smt=con1.createStatement();
>        String sqlstr1="insert into hospital1 values
>
>
('"+str1+"','"+str2+"','"+str3+"','"+str4+"','"+str5+"','"+str6+"','"+st
r7+"','"+str8+"','"+str9+"','"+str10+"','"+str11+"','"+str12+"','"+str13
+"','"+str14+"','"+str15+"','"+str16+"','"+str17+"','"+str18+"')";
>
>        int i=smt.executeUpdate(sqlstr1);
>
>        pw.println("<html><body>");
>        pw.println(" thanx for using our site<br>");
>        pw.println("</body></html>");
>        pw.close();
>        }
>        catch(Exception e)
>        {
>        }
>        }
> }
>
>
________________________________________________________________________
___
> To unsubscribe, send email to [EMAIL PROTECTED] and include in
> the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http:
> Resources: http://java.sun.com/products/servlet/external-
> resources.htmlLISTSERV Help:
> http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to