get the data on the form :
when the attribute is injected the property name must be the same as the name in the form
User name : <input type= "text" name= "username" >
in the action :
Private String username;
when injecting an object :
in the form's place name must use the object name point object's Properties
User name : <input type= "text" name= "user.username" >
in the in User :
Private String username;
in the action :
Private user user;
if (User.getusername (). Equals ("AAA")) {
Return success;
}
IOC ( control inversion ) Dependency Injection
action Scoped Object
1. non- IOC injection
get the request way one :
1.Httpservletrquest req = Servletactioncontext.getrequest ();
Request.setattribute ("name", username);
HttpSession session = Req.getsession ();
Session.getservletcontext ();
2. injected method , return to map form of request Implementation Interface Requstaware
Private map<string,object> request;
In the execute method :
Request.put ("ShowName", " injected request");
The Session is also stored in map form : Implementing interface Sessionaware
Private map<string,object> session;
In the execute method :
Session.put ("ShowSession", " injected session");
3.actioncontext.getcontext (). getsession ();/actioncontext.getaplication ();/actioncontext.put ("", "");
A little bit of knowledge in struts