/**
 * Copyright (c) 2004 Red Hat, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307
 * USA
 *
 * Component of: Red Hat Application Server
 * 
 * Initial Developers: Aizaz Ahmed
 *                     Vivek Lakshmanan
 *                     Andrew Overholt
 *                     Matthew Wringe
 *
 */
package olstore.action;

import javax.servlet.http.HttpSession;

import olstore.form.DemoDynaBaseForm;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

 
public class LoginAction extends DemoBaseAction{

	public ActionForward execute(ActionMapping mapping,
                ActionForm form,
                javax.servlet.http.HttpServletRequest request,
                javax.servlet.http.HttpServletResponse response)
                                           throws java.lang.Exception{
		HttpSession session = request.getSession(false);
		String username = null;
		String password = null;
		session = request.getSession(true);
		//session.setAttribute("setMySession", new Boolean(true));
		DemoDynaBaseForm loginForm  = (DemoDynaBaseForm) form;
        	username = (String) loginForm.get( "username");
		password = (String) loginForm.get("password");
		String path = "/j_security_check?j_username=" +
				username + "&j_password=" + password;
		
		return new ActionForward(path,true);
	}
}
 
