• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic