Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Development-process Empty screen after executing servlet

Have Programming Question? Ask it here!
 
 
 


Rajendra
Empty screen after executing servlet
2 Answer(s)      5 years and a month ago
Posted in : Development process



Advertisement
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
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
Empty Elements in HTML
Empty Elements in HTML  What is Empty Elements in HTML
Screen Capture
Screen Capture  How to capture the screen using jsps and servlets
Screen shot
Screen shot  webpage screenshot source code
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
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
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
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
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
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
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
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
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
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
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
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  code wise ,what is a difference between touch screen and non touch screen in J2ME
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
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
Caputuring screen shot
Caputuring screen shot  How to to capture screen shot for a computer on internet
Screen Flickers - Framework
Screen Flickers  One of my screen flickers. Is that is beacuse of less memory
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
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
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
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
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
Executing JAR file - Swing AWT
Executing JAR file  Hello Friends! I have successfully created the JAR file of my project with the Manifest File including my Main Class. I had just gave the following command: C:\>jar cfm secl.jar
Screen Scraping - Ajax
Screen Scraping  How i can do the screen scraping using java and ajax
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
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
recorder screen in java
recorder screen in java  Dear friends, how can I capture the screen in real time? best regards Riccardo Susca
recorder screen in java
recorder screen in java  Dear friends, how can I capture the screen in real time? best regards Riccardo Susca
Create an Empty DOM Document
Create an Empty DOM Document       This Example shows how to create an empty DOM Document . JAXP.... There are some of the methods used in code given below for creating an empty DOM
noise during print screen
noise during print screen  hi there, i have a java program which can print screen every 1 seconds... but during the print screen, the image seems will have some noise and ends up half page of the image will be black screen
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
iPhone Capturing Screen SDK
iPhone Capturing Screen SDK  Creating an application to capture the screen shots from iPhone. In objective c is there any class that make it enable..?   UIGraphicsBeginImageContext(CGSizeMake(480,320)); UIImage* result
InputSecret field becomes empty when page is reloaded
InputSecret field becomes empty when page is reloaded  How to fix the problem when h:inputSecret field becomes empty when page is reloaded
Touch screen effect
Touch screen effect  Hello everyone, I would like to create a desktop application using java, is it possible to have touch screen effect for the desktop application? Exp: when user click next button, whole screen will move
populating a screen on the same page
populating a screen on the same page  i'm making a time table in jsp. i have put button on each slot.if a person click on that slot it'll redirect... down. But now i want that onclicking slot(button) a small selection screen like
iphone login screen
 Mode       The   App   will   begin   with   the   Login   Screen,   The   screen   should   be   having   same   functionality  as  any  website
ipad screen resolution pixels
ipad screen resolution pixels  Hi! Can you tell the exact size of the iPad in pixels ..including height & width. Thanks Very Much!   Finally find it on the apple website... The iPad display has a screen resolution
Java delete non empty directory
Java delete non empty directory This section demonstrates you how to delete a non empty directory. It is easy to delete a directory if it is empty by simply calling the built in function delete(). But if the directory is not empty
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>
executing multiple sql statements on the single button click...
executing multiple sql statements on the single button click...  how can i frame a code on the click of a button to insert data into a table as well as to retrieve records from the same table in another form
 

 

 

DMCA.com