login.jsp
--------
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;
&quot;http://www.w3.org/TR/html4/loose.dtd&quot;>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<s:form action="user">
<s:textfield name="username" value="UserName"/>
<s:textfield name="password" value="Password"/>
<s:submit name="submit" value="submit"/>
</s:form>
</body>
</html>

web.xml
--------
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns="http://java.sun.com/xml/ns/javaee";
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd";
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"; id="WebApp_ID"
version="3.0">
  <display-name>crs1</display-name>
  <welcome-file-list>
    <welcome-file>Login.jsp</welcome-file>
    
  </welcome-file-list>
  <filter>
                <filter-name>struts2</filter-name>
        
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
  </filter>
  <filter-mapping>
                <filter-name>struts2</filter-name>
                <url-pattern>/*</url-pattern>
  </filter-mapping>
</web-app>

LoginAction
-----------
package com.it.action;

import com.opensymphony.xwork2.ActionSupport;

public class LoginAction extends ActionSupport {
        private static final long serialVersionUID = 1L;
        private String username;
        private String password;
        
        public String execute()
        {
                return SUCCESS;
        }
        public String getUsername()
        {
                return username;
        }
        public void setUsername(String username)
        {
                this.username=username;
        }
        public String getPassword()
        {
                return password;
        }
        public void setPassword(String password)
        {
                this.password=password;
        }

}

struts.xml
----------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE struts PUBLIC
&quot;-//Apache Software Foundation//DTD Struts Configuration 2.0//EN&quot;
&quot;http://struts.apache.org/dtds/struts-2.0.dtd&quot;>
<struts>
        <package name="default" extends="struts-default">
            <action name="user" class="com.it.action.LoginAction">
               <result name="input">/Login.jsp</result>
               <result name="error">/Login.jsp</result>
            </action>
        </package>
</struts>

--
View this message in context: 
http://struts.1045723.n5.nabble.com/Struts2-tp5710145p5710153.html
Sent from the Struts - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to