Guys,
Check the following code.
<HTML>
<HEAD>
<TITLE>Collecting Three Parameters</TITLE>
</HEAD>
<BODY BGCOLOR="#FDF5E6">
<H1 ALIGN="CENTER">Collecting Three Parameters</H1>
<form action="/examples/servlet/trial" enctype="multipart/form-data" method="POST">
First Parameter: <input type="file" size="20" name="attached_file" ><BR>
Second Parameter: <INPUT TYPE="TEXT" NAME="param2"><BR>
Third Parameter: <INPUT TYPE="TEXT" NAME="param3"><BR>
<CENTER>
<INPUT TYPE="SUBMIT">
</CENTER>
</FORM>
</BODY>
</HTML>
The servlet code is
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class trial extends HttpServlet {
public void service(HttpServletRequest request,HttpServletResponse response) throws
ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String title = "Reading Three Request Parameters";
out.println("FirstParam: " + request.getParameter("attached_file"));
out.println("\n SecondParam: " + request.getParameter("param2"));
out.println("\n ThirdParam: " + request.getParameter("param3"));
}
}
The problem is that
System.out.println(request.getParameter("attached_file"));
System.out.println(request.getParameter("param2"));
System.out.println(request.getParameter("param3")); are all printling null even if I
fill these fields. Any idea???
Jamshed
---------------------------------
Do You Yahoo!?
Sign-up for Video Highlights of 2002 FIFA World Cup
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://archives.java.sun.com/jsp-interest.html
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.jsp
http://www.jguru.com/faq/index.jsp
http://www.jspinsider.com