please help in basics of servlets

P

preethamkumarrai

Hi All..
I just started working on basics of servlets.I wrote a simple
program which is pasted below.

<import>

public class testprg extends HttpServlet
{

PrintWriter out;

public void doGet(HttpServletRequest req,HttpServletResponse res)
throws ServletException,IOException
{
out=res.getWriter();
res.setContentType("text/html");
out.println("<body>");
out.println("HAI ");
out.println("</body>");
}
}

and the html file is created as

<html>
<body>
<form method="GET"
ACTION="http://localhost:8080/test_context/alisname">
</form>
</body>
</html>

Now i wanted to display a HAI message in the browser.Here in the
program "test_context" is the context name and "alisname" name is the
aliase name which i use.I use Java Application server 8.Plz, help me
out..
Prith
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top