package de.thomasjacob.improve.presentation.login;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

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


public class LoginForm extends ActionForm
{
	private String name = "";

	private String password = "";

	public static LoginForm getInstance(HttpServletRequest request)
	{
		HttpSession session = request.getSession();
		LoginForm form = (LoginForm) session.getAttribute("loginForm");
		if (form == null)
		{
			form = new LoginForm();
			session.setAttribute("loginForm", form);
		}

		return form;
	}

	public String getName()
	{
		return name;
	}

	public String getPassword()
	{
		return password;
	}

	public void reset(ActionMapping mapping, HttpServletRequest request)
	{
		super.reset(mapping, request);

		name = "";
		password = "";
	}

	public void setName(String name)
	{
		this.name = name;
	}

	public void setPassword(String password)
	{
		this.password = password;
	}
}