日期:2014-05-19 浏览次数:20947 次
<struts>
<package name="Zweibo" extends="struts-default">
<action name="base" class="base"></action>
<action name="login" class="loginAction" >
<result name="SUCCESS">success.jsp</result>
</action>
</package>
<constant name="struts.objectFactory" value="spring"></constant>
</struts>
<bean id="base" class="controller.BaseAction" scope="prototype">
<property name="allService">
<ref bean="allService" />
</property>
</bean>
<bean id="loginAction" class="controller.LoginAction" parent="base" scope="prototype">
</bean>
<s:form action="login">
<s:textfield label="用户名" name="username"></s:textfield>
<s:password label="密码" name="password"></s:password>
<s:submit value="登录"></s:submit>
</s:form>
public class LoginAction extends BaseAction {
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;
}
private String username;
private String password;
public String execute()throws Exception{
//if (this.getAllService().getLoginService().queryUsername(user)){
// if(username != null) {
// return SUCCESS;
// }else
// return ERROR;
return SUCCESS;
}
}