?
Solved

Creating a Servlet

Posted on 2003-02-19
5
Medium Priority
?
221 Views
Last Modified: 2010-04-01
I have a file that is evidently a java file that needs to be compiled to a class file. When I try to compile it, I get a lot of errors "cannot resolve symbol". I am using jdk1.3.1_02. Here is the file I am trying to compile.Can anyone help me with this????

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
import com.merck.is.arch.Authenticate;
import com.merck.is.arch.Authenticate.PDCNotFoundException;

public class AuthServletDemo extends HttpServlet {

  //Initialize global variables
  public void init(ServletConfig config) throws ServletException {
    super.init(config);
  }

  //Process the HTTP Post request
  public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    //get the logon credentials
    String sUser = (String) request.getParameter("isid");
    String sPassword = (String) request.getParameter("password");
    String sDomain = (String) request.getParameter("domain");

    String sMessage = new String("");
    try{
      Authenticate.NTAuthenticate(sDomain, sUser, sPassword);
      sMessage += sUser + "is authenticated.";
    }
    catch (PDCNotFoundException nfe)
    {
      sMessage += "Cannot authenticate the user. Unable to find a domain controller.";
    }
    catch (SecurityException se)
    {
      sMessage += sUser + " is NOT valid. Cannot authenticate.";
    }
    response.setContentType("text/html");
    PrintWriter out = new PrintWriter (response.getOutputStream());
    out.println("<html>");
    out.println("<head><title>AuthServletDemo</title></head>");
    out.println("<body>");
    out.println(sMessage);
    out.println("</body></html>");
    out.close();
  }
}
0
Comment
Question by:tomhughes
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 19

Expert Comment

by:cheekycj
ID: 7981746
do you have the j2ee servlets.jar and com.merck.* classes in your classpath.

download the j2ee sdk:
http://java.sun.com/products/servlet/download.html

here is a good guide on how to compile servlets:
http://developer.java.sun.com/developer/onlineTraining/webcasts/pdf/webcamp/dchen/dchen2.pdf

what you want to do is after you download the j2ee sdk.

you want to add the jar (servlets.jar or whatever it is called now) to your classpath.

CJ
0
 
LVL 19

Accepted Solution

by:
cheekycj earned 150 total points
ID: 7981751
I found a great step by step guide:
http://novocode.de/doc/servlet-essentials/appendix.html
0
 
LVL 19

Expert Comment

by:cheekycj
ID: 7981787
the jar if you download the jsdk (java servlet development kit) is jsdk.jar

CJ
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 7982044
can you tell us what server are you using?

also, please post the error message, if it is a lot, just post first 10 errors.
0
 

Author Comment

by:tomhughes
ID: 8008214
Thanks cheekyci
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This month, Experts Exchange’s free Course of the Month is focused on CompTIA IT Fundamentals.
In today's business world, data is more important than ever for informing marketing campaigns. Accessing and using data, however, may not come naturally to some creative marketing professionals. Here are four tips for adapting to wield data for insi…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question