我在JSP页面里写了这样一句话:
<logic:match name="<%=Constants.POPESET_KEY%>" scope="session" value=",3101,">
<tr><td height="1" bgcolor="A7D7EB"></td></tr>
<tr><td class="menuNormal"><a target="centerFrame" HREF="/oa/aurthentication/register/ListRegisterAction.do?type_att=item3&dataRecordSign=apply" class="menuitem">领事认证</a></td></tr>
</logic:match>
然后我在STRUTS中写了一句:
<action name="registerForm"
path="/authentication/register/ListRegisterAction"
type="com.oa.aurhentication.struts.action.register.ListRegisterAction"
validate="false">
<forward name="success"
path="/office/consul authentication/registerAdmin.jsp" redirect="true" />
</action>
这样是不是如果正确就应该点击领事认证就应该转到registerAdmin.jsp页面吧?或者不正确就应该报错对不对啊?
可是我这里点击领事认证以后却出现了一个毫不相关的页面这是为什么啊????
希望各位大虾能给与指点~~在下感激不尽!!!!!!!!!!!!!!!!!!!!!!!!!!!
<logic:match name="<%=Constants.POPESET_KEY%>" scope="session" value=",3101,">
<tr><td height="1" bgcolor="A7D7EB"></td></tr>
<tr><td class="menuNormal"><a target="centerFrame" HREF="/oa/aurthentication/register/ListRegisterAction.do?type_att=item3&dataRecordSign=apply" class="menuitem">领事认证</a></td></tr>
</logic:match>
然后我在STRUTS中写了一句:
<action name="registerForm"
path="/authentication/register/ListRegisterAction"
type="com.oa.aurhentication.struts.action.register.ListRegisterAction"
validate="false">
<forward name="success"
path="/office/consul authentication/registerAdmin.jsp" redirect="true" />
</action>
这样是不是如果正确就应该点击领事认证就应该转到registerAdmin.jsp页面吧?或者不正确就应该报错对不对啊?
可是我这里点击领事认证以后却出现了一个毫不相关的页面这是为什么啊????
希望各位大虾能给与指点~~在下感激不尽!!!!!!!!!!!!!!!!!!!!!!!!!!!
解决方案 »
- maven学习中的错误,求解
- 怎样配置spring事务的隔离级别?????????????
- 我很郁闷,我真的不想用struts2了,项目做到一半打算放弃struts
- 配置struts2环境 找不到action
- Unable to load class for JSP(急急!在线等)
- log4j和struts验证框架的问题?
- 刚刚踏进JAVA领域,请教这么个问题.有经验的帮我回答一下啊!
- 线程的yield()这个方法,请大神指教下
- 大侠救命!JDBC访问临时表跟访问一般表一样的吗?
- jms的可运行例子有没有???
- hibernate 的多事务回滚
- c#程序中需要调用java写的webservice
当点击领事认证的时候,请求<a target="centerFrame" HREF="/oa/aurthentication/register/ListRegisterAction.do?type_att=item3&dataRecordSign=apply" class="menuitem">
在struts配置文件中,直接找到ListRegisterAction去执行excute方法。你可能方法中,没有return success,才导致没有跳转。
你看看是不是?
redirect="true"
HttpServletRequest request, HttpServletResponse response)
throws Exception {
DataSource dataSource = null;
Connection conn = null;
// 声明错误信息对象
ActionMessages errors = new ActionMessages();
// 获得seesion
HttpSession session = request.getSession();
Staff staff = (Staff) session.getAttribute(Constants.USER_KEY);
if (staff == null)
return mapping.findForward(Constants.FORWARD_NOSESSION);
List vector = new ArrayList();
ValueObject[] template;
String action = (String) request.getParameter(Constants.ACTION_KEY);
if (action == null || action.equals("null") || action.equals("")) {
try {
dataSource = this.getDataSource(request);
conn = dataSource.getConnection();
DataRecordDAO dataRecordDao = new DataRecordDAO(conn);
// 得到参数
String sign = request
.getParameter(Constants.REGISTERSING_KEY);
if (sign == null)
sign = (String) session
.getAttribute(Constants.REGISTERSING_KEY);
else
session.setAttribute(Constants.REGISTERSING_KEY, sign);
// 获得类型属性
String typeAtt = request
.getParameter(com.oa.desktop.struts.Constants.TYPE_ATT_KEY);
if (typeAtt == null)
typeAtt = (String) session
.getAttribute(com.oa.desktop.struts.Constants.TYPE_ATT_KEY);
else
session.setAttribute(
com.oa.desktop.struts.Constants.TYPE_ATT_KEY,
typeAtt);
String sql = "";
if (sign.equals("apply")) {
sql = " where oper_type='" + typeAtt + "' and staff_id="
+ staff.getStaffId();
vector = dataRecordDao.search(sql
+ " order by oper_time desc,record_id desc");
} else if (sign.equals("manager")) {
sql = " where oper_type='" + typeAtt;
vector = dataRecordDao.search(sql
+ "' order by oper_time desc,record_id desc");
StepDAO stepDao = new StepDAO(conn);
StaffDAO staffDao = new StaffDAO(conn);
for (int i = 0; i < vector.size(); i++) {
DataRecord temp = (DataRecord) vector.get(i);
Step step = (Step) stepDao.findByPrimaryKey(temp
.getItemId());
Staff sf = (Staff) staffDao.findByPrimaryKey(step
.getStaffId());
if ("A".equals(temp.getCondition())
|| "R".equals(temp.getCondition())) {
temp.setCondition("流转中 / " + sf.getStaffRealName());
} else if ("B".equals(temp.getCondition())) {
temp.setCondition("<font color=red>退 回</font>");
} else if ("F".equals(temp.getCondition())) {
temp.setCondition("<font color=blue>已归还</font>");
} else if ("O".equals(temp.getCondition())) {
temp.setCondition("<font color=green>通 过</font>");
}
}
} else if (sign.equals("taster")) {
// 列出待办步骤。
StepDAO stepDao = new StepDAO(conn);
List stepFrVec = stepDao
.searchForNeed("and act_step.staff_id="
+ staff.getStaffId()
+ " and (step_state='READY' or step_state='RUNNING') and entity_type='"
+ typeAtt + "' order by send_time desc");
// 循环取出待办事务
for (int i = 0; i < stepFrVec.size(); i++) {
Step step = (Step) stepFrVec.get(i);
DataRecord fr = (DataRecord) dataRecordDao
.findByPrimaryKey(new Long(step.getEntityId()));
// 删除错误的步骤
if ("".equals(fr.getOperTime())
|| fr.getOperTime() == null) {
List delStep = stepDao
.searchForNeed(" and entity_type='"
+ typeAtt + "' and entity_id="
+ step.getEntityId());
for (int j = 0; j < delStep.size(); j++) {
Step temp = (Step) delStep.get(j);
stepDao.delete(temp);
}
continue;
}
if (step.getSendTime() != null
&& step.getSendTime().length() >= 10)
fr.setOperTime(step.getSendTime().substring(0, 10));
vector.add(fr);
}
} else {
sql = " where oper_condition='O'";
// 获得表单
SearchForm addForm = (SearchForm) form;
if (addForm.getKeyword() != null
&& addForm.getKeyword().length() > 0) {
addForm.setKeyword(addForm.getKeyword().replaceAll("'",
"‘"));
sql += " and oper_personal='" + addForm.getKeyword()
+ "'";
}
if (addForm.getStTime() != null
&& addForm.getStTime().length() > 0) {
addForm.setStTime(addForm.getStTime().replaceAll("'",
"‘"));
sql += " and oper_time>='" + addForm.getStTime()
+ " 00:00:00'";
}
if (addForm.getEnTime() != null
&& addForm.getEnTime().length() > 0) {
addForm.setEnTime(addForm.getEnTime().replaceAll("'",
"‘"));
sql += " and oper_time<='" + addForm.getEnTime()
+ " 23:59:59'";
}
vector = dataRecordDao.search(sql
+ " order by oper_time desc,record_id desc");
}
if ("in".equals(sign) || "out".equals(sign))
session.setAttribute(Constants.DATARECORDSIGN_KEY,
"manager");
} catch (Exception e) {
log.error(e.getMessage());
e.printStackTrace();
errors.add("database", new ActionMessage(e.getMessage()));
} finally {
try {
if (conn != null) {
conn.close();
conn = null;
}
} catch (SQLException sqle) {
log.error(sqle.getMessage());
errors.add("database", new ActionMessage(
"error.database.connect"));
}
if (!errors.isEmpty()) {
saveErrors(request, errors);
return mapping.findForward(Constants.FORWARD_FALSE);
}
// 删除过时的FormBean
if (mapping.getAttribute() != null) {
if ("request".equalsIgnoreCase(mapping.getScope()))
request.removeAttribute(mapping.getAttribute());
else
session.removeAttribute(mapping.getAttribute());
}
if (!errors.isEmpty()) {
saveErrors(request, errors);
return new ActionForward(mapping.getInput());
}
}
pb = new PageBean(vector);
template = pb.getValueObjects();
session.setAttribute(Constants.REGISTERSET_KEY, vector);
session.setAttribute(Constants.PAGEBEAN_KEY, pb);
} else if (action.equals(Constants.NEXT_PAGE_KEY)) {
pb = (PageBean) session.getAttribute(Constants.PAGEBEAN_KEY);
template = pb.getNextPage();
session.setAttribute(Constants.REGISTERSET_KEY, template);
session.setAttribute(Constants.PAGEBEAN_KEY, pb);
} else if (action.equals(Constants.PRE_PAGE_KEY)) {
pb = (PageBean) session.getAttribute(Constants.PAGEBEAN_KEY);
template = pb.getPreviousPage();
session.setAttribute(Constants.REGISTERSET_KEY, template);
session.setAttribute(Constants.PAGEBEAN_KEY, pb);
} else {
// 从session中获取分页对象
pb = (PageBean) session.getAttribute(Constants.PAGEBEAN_KEY);
int pageNum = 1;
try {
pageNum = Integer.parseInt(action);
} catch (Exception ex) {
}
template = pb.getAppointPage(pageNum);
session.setAttribute(Constants.REGISTERSET_KEY, template);
session.setAttribute(Constants.PAGEBEAN_KEY, pb);
}
return mapping.findForward(Constants.FORWARD_SUCCESS);
}
}