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



Home Answers Viewqa Java-Beginners retrieve message contents
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


bala
retrieve message contents
3 Answer(s)      5 years and 11 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
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
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
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
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
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
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
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<
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
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
 

 

 

DMCA.com