Home Answers Viewqa Development-process Empty screen after executing servlet

 
 


Rajendra
Empty screen after executing servlet
2 Answer(s)      3 years and 10 months ago
Posted in : Development process

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 Pages:
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
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
Array Empty
Array Empty      ... to understand in an Array Empty. For this example we are using Java Scripting... document. write print an Array is empty. An array object hold the various element
problem with executing JSF file(Build failed)
problem with executing JSF file(Build failed)  *while executing below...; <servlet> <servlet-name>Rcfaces Framework Contents</servlet-name> <servlet-class>
Capturing screen shot
clipboard after applying the operation. DefaultEditorKit.copyAction...;} } Screen shot for the result of the above program: Download
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
Splash Screen in Java Swing
Splash Screen in Java Swing This Java tutorial chapter explain you how to create and implement the splash screen using Java Swing. The Java Swing splash screen indicates the user that something is happening in the application
continuing execution after an exception is thrown
continuing execution after an exception is thrown  If while executing a statement in a try say the second statement, if it throws an exception, is it possible to handle that exception and then continue on with the remaining
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
Displaying database table on the windows screen in real time.
Displaying database table on the windows screen in real time.  Problem statement... I have a database table which is running on a remote host .I...). After every 30 min the program will run and the data needs to be overridden
Mysql Trigger After Insert
Mysql Trigger After Insert       Mysql Trigger After Insert fired the trigger after you... The Tutorial illustrate an example from Mysql Trigger After Insert. To understand
Mysql Trigger after Update
Mysql Trigger after Update       Mysql Trigger after  Update fired automatically after we perform... an example from 'Mysql Trigger after Update'. To grasp 'Mysql Trigger after Update
Empty Elements in HTML
Empty Elements in HTML  What is Empty Elements in HTML
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
Screen Capture
Screen Capture  How to capture the screen using jsps and servlets
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 All, I am trying to get parameter from request object which is multipart/form... ServletInputStream object after reading once? Please Help me...... Thanks in advance
Screen shot
Screen shot  webpage screenshot source code
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
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
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
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
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
Mysql Trigger After Delete
Mysql Trigger After Delete       Trigger in Mysql fired trigger automatically after you... an example from 'Trigger After Delete' in Mysql. To understand this example, we
Logic Empty Tag (<logic:empty>...</logic:empty>)
Logic Empty Tag (<logic:empty>...</logic:empty>)        empty tag - If the requested variable is either null or an empty string then we use
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
how update JTable after adding a row into database
how update JTable after adding a row into database  J have two... in JTable, and it's OK, but after adding a row into database table does't update. How update JTable after adding a row into database? package djilepak.javaclss.for
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
Check if the directory is empty or not
Check if the directory is empty or not In this section, you will learn how to check if the directory is empty or not. Java IO package works with both files and directories. Here we are going to check whether directory is empty
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
Servlet
these steps after compiling the servlet 1)Run Tomcat server by clicking the startup.bat... the same error <web-app> <servlet> <servlet-name>InsertServlet</servlet-name> <servlet-class>InsertServlet</servlet
The Currently Running Servlet is showing some Previously run Servlet's Output
am executing another different servlet, It is showing the same output...The Currently Running Servlet is showing some Previously run Servlet's... for example, I have executed the ParameterServlet servlet where the output
Screen Coordinates
Java NotesScreen Coordinates Every computer monitor screen is made of pixels. Each pixel is a small spot on the screen. There are approximately 3 pixels... on the screen. A typical screen might be 800 pixels wide and 640 pixels high
J2EE - JSP-Servlet
is different from servlet.Jsp first translate into the servlet and after it compiled...J2EE  What is diffrent between JSP and Servlet ?   Hi friend, Difference between JSP and Servlet : Jsp have implicit object
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 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
Check Empty String
Check Empty String       In this example we are checking a sting object containing empty or null... is empty ("") , null or whitespace. isNotBlank(String str
Cannot assign an ArrayList to an empty ArrayList
Cannot assign an ArrayList to an empty ArrayList  I have a java file, in which a method returns an ArrayList. This ArrayList is supposed to contain all the Student object which are in X year. StudentsManager.java public
How to use filter to redirect to login page after session timeout.
How to use filter to redirect to login page after session timeout.  hello Sir, I have to make a web application in which i have to give session timeout . means if screen is inactive for a particular period of time
How to use filter to redirect to login page after session timeout.
How to use filter to redirect to login page after session timeout.  hello Sir, I have to make a web application in which i have to give session timeout . means if screen is inactive for a particular period of time
executing java program with 2 classes
executing java program with 2 classes  how to run a program of java containing more than one class....ex of program is given below.... class C...); } }   Executing java program with 2 classes save the file with D.java
Executing Set of SQL statements in Java
Executing Set of SQL statements in Java  Hi, I am trying to execute a procedure which is stored in MS SQL server's database. I have configured... the code for saving the data in excel but the code for executing the query
jsp - JSP-Servlet
jsp  if suppose i store my program in c://tomcat5.0//webapps/swathi after executing my program i need a folder in 'swathi'folder.I need the code to create a directory in which i execute the program.  Hi friend
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
Table Empty Cell in HTML
Table Empty Cell in HTML       The Table Empty Cell in HTML define no content inside a cell of table. The code is not able to display border around the empty cell in a table

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.