Posts

Java Beans Program

Index.jsp <html>     <head>         <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">         <title>JSP Page</title>     </head>     <body>               <form action="process.jsp">            <input type="text" name="uname" value="name" onclick="this.value="/><br/>             <input type="text" name="uemail" value="emailid" onclick="this.value="/><br/>            <input type="password" name="upass" value="password" onclick="this.value="/><br/>             <input type="Submit" value="register"/>         </form>                              </body> </html> Process.jsp <%@page contentType="text/html" pageEncoding="UTF-8"%>

Send Redirect example

reg.html  <html>     <body>            <form action="reg" method="post">       <table border="3" bgcolor="magenta">                          <tr>               <td>   eid:<input type="text" name="eid"/><br/><br/> </td></tr>           <tr><td>ename<input type="text" name="ename"/><br/><br/> </td></tr>           <tr><td>salary:<input type="text" name="esalary"/><br/><br/> </td></tr>       </table>     <input type="submit" value="click here"/>       </form>         </table>     </body>                   </html>   reg.java  import java.io.*;     import java.sql.*;     import javax.servlet.ServletException;     import javax.servlet.http.*;          public class reg extends HttpServl

Html -> Servlet Page-> JDBC

Write a Servlet Program that verifys and updates the data in the use html as front end?    CREATE TABLE  "REGISTERUSER"     (    "NAME" VARCHAR2(4000),      "PASS" VARCHAR2(4000),      "EMAIL" VARCHAR2(4000),      "COUNTRY" VARCHAR2(4000)    )    register.html     <html>      <body>      <form action="Register" method="post">            Name:<input type="text" name="userName"/><br/><br/>      Password:<input type="password" name="userPass"/><br/><br/>      Email Id:<input type="text" name="userEmail"/><br/><br/>      Country:      <select name="userCountry">      <option>India</option>      <option>China</option>      <option>other</option>      </select>            <br/><br/>      <input type="sub

Servlet and XML

Servlet to dislay Xml Content import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class NewServlet extends HttpServlet {              public void service(HttpServletRequest request, HttpServletResponse response)             throws ServletException, IOException {         response.setContentType("text/xml");        PrintWriter out = response.getWriter();                          out.println("<table border='1'><tr>");             out.println("<th>celebrity</th>");             out.println("<th>profession</th>");             out.println("<tr><td>sachin</td></tr>");             out.println("<td>ccricketer</td>");             out.println("<tr&

CSS PROGRAMS

Inline CSS : Inline CSS contains the CSS property in the body section attached with element is known as inline CSS. This kind of style is specified within an HTML tag using style attribute. <html>      <head>          <title>Inline CSS</title>      </head>             <body>          <p style = "color:#009900;                      font-size:50px;                      font-style:italic;                      text-align:center;">          KBN COLLGE</p>      </body>  </html>     Internal or Embedded CSS: This can be used when a single HTML document must be styled uniquely. The CSS rule set should be within the HTML file in the head section i.e the CSS is embedded within the HTML file <html>      <head>          <title>Internal CSS</title>          <style>              .main {                  text-align:center;                 }              .GFG {           

DHTML PROGRAMS

PROGRAM1: <html>      <head>          <title>Create an alert</title>      </head>             <body>          <h1 id = "para1">DQQQQQQ</h1>          <input type = "Submit" onclick = "Click()"/>          <script style = "text/javascript">              function Click() {                  document.getElementById("para1").style.color = "#009900";                  window.alert("Color changed to green");              }          </script>      </body>  </html>    PROGRAM2: <html>      <head>          <title>Validate input data</title>      </head>  <body>          <p>Enter graduation percentage:</p>          <input id="perc">          <button type="button" onclick="Validate()">Submit</button>

Basic Servlet Program

import java.io.IOException; import java.io.PrintWriter; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; public class HtmlSrv extends HttpServlet {        protected void processRequest(HttpServletRequest request, HttpServletResponse response)             throws ServletException, IOException {         response.setContentType("text/html;charset=UTF-8");         try (PrintWriter out = response.getWriter()) {             /* TODO output your page here. You may use following sample code. */             out.println("<!DOCTYPE html>");             out.println("<html>");             out.println("<head>");             out.println("<title>Servlet HtmlSrv</title>");                        out.println("</head>");             out.println("<body>");             out.prin