package simuleqn;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
@SuppressWarnings("serial")
public class EasyQnServlet extends HttpServlet
{
@Override
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
{
// Set the response message's MIME type (in Content-Type response header)
response.setContentType("text/html");
// Get an output Writer to write the response message over the network
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>");
out.println("<html>");
out.println("<head><title>Echo Servlet</title></head>");
out.println("<body><h2>You have enter</h2>");
// Retrieve the value of the query parameters "title", "instructions
String title = request.getParameter("title");
String instructions = request.getParameter("instructions");
// Get null if the parameter is missing from query string.
// Get empty string or string of white spaces if user did not fill in
// Parameter: title
if (title == null || title.trim().equals(""))
{
out.println("Please enter the title.
");
}
else
{
out.println("Title: " + title + "
");
}
// Parameter: instructions
if (instructions == null || instructions.trim().equals(""))
{
out.println("Instruction: NONE
");
}
else
{
out.println("Title: " + title + "
");
}
out.println("</body></html>");
}
}
}
my html and web.xml file in webapps folder.
The important thing is not to stop questioning.Curiosity has its own reason for existing.
Vijay Tidake wrote:Hi,
my html and web.xml file in webapps folder.
put you web.xml in webapps /WEB-INF/web.xml
Thanks.
The important thing is not to stop questioning.Curiosity has its own reason for existing.
Ashwin Sridhar
SCJP | SCWCD | OCA
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |