js里怎么调用controller

2025-02-24 04:48:26
推荐回答(1个)
回答1:

JS调用controller方法
JS调用controller的 useradd 路径应该怎么写。试了好几次都不对。
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>


用户添加 function form1(){ inputid=document.getElementById("input1").value; if(inputid==""){ window.location.href="<%=basePath %>/user/useradd.do"; } else{ window.location.href="<%=basePath %>/user/userupdate.do"; } }