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



Home Answers Viewqa Java-Beginners retrieve message contents

Have Programming Question? Ask it here!
 
 
 


bala
retrieve message contents
3 Answer(s)      5 years and 6 months ago
Posted in : Java Beginners



Advertisement
View Answers

January 13, 2009 at 5:17 AM


Hi friend,


<html>
<title>Content Application</title>
<head>
<script type="text/javaScript">

function validateForm(theForm){



if(theForm.name.value==""){

//Please enter username

alert("Please enter user Name!");

theForm.name.focus();

return false;

}
if(theForm.content.value==""){
//please enter content
alert("Please enter discription!");
theForm.content.focus();
return false;
}
return true;
}
</script>
</head>
<body>
<center>
<table border="1" width="50%" cellpadding="0" cellspacing="0">
<tr>
<td width="100%">
<form method="POST" action="insertAction.jsp" onsubmit="return validateForm(this);">
<table border="1" width="100%" cellpadding="0" cellspacing="0">
<h1>Content Page Application</h1>
<tr>
<td width="50%"><b>Name:</b></td>
<td width="50%"><input type="text" name="name" size="30"></td>
</tr>
<tr>
<td width="50%"><b>Description:</b></td>
<td width="50%">
<textarea name="content" type="text" cols="40" rows="15" size=100>
</textarea>
</td>
</tr>
<tr>
<td><p><input type="submit" value="Sumbit" name="sumbit"></td>
<td><p><input type="reset" value="Clear" name="reset"></td>
</tr>
</table>
</p>
</form>
</td>
</tr>
</table>
</center>
</body>
</html>
------------------------------------


January 13, 2009 at 5:18 AM


data insert action file:

<%@ page language="java" import="java.sql.*" %>

<%
Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String password="amar123";

try{
Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);
try{
Statement st = con.createStatement();
String name=request.getParameter("name");
String content = request.getParameter("content");

int val = st.executeUpdate("insert contentDetail values('"+name+"','"+content+"')");

con.close();
out.println("successfully insert data into database!");

}
catch (SQLException ex){
System.out.println("SQL statement is not executed!");
}
}
catch (Exception e){
e.printStackTrace();
}

%>

--------------------------


January 13, 2009 at 5:19 AM


display content code:

<%@ page language="java" import="java.io.*, java.sql.*" %>

<html>

<head>

<title>display data</title>

</head>

<body>

<center>

<H1>Display Record From Database<H1>

<br>

<table border="1" cellpadding="0" cellspacing="0" width="500px" height="69">

<tr>

<td></td>

</tr>

<tr>

<td><b>Id<b></td>

<td><b>Name<b></td>

<td><b>Discription No<b></td>

</tr>



<%

Connection con = null;
String url = "jdbc:mysql://192.168.10.211:3306/";;
String db = "amar";
String driver = "com.mysql.jdbc.Driver";
String userName ="amar";
String password="amar123";



try{

Class.forName(driver);
con = DriverManager.getConnection(url+db,userName,password);

try{

Statement st = con.createStatement();

String sqlQuery = "Select * from contentDetail";
System.out.println("sqlQuery>>>>>>>" + sqlQuery);

ResultSet rs = st.executeQuery(sqlQuery);

int sno = 0;

while(rs.next()){

sno++;

%>



<tr style="background-color:#CCFFFF;">

<td><%=sno%></td>

<td><%=rs.getString("name")%></td>

<td><%=rs.getString("content")%></td>

</tr>



<%



}



rs.close();

con.close();

st.close();

}

catch(SQLException ex){

System.out.println("SQL satatment not found");

}

}

catch(Exception e){

e.printStackTrace();

}

%>



</table>

<a href="contentPage.html">Home Page</a>

</center>

</body>

</html>

------------------------------------
visit for more information:

http://www.roseindia.net/jsp/

Thanks.

Amardeep


Related Tutorials/Questions & Answers:
retrieve message contents - Java Beginners
retrieve message contents   hi , dbfile system to store message headsers in mysql database and message contents in file system . how to retrieve message contents. thanks bala..   Hi friend, Content
to retrieve message body - Java Beginners
to retrieve message body  hi, Using dbfile system to store message using mysql. dbfile system is to store headers in database and message body in file system . i retrieved message contents like from :, to :, delivered
Advertisements
Web Contents
Web Contents       If coding is the body of the website, web contents are the soul. Without web contents, a website is not more than a dead body. To be an average website, web
difference between $message and $$message
difference between $message and $$message  What is the difference between $message and $$message?   Hi friends, $message is a simple variable whereas $$message is a reference variable. Example: $name = 'Bharat
Read the file Contents
Read the file Contents  Ravi Raj,Vijay45Shankar,234 Guna,345,Meet me,654,Cow Read file contents and Print the no.of words and Numbers./p> Thanks, Dinesh Ram   The given code read the file content and print
What is the difference between $message and $$message?
What is the difference between $message and $$message?  What is the difference between $message and $$message
message passing
message passing  how message is passed using jade technology
message box
message box  How to show the message "invalid username and password" after redirecting the page to the login form
Java Programming: Contents
Introduction to Programming Using Java, Fourth Edition Table of Contents THIS IS THE FULL TABLE OF CONTENTS for version 4.1 of an on-line introductory programming textbook. For more information about the text, please see
Storage medium that loses its contents
Storage medium that loses its contents  A Storage medium that loses its contents in the events of power failure is called? 1. Volatile storage 2. Non volatile storage 3. Permanent storage 4. All of the above 5. None
PHP file_get_contents() Function
PHP file_get_contents() Function  Hi, How do i read the content of file using PHP program? So kindly provide any example or online help reference for filegetcontents() Function in PHP. Please feel free to suggest. Thanks
The PHP file_get_contents() function , file_get_contents php
The PHP file_get_contents() Function Function reads the content of the whole file to a string. This function is the best way to read the contents... is supported by the servers. So, the use of file_get_contents() will make your program
PHP list contents of directory
Contents of a directory or a folder can be displayed one by one. readdir() function returns the directory as well as file name. readdir() takes input as opendir() handle.On success returns the String Example of PHP List
How to print contents of a web page in jsp?
How to print contents of a web page in jsp?  I have generated a pay slip using jsp.How do I print the contents of the slip
Image retrieve
Image retrieve  HI.. store image path/data Java Coding. ... It's supposed to take the image, store it in a directory as well as pass the image path to mysql database... Now I want to retrieve the data from directory using path
Java read file contents into byte array
Java read file contents into byte array  Hello share the code of java read file contents into byte array with me. It's urgent. Thanks   Hi, This is simple process if you use the InputStream class. Read example
How to read excel contents when uploaded
How to read excel contents when uploaded  I am working on a project where the user uploads his excel file. Jsp page must read the excel contents... file must be read and the contents must be displayed on the screen. How
Java Message Services - JMS
Java Message Services  What is Java Message Services
Objective C Message Passing
Objective C Message Passing  What exactly a message passing means in Objective C? and how can i pass a message to a method
The PHP file_put_contents() function , file_put_contents php
Learn how to use file_put_contents() function in PHP Example of the PHP file_put_contents() function Description Syntax of file_put_contents() PHP file_put_contents(file_name,data_to_file,[file_mode,[file_context]]) It writes
Javascript alert message
Javascript alert message   How to send an alert message to a user in JavaScript
Message Context in AXIS
Message Context in AXIS  Is there any method in Axis classes to het the size of IN and OUT Message Conetext
Message Resource Bundle work.
Message Resource Bundle work.  How does Value replacement in Message Resource Bundle work
Show mu;tiple DIV contents in a page
Show mu;tiple DIV contents in a page  Hi All; I want to show.... on selecting an option, it should display 1 div out of 3 div contents. 1st div tag... 1 div out of 3 div contents. 4th div tag contains 4 text box, 5th div tag
Print Only Forms Contents - Java Beginners
Print Only Forms Contents  Hello Sir I Have Created Simple Registration Form with Database Connectivity, Now I Want To Print Registration form Contents ,How I can Do that, plz Help Me  Hi Friend, Please go through
how to send message
how to send message  how to send message for mobile in server
javascript dom error-message
javascript dom error-message  javascript dom error-message
websphere message broker - WebSevices
websphere message broker  how can i find the heapsize of the execution group in the message broker using command console syntax
display contents on the same page by selecting a radio button
display contents on the same page by selecting a radio button  Bill Amount Rs.<input type="text" name="amm"/> Bill Status: Pending<input type="radio" name="bill_status " value="due" /> Received<
soap message console - WebSevices
soap message console  hi friends i have one doubt that is iam using MyEclipse 6.0 in that how do i get soap message console
GETTING ALERT MESSAGE
GETTING ALERT MESSAGE  how to get an alert message when radio button is selected instead of checkbox
message driven bean example
message driven bean example  can any one tell me how to develop and execute ---------- j2ee message driven bean example in weblogic server with (netbeans or eclipse).   Have a look at the following link: http
GETTING AN ALERT MESSAGE
GETTING AN ALERT MESSAGE  how to get an alert message, if i select radio button instead of checkbox(associated with 3 dropdown list
forward error message in struts
forward error message in struts  how to forward the error message got in struts from one jsp to other jsp?   Hello Friend, Use <%@ page.... The code errorPage="errorPage.jsp" forwards the exception message
A Message-Driven Bean Example
A Message-Driven Bean Example   ... messages asynchronously,  a Message-driven bean is used. Message driven..., email or IM messages). In message driven beans, the messaging service
validation message - Struts
validation message  sir, i took help of that example but in that we change only color of the message i want to shift the place of the error message.means all messages are put together at top of the form
pop up message in java
pop up message in java  hii..i have developed an application in which a login and registration form is there.when the registration is done the user... an automatic message to change the password.how is it done??the forms are done using java
error message - Java Beginners
error message  sir, while i m trying to execute my first program(print my name)I get error message like" javac is not recognized as internal or external ...blah..blah..or batch file".even i hav tried setting the path variable
Java message services
; Java Message Services In this section, you will read about the java... and offers the basics for developing programs using it. The java message services API is a java Message oriented Middleware API for sending successfully the messages
image retrieve - Java Beginners
Image Retrieve  How to retrieve the image from mysql field using java
Ejb message driven bean
.style1 { color: #FFFFFF; } Ejb message driven... you the process which are involved in making a message driven bean using EJB...; For developing the message driven bean we are using both the EJB module and web
I want to Transfer only 1/3rd of contents from one folder to other but my code is transferring all contents
I want to Transfer only 1/3rd of contents from one folder to other but my code is transferring all contents  private static void copyFilesRecursively(File src, File dest) throws IOException { if (src.isDirectory
java program to copy the contents of one folder to another folder
java program to copy the contents of one folder to another folder  java program to copy the contents of one folder to another folder   Have a look at the following link: Java Copy one folder to another
Java Message Services
Java Message Services      ... for developing programs using it. The java message services API is a java Message oriented...: The JMS provider implements the JMS interface for a Message Oriented
print only Form Fillup Contents through Text File - Java Beginners
print only Form Fillup Contents through Text File   Hello Sir ,I have... contents which is filled by employee,How i can Print it,and also i want print it with word means when i click on print then contents which is filled
Message Driven Beans
Message Driven Beans       Message driven beans are the light weight components used for communication. In message driven beans the messaging service is in asynchronous mode because
Retrieve data by clicking a link
Retrieve data by clicking a link  In a page there are 5 links.Every link has a hidden value. According to that hidden value data should be retrieved from the database and data should be displayed in a new page.How to do it?Please
retrieve record from table
retrieve record from table  Hi. I have a field in database named stages. its datatype is varchar(60). It contains values chennai,trichy,kanchipuram for a single record. I have to retrieve these data from the field table. Actually
retrieve in xml file in struts2
retrieve in xml file in struts2  i am using struts2 and trying to populate the text box for the corresponding number entered by retrieving it from... inside the bean class and based on the number entered i retrieve the name. now how
store and retrieve data
store and retrieve data  sir,i want to store the entering data in a word file and retrieve it when i need.i am try to develop a video portal.in which user can watch video and write comments.the comments are stored in a file
 

 

 

DMCA.com