JSP頁面-操作成功後跳轉頁面並彈框

controller代碼如下

 ModelAndView modelAndView = new ModelAndView("/xxx/xxx.jsp");
 modelAndView.addObject("message", "success");
 return modelAndView;

JSP文件書寫如下,寫於head標籤內即可

   <%
    if((String)request.getAttribute("message") != null) {
	%>
	<script type="text/javascript" language="javascript">
		alert("添加成功,跳轉到信息列表!");         // 彈出錯誤信息
		window.location='http://localhost:8080/xxx/xxx.action' ;        // 跳轉到登錄界面
	</script>
	<%
		}
	%>

問題解決~

在這裏插入圖片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章