Loading
View RSS Feed

siva28

How To Import Javax?

Rate this Entry
Example
Code:
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class DesignPageServlet extends HttpServlet
{
public void init(ServletConfig config)throws ServletException
{
super.init(config);
}
public void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException
{
String sBKCOLOR=request.getParameter("BKCOLOR");
String sTITLE=request.getParameter("TITLE");
String sMESSAGE=request.getParameter("MESSAGE");
response.setContentType("text/html");
PrintWriter out=new PrintWriter(response.getOutputStream());
out.println("<html><head><title>");
out.println(sTITLE+"</title></head>");
out.println("<body bgcolor="+sBKCOLOR+">");
out.println("<h1>"+sTITLE+"</h1>");
out.println("<br><br>"+sMESSAGE);
out.println("</body></html>");
out.close();
}
}
Code:
<html>
<head><body>
<form action="DesignPageServlet" method="post">
<input type="Text" name="BKCOLOR">
<input type="Text" name="TITLE">
<input type="Text" name="MESSAGE">
<input type="submit" value="submit">
<input type="reset" value="RESET">
</form>
</head>
</body>
</html>




Code:
web-app>
<servlet>
       <servlet-name>mcab</servlet-name>
        <servlet-class>DesignPageServlet</servlet-class>
</servlet>
<servlet-mapping>
       <servlet-name>mcab</servlet-name>
       <url-pattern>/DesignPageServlet </url-pattern>
</servlet-mapping>
</web-app>

Submit "How To Import Javax?" to Digg Submit "How To Import Javax?" to del.icio.us Submit "How To Import Javax?" to StumbleUpon Submit "How To Import Javax?" to Google

Tags: dom, java, xhtml
Categories
Java , Web Design

Comments

  1. terminator's Avatar
    good work siva. add graphics , i mean picture of the output.



Disclaimer: Users of techforum4u.com are responsible for ensuring that any material they post (article, blog posts, images or other mulitimedia content) does not violate or infringe upon the copyright, patent, trademark, or any personal or proprietary rights of any third party, and is posted with the permission of the owner of such rights.Anyone who violates these rules may have their access privileges removed without warning.