File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes problem in Developing Struts small Apllication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "problem in Developing Struts small Apllication" Watch "problem in Developing Struts small Apllication" New topic

problem in Developing Struts small Apllication

narsimharao mothkuri

Joined: Sep 07, 2009
Posts: 1
I am useing Jdk1.5 and tomcat 5.5

==================== login.jsp=====================================

<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<title>Login Page</title>
<html:form action="/Login" focus="username">
<table align=center>
<td>User Name :</td><td><input type=text name="username" /> </td>
<td>Password :</td><td><input type=password name="password" /> </td>
<td><input type=submit value="Login" /></td> <td><input type=reset value = "Reset" /></td>


package mnr;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class LoginForm extends ActionForm
public String username;
public String password;
public LoginForm()
public void setUserName(String string)
this.username = string;
public String getUserName()
return this.username;
public void setPassWord(String string)
this.password = string;
public String getPassWord()
return this.password;
public ActionErrors validate(ActionMapping mapping,HttpServletRequest request)
ActionErrors errors = new ActionErrors();
if(username == null)
errors.add("username",new ActionMessage("errors.UserName.required"));
if(password == null)
errors.add("password",new ActionMessage("errors.PassWord.required"));
return errors;


package mnr;
import javax.servlet.http.*;
import org.apache.struts.action.*;
public class LoginAction extends Action
private static String SUCCESS = "success";
private static String FAILURE = "failure";
public ActionForward execute(ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse reponse)
throws Exception
LoginForm lf = (LoginForm)form;
String username = lf.getUserName();
String password = lf.getPassWord();
return mapping.findForward(SUCCESS);
return mapping.findForward(FAILURE);



<form-bean name="LoginForm" type="mnr.LoginForm"/>


<action input="/login.jsp"
<forward name="success" path="/success.jsp" />
<forward name="failure" path="/failure.jsp" />

Please Help me

With Regards

Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Okay, what seems to be the problem. Are you getting some sort of error. Your post says absolutely nothing!

So much trouble in the world -- Bob Marley
I agree. Here's the link:
subject: problem in Developing Struts small Apllication
It's not a secret anymore!