02 Jan

Project Structure:


package com.xavier.user.actions;


import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;


import org.apache.struts.action.Action;

import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;


import com.xavier.user.forms.LoginActionForm;

import com.xavier.user.manager.UserManager;


public class LoginAction extends Action {


            private UserManager userManager;


            public ActionForward execute(ActionMapping mapping, ActionForm form,

                                    HttpServletRequest request, HttpServletResponse response) {

                        LoginActionForm laf = (LoginActionForm) form;

                        userManager.login(laf.getUsername(), laf.getPassword());

                        return mapping.findForward(“success”);



            public void setUserManager(UserManager userManager) {

                        this.userManager = userManager;





<?xml version=“1.0” encoding=“UTF-8”?>

<beans xmlns=;




    <bean id=“userManager” class=“com.xavier.user.manager.impl.UserManagerAdd”/>

    <bean name=”/login” class=“com.xavier.user.actions.LoginAction” scope=“prototype”>

            <property name=“userManager” ref=“userManager”/>




<?xml version=“1.0” encoding=“ISO-8859-1” ?>

<!DOCTYPE struts-config PUBLIC

          “-//Apache Software Foundation//DTD Struts Configuration 1.3//EN”




                        <form-bean name=“loginForm” type=“com.xavier.user.forms.LoginActionForm”/>



                        <action path=“/logininput” forward=“/login.jsp”/>

                        <action path=”/login” type=“org.springframework.web.struts.DelegatingActionProxy” name=“loginForm” scope=“request”>

                                    <forward name=“success” path=“/success.jsp”/>



            <message-resources parameter=“MessageResources”/>


Other codes, refer to the Jan 1, 2012 blog.

Leave a comment

Posted by on 01/02/2012 in Java Web Tips


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: