加金开发 2019-05-11 20:31 采纳率: 71.4%
浏览 377
已采纳

Action +ajax 不跳转问题!

public class LoginAction extends ActionSupport{
protected HttpServletRequest request=ServletActionContext.getRequest();
protected HttpServletResponse response=ServletActionContext.getResponse();
PrintWriter out;
@Override
public String execute() throws Exception {
String Do_user=(String)request.getParameter("Do_user");
System.out.println("传输测试"+Do_user);
//1登录 2注册
if(Do_user.equals("1")){
String user=(String)request.getParameter("user");
String password=(String)request.getParameter("password");
Boolean A=jdbc_url.Douser("user", "uname",user);
Boolean B=jdbc_url.Douser("user", "pswrod",password);
System.out.println("执行完成");
}
** return "table"**;
}


   <action name="login" class="controller1.LoginAction">
            <result name="blank">com/blank.jsp</result>
            <result name="chart">com/chart.jsp</result>
            <result name="form">com/form.jsp</result>
            <result name="main_index">com/main_index.jsp</result>
            <result name="registeration">com/registeration.jsp</result>
            <result name="ta-panel">com/tab-panel.jsp</result>
            <result name="table">com/table.jsp</result>
            <result name="ui">com/ui.jsp</result>
            <result name="index">login.jsp</result>

        </action>

怎么不跳转了?


  • 写回答

1条回答 默认 最新

  • threenewbee 2019-05-11 23:54
    关注

    你是用ajax的方式调用的LoginAction?那么你需要页面自己去跳转,比如
    $ajax.post(地址, 数据,
    success: function(data){
    window.location.href=data;
    });
    这里,假设你返回的是跳转的地址

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 已采纳回答 9月14日

悬赏问题

  • ¥15 高德地图点聚合中Marker的位置无法实时更新
  • ¥15 DIFY API Endpoint 问题。
  • ¥20 sub地址DHCP问题
  • ¥15 delta降尺度计算的一些细节,有偿
  • ¥15 Arduino红外遥控代码有问题
  • ¥15 数值计算离散正交多项式
  • ¥30 数值计算均差系数编程
  • ¥15 redis-full-check比较 两个集群的数据出错
  • ¥15 Matlab编程问题
  • ¥15 训练的多模态特征融合模型准确度很低怎么办