• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

need help

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi,
I am learning struts by using Javaranch newsletter link
http://www.javaranch.com/newsletter/Mar2002/newslettermar2002.jsp#struts
I have installed tomcat 1.4.1 and as that link said I created LoginBean.java with the following code
package test.struts;

import javax.servlet.http.*;
import org.apache.struts.action.*;

public class LoginBean {

String userType, userId ,passWord;

public LoginBean() {}

public void setParameters(HttpServletRequest request) {
userId = request.getParameter("userId");
passWord = request.getParameter("passWord");
}

public ActionErrors validate() {

if (!userId.equals(passWord)) {
ActionErrors ae = new ActionErrors();
ae.add("userId", new ActionError("error.invalid.login"));
return ae;
}

if (userId.equals("admin")) {
userType = "Adminstrator";
} else
if (userId.equals("user")) {
userType = "User";
} else {
ActionErrors ae = new ActionErrors();
ae.add("userId", new ActionError("error.invalid.login"));
return ae;
}

return null;
}

public String getUserType() {
return userType;
}

public void setUserType(String userType) {
this.userType = userType;
}
}
I am using jdk1.4 but when I compiled this file it's saying javax.servlet is not found I don't know where to save this file.What do I need to do for recognizing javax package.
thanks alot
 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try to search for "servlet-api.jar", should be somewhere in your Tomcat-path ("Tomcat 5.5\common\lib\"). You have to include this file in your classpath.

However, I recommend to use eclipse with the sysdeo-tomcat-plugin.
 
I was her plaything! And so was this tiny ad:
Paul Wheaton's 16th Kickstarter: Gardening playing cards for gardeners and homesteaders
https://coderanch.com/t/889615/Paul-Wheaton-Kickstarter-Gardening-playing
reply
    Bookmark Topic Watch Topic
  • New Topic