Struts provides their own JSP tag library for creating view. For using those library you need to import them on your page as
<%@taglib uri="/struts-tags" prefix="s"%>
<%@ taglib prefix="s" uri="/struts-tags" %> <s:form action="loginSuccess"> <s:textfield name="userId" label="Login ID"></s:textfield> <s:password name="password" label="Password"></s:password> <s:submit value="Login"></s:submit> </s:form>
import java.io.Serializable;
public class LoginModel implements Serializable {
private String userId;
private String password;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
Note- The Name of the text field in the JSP should be same as the field
specified in model class.