Empty screen after executing servlet

Empty screen after executing servlet

View Answers

July 16, 2009 at 12:02 PM

Hi Friend,

Please send your Servlet code.

Thanks

April 10, 2012 at 12:24 PM

<form action="srv2"  method="post">
    Enter The Item  <input type="text"  name="all"> EX : TOMATO , CAPISCOM , TAMARING , BRINJAL , POTATO , VANKAYA , KAKARKAYA , POTLAKAYA<br>
    <input type="submit"  value="click">
</form>



//==========================================================


<web-app>
    <servlet>
    <servlet-name>Val</servlet-name>
    <servlet-class>TableData</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Val</servlet-name>
        <url-pattern>/srv2</url-pattern>
    </servlet-mapping>
</web-app>

//==========================================================



import java.io.IOException;
import java.sql.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


public class TableData  extends HttpServlet
{
    Connection con;
    Statement  st;
    public void init(ServletConfig sc)throws  ServletException
    {
        try
        {
        Class.forName("oracle.jdbc.driver.OracleDriver");
        con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","system","suresh");
        st=con.createStatement();
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
    }

    public void doPost(HttpServletRequest req ,HttpServletResponse res)throws  ServletException,IOException
    {
        try
        {
        res.setContentType("text/html");
        ServletOutputStream sos=res.getOutputStream();
        String val=req.getParameter("all");
        ResultSet rs=st.executeQuery("select * from vegitablepurchase  where  item='"+val+"' ");
        if(rs!=null)
        {
           while(rs.next())
            {
            sos.println(" "+rs.getString(1)+"  "+rs.getString(2)+"   "+rs.getString(3)+"  "+rs.getString(4)+" ");
            }
            rs.close();
        }
        else
        {
            sos.println("rs not executed  , please rectify the  error......");
        }

        }
        catch(Exception e)
        {
            System.out.println(e);
        }
    }

    public void destroy()
    {
        try
        {
            st.close();
            con.close();
        }
        catch(Exception e)
        {
            System.out.println(e);
        }

    }

}









Related Tutorials/Questions & Answers:
Empty screen after executing servlet - Development process
Empty screen after executing servlet  Hi, After executing servlet am getting blank screen. Am using weblogic server and Eclipse editor...)Locate war file and deployed 5)Then test , but am getting empty screen . Plz give
Printing the integers before and after - JSP-Servlet
Printing the integers before and after  Hi, I'm trying to print out the integers before and after generated random number, and also stating it as either even or odd, but it does not seem to work. Pls advise on my code below
Advertisements
ModuleNotFoundError: No module named 'executing'
command: pip install executing After the installation of executing...ModuleNotFoundError: No module named 'executing'  Hi, My Python... 'executing' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'executing'
command: pip install executing After the installation of executing...ModuleNotFoundError: No module named 'executing'  Hi, My Python... 'executing' How to remove the ModuleNotFoundError: No module named '
how to disable back button of a browser after logging in? - JSP-Servlet
how to disable back button of a browser after logging in?  how to disable back button of a browser after logging in?  where is the source code
Clear the print button after onclicking the print - JSP-Servlet
Clear the print button after onclicking the print  rate_print.document.writeln(" "); hai sir, this is my java script code, i ask how to clear the printbutton image when after onclicking the print button....  Hi
staying in same page after deliting arow in jsp page - JSP-Servlet
staying in same page after deliting arow in jsp page  Hello Sir, I want to stay back in current jsp page after deleting row in jsp table. how can i do this. need help from you. thanks, nandini  Hi friend
How to disable browser back after logout - JSP-Servlet
How to disable browser back after logout  Dear All I created JSP... data. I dont want to see my old visited pages after logout or expire the session. Anyone having idea how to disable browser back button after logout, please
How to revert back ServletInputStream object after reading once. - JSP-Servlet
How to revert back ServletInputStream object after reading once.  Hi.... My Q is how can I iterate request object twice? How we can revert back ServletInputStream object after reading once? Please Help me...... Thanks in advance
How to disable browser back after logout - JSP-Servlet
How to disable browser back after logout  thanks deepak, i tried but if i am clicking back still i can see my old pages. i copied your code in my logout page. please if you have any other solution, please give me
ModuleNotFoundError: No module named 'Empty'
install Empty After the installation of Empty python library...ModuleNotFoundError: No module named 'Empty'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Empty
ModuleNotFoundError: No module named 'Empty'
install Empty After the installation of Empty python library...ModuleNotFoundError: No module named 'Empty'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'Empty
while executing a java program
while executing a java program  while iam executing a simple java program after i type "java simple.java" there was a an error occuring.the error is "exception in thread "main" java.lang.noclassdeffounderror:simple" what thus
Screen Capture
Screen Capture  How to capture the screen using jsps and servlets
Screen shot
Screen shot  webpage screenshot source code
Empty Elements in HTML
Empty Elements in HTML  What is Empty Elements in HTML
splash screen
splash screen  What is splash screen and how can i set splash screen in iphone??   hello, if you want to launch splash screen then add... splash screen will show launching time.. ADS_TO_REPLACE_1
Mantain a Session in one application after opening another third party application - JSP-Servlet
Mantain a Session in one application after opening another third party application  Hi My Requirements is like this.. I have one ear... or time out or expires in the Third Party Application. We can write a servlet
Screen Capture
Screen Capture  Hi deepak, I am trying to take a screen shot using java script Activex object. But Iam getting Automation server cant create object exception .how can i solve
ModuleNotFoundError: No module named 'empty_nester'
with following command: pip install empty_nester After the installation...ModuleNotFoundError: No module named 'empty_nester'  Hi, My Python... 'empty_nester' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'empty_nester'
with following command: pip install empty_nester After the installation...ModuleNotFoundError: No module named 'empty_nester'  Hi, My Python... 'empty_nester' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'empty_nester'
with following command: pip install empty_nester After the installation...ModuleNotFoundError: No module named 'empty_nester'  Hi, My Python... 'empty_nester' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'screen'
: pip install screen After the installation of screen python library...ModuleNotFoundError: No module named 'screen'  Hi, My Python... 'screen' How to remove the ModuleNotFoundError: No module named 'screen'
please give me solution how to display next page after 20 records ? - JSP-Servlet
please give me solution how to display next page after 20 records ?  Java Servlet Paging control example  here i have attached one example code. function validate() { for(j=0;j<30;j
create a named screen in linux
create a named screen in linux  Hi, I want to create a screen session with a name. I wanto to assign a name while creating screen. So, need help of your guys to tell me the command. How to create a named screen in linux
executing Hibernate application
executing Hibernate application  when i am executing the hibernate application the following error occured. log4j:WARN No appenders could be found for logger (org.hibernate.cfg.Environment). /hibernate.cfg.xml not found log4j
ERRor in executing DB program
ERRor in executing DB program  While executing following code an Error was generated.can any one help me for this. LiveDB liveDBObj = DataSourceFactory.getLiveDBInstance(); PreparedStatement pstmt=null; String qry=""; qry
how to get a column values from a excel file after attaching it - JSP-Servlet
how to get a column values from a excel file after attaching it  hi sir, How to get a column values from a excel file after attaching it while sending a email,while sending a email if i attached a file that should be read
non empty file
Java Delete non empty file  f.delete() works when the file is empty.if a file be non empty how to delete it???   Please visit the following link: http://www.roseindia.net/tutorial/java/core/files
My Servlet code not working - Development process
My Servlet code not working  HHi, After executing servlet am getting blank screen. Am using weblogic server and Eclipse editor. But jsp is working... and deployed 5)Then test , but am getting empty screen . Plz give me solution Thanks
Screen flashing
Screen flashing  Hey I am trying to make my screen flash (like a white flash as if from a camera). This is my code so far: <html> <... I want is that I want the screen to flash white when a link is clicked. Thanks
Problem in executing query....
Problem in executing query....  Suppose there is a textbox or a text area and the user is supposed to enter any text.Suppose the user enters his text and his text contains a '(inverted comma) somewhere in his text.I fetch
difference between touch screen and non touch screen
difference between touch screen and non touch screen  what is a difference between touch screen and non touch screen in J2ME (code wise
difference between touch screen and non touch screen
difference between touch screen and non touch screen  code wise ,what is a difference between touch screen and non touch screen in J2ME
Screen Flickers - Framework
Screen Flickers  One of my screen flickers. Is that is beacuse of less memory
Caputuring screen shot
Caputuring screen shot  How to to capture screen shot for a computer on internet
ModuleNotFoundError: No module named 'empty-trash-can-LARBIZARD'
install empty-trash-can-LARBIZARD After the installation of empty-trash...ModuleNotFoundError: No module named 'empty-trash-can-LARBIZARD'  Hi...: No module named 'empty-trash-can-LARBIZARD' How to remove
ModuleNotFoundError: No module named 'empty-trash-can-LARBIZARD'
install empty-trash-can-LARBIZARD After the installation of empty-trash...ModuleNotFoundError: No module named 'empty-trash-can-LARBIZARD'  Hi...: No module named 'empty-trash-can-LARBIZARD' How to remove
ModuleNotFoundError: No module named 'git-empty-dirs'
python with following command: pip install git-empty-dirs After...ModuleNotFoundError: No module named 'git-empty-dirs'  Hi, My... named 'git-empty-dirs' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'git-empty-dirs'
python with following command: pip install git-empty-dirs After...ModuleNotFoundError: No module named 'git-empty-dirs'  Hi, My... named 'git-empty-dirs' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'max-empty-rect-py'
After the installation of max-empty-rect-py python library, ModuleNotFoundError...ModuleNotFoundError: No module named 'max-empty-rect-py'  Hi, My... named 'max-empty-rect-py' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'odoo12-addon-pos-empty-home'
: pip install odoo12-addon-pos-empty-home After the installation...ModuleNotFoundError: No module named 'odoo12-addon-pos-empty-home'  ...: No module named 'odoo12-addon-pos-empty-home' How to remove
ModuleNotFoundError: No module named 'odoo9-addon-pos-empty-home'
: pip install odoo9-addon-pos-empty-home After the installation...ModuleNotFoundError: No module named 'odoo9-addon-pos-empty-home'  Hi...: No module named 'odoo9-addon-pos-empty-home' How to remove
ModuleNotFoundError: No module named 'se-django-empty'
python with following command: pip install se-django-empty After...ModuleNotFoundError: No module named 'se-django-empty'  Hi, My... named 'se-django-empty' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'aws-empty-bucket'
-bucket python with following command: pip install aws-empty-bucket After...ModuleNotFoundError: No module named 'aws-empty-bucket'  Hi, My... named 'aws-empty-bucket' How to remove the ModuleNotFoundError: No module
ModuleNotFoundError: No module named 'aws-empty-ecr-repository'
install aws-empty-ecr-repository After the installation of aws-empty-ecr...ModuleNotFoundError: No module named 'aws-empty-ecr-repository'  Hi...: No module named 'aws-empty-ecr-repository' How to remove
ModuleNotFoundError: No module named 'empty-trash-can-LARBIZARD'
install empty-trash-can-LARBIZARD After the installation of empty-trash...ModuleNotFoundError: No module named 'empty-trash-can-LARBIZARD'  Hi...: No module named 'empty-trash-can-LARBIZARD' How to remove
ModuleNotFoundError: No module named 'git-empty-dirs'
python with following command: pip install git-empty-dirs After...ModuleNotFoundError: No module named 'git-empty-dirs'  Hi, My... named 'git-empty-dirs' How to remove the ModuleNotFoundError: No module named
ModuleNotFoundError: No module named 'idealab-empty-project'
-empty-project After the installation of idealab-empty-project python...ModuleNotFoundError: No module named 'idealab-empty-project'  Hi...: No module named 'idealab-empty-project' How to remove the ModuleNotFoundError
python if none then empty string
python if none then empty string  Hi, I have a Python program that reads the data from a web service and parse the data. My program parse the json data and get the values from it by providing the key. For example example I am

Ads