html and servlets

hi experts,
i have a servlet file called"ThreeParams.java " stored in the package  FileExchange.servlets. (in netbeans3.6)
i have a html file stored in FileExchange package.

The html form has three text fields and a submit button.

onthe html form, when i enter text and hit submit, the servlet should take the parametres and display them

..for some reason , the servlet is not displaying .

In the html form, I gave  html the <Form Action> as  <Form Action ="servlets/ThreeParams">

any advice greatly appreciated!

thanks

LVL 10
jaggernatAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

CEHJCommented:
Please post code
0
objectsCommented:
your form tag should probably be:

 <Form Action ="/servlet/ThreeParams">

or

 <Form Action ="servlet/ThreeParams">

check your servlet mapping for what is is named.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jaggernatAuthor Commented:
this is ThreeParams.java  stored in FileExchange.servlets package :

package FileExchange.servlets;

import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class ThreeParams extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
response.setContentType("text/html");
PrintWriter out=response.getWriter();
//String title="Reading three request parametres";
//out.println(ServletUtilities.headWithTitle(title) );
out.println("<BODY BGCOLOR =\"#FDF5E6\">\n" +
//"<h1 ALIGN=CENTER>" +title + "<h1>\n"+
"<UL>\n"+
"<L1><b>param1</b>:"
+request.getParameter("PARAM1")+ "\n"+
"<L1><b>param2</b>:"
+request.getParameter("PARAM2")+ "\n"+
"<L1><b>param3</b>:"
+request.getParameter("PARAM3")+ "\n"+
"</UL>\n"+
"</body></html>");
}
}
-----------------------------------------------
This is the front end html (stored in FileExchange package)


<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Collecting three parametres </TITLE>
</head>
<BODY BGCOLOR ="#FDF5E6">
<h1 ALIGN="CENTER">COLLECTING THREE PARAMETRES </h1>
<Form ACTION="servlets/ThreeParams">
<!--<Form ACTION="http://localhost:8084/FileExchange/ThreeParams">-->
First Parameter :<INPUT TYPE="TEXT" NAME="PARAM1"> <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>


--------------------
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

objectsCommented:
Its nothing to with your code, you need to check your web.xml to see what name maps to the servlet.
0
jaggernatAuthor Commented:
this is my web.xml


<servlet>
    <servlet-name>ThreeParams</servlet-name>
    <servlet-class>FileExchange.servlets.ThreeParams</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>Hellowww</servlet-name>
    <servlet-class>FileExchange.servlets.Hellowww</servlet-class>
  </servlet>
  <servlet>
    <servlet-name>TokenServlet</servlet-name>
    <servlet-class>FileExchange.servlets.TokenServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>FileExchangeServlet</servlet-name>
    <url-pattern>/FileExchangeServlet</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>ThreeParams</servlet-name>
    <url-pattern>/ThreeParams</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>Hellowww</servlet-name>
    <url-pattern>/Hellowww</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
    <servlet-name>TokenServlet</servlet-name>
    <url-pattern>/TokenServlet</url-pattern>
  </servlet-mapping>
  <session-config>
    <session-timeout>
            30
        </session-timeout>
  </session-config>
  <welcome-file-list>
    <welcome-file>
            index.jsp
        </welcome-file>
    <welcome-file>
            index.html
        </welcome-file>
    <welcome-file>
            index.htm
        </welcome-file>
  </welcome-file-list>
</web-app>
---------------

0
objectsCommented:
try:

<Form ACTION="ThreeParams">

or

<Form ACTION="/ThreeParams">

depending on your apps context
0
jaggernatAuthor Commented:
>>>>>>>><Form ACTION="ThreeParams">

>>>>>>or

>>>>>>><Form ACTION="/ThreeParams">

it does not work..

I am working in netbeans3.6...and i put the java file "ThreeParams.java " in the package  -->FileExchange.servlets
an i put the HTML file in -->FileExchange package

0
rrzCommented:
try
<Form ACTION="<%=request.getContextPath()%>/ThreeParams">
0
jaggernatAuthor Commented:
doesnt work..
should i store the html in the servlet package

plzz advice
0
objectsCommented:
check your server logs for errors
0
rrzCommented:
>should i store the html in the servlet package    
No, it has to be in a  place that is accessable to browser.
So don't put it in  your context's WEB-INF directory.
Just put it in your context's root dirctory for testing.
0
jaggernatAuthor Commented:
>>>>>>>check your server logs for errors

i am using netbeans3.6 and i dont see anything in logs directory except a file called dummy which is not a text file.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.