赵雅智_Struts2中结果集类型 (四)

2014-11-24 11:52:22 · 作者: · 浏览: 56
in() {
entity = adminService.login(adminName, adminPassword);
if (entity != null) {
return SUCCESS;
} else {
return LOGIN;
}
}
public String insert() {
boolean b = false;
b = adminService.add(entity);
if(b) {
return SUCCESS;
} else {
return ERROR;
}
}
}
[java script]
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
My JSP 'index.jsp' starting page

后台管理登陆界面

action="${pageContext.request.contextPath}/csdn/adminLogin.action"
method="post">
用户名:

密 码:

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
My JSP 'index.jsp' starting page

后台管理登陆界面

action="${pageContext.request.contextPath}/csdn/adminLogin.action"
method="post">
用户名:

密 码:

[html]
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
My JSP 'index.jsp' starting page

欢迎${entity.adminName}后台管理界面!


<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
My JSP 'index.jsp' starting page

欢迎${entity.adminName}后台管理界面!


\

\


\
redirectAction类型
(1)、说明
1、 把结果类型重新定向到action
2、 可以接受两种参数
a) actionName: action的名字
b) namespace:命名空间
(2)、 例子
在配置文件中
[html]
< xml version="1.0" encoding="UTF-8" >
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http://struts.apache.org/dtds/struts-2.3.dtd">
method="login">
csdn/delete.action name=${entity.adminName}
/index.jsp
class="www.csdn.project.actionreslut.test.action.DeleteAction"
method="delete">
/index.jsp
< xml version="1.0" encoding="UTF-8" >
"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
"http:/