Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-15-2009, 05:06 PM
Member
 
Join Date: Apr 2009
Posts: 1
Rep Power: 0
balachandarr is on a distinguished road
Default how can i link html+servlet+xml to form servlet
Hi all,,

i am having three files

one html file named add.html which contains

<html>
<head>
<title>Addservlet</title>
<Body bgcolor="gray">
<STYLE type="text/css">
H1 { text-align: center}
</STYLE>



<font ><h1>ADDSERVLET</h1></font>
<form action="/addservlet"
method="POST">
Number One
&nbsp;&nbsp<input type="Text" name="number1">
<br><br>Number Two
&nbsp;&nbsp<input type="text" name="Number2">
<br><br><input type="submit" value="Submit">
<input type="reset" value="Reset">
</form>
</body>
</head>
</html>


and one web.xml file contains


<web-app>
<servlet>
<servlet-name>addse</servlet-name>
<servlet-class>addservlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>addse</servlet-name>
<url-pattern>/addservlet</url-pattern>
</servlet-mapping>
</web-app>


one servletfile which contains

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
public class addservlet extends HttpServlet
{


public void post(HttpServletRequest req,HttpServletResponse resp)throws IOException,
{
int no_one,no_two,result;
resp.setContentType("text/html");
PrintWriter p=resp.getWriter();
no_one=Integer.parseInt(req.getParameter(no_o));
no_two=Integer.parseInt(req.getParameter(no_t));
result=no_one+no_one;
p.println("Result"+result);
}


how can i link all these three...to form a servlet.help me i am new to this
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Link to specific part of a Java Servlet jwilley44 Java Servlet 2 02-03-2009 02:51 AM
using a link to call servlet sijokunnappilly Java Servlet 3 11-12-2008 03:22 PM
JSP - Link tcreate Folder (servlet) roseline43 Java Servlet 0 09-15-2008 01:27 PM
Servlet with a Form/Dropdown Java Tip Java Tips 0 01-16-2008 11:24 AM
Getting HTML form values in Servlet Java Tip Java Tips 0 11-17-2007 09:13 PM


All times are GMT +2. The time now is 06:34 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org