i am developing some kind of pubsub application,so when a user subscribe to particular entity then he receive a alert for successful subscription and redirect on the same page.
In Servlet
session.setAttribute("Login_Expired","Expired") ;
response.sendRedirect("jsp/page.jsp");
In JSP
<%
String strExpired = (String) session.getAttribute("Login_Expired");
if (strExpired.equals("Expired")){
out.print("alert('Password expired, please update your password..');");
}
%>
Add an attribute in request from servlet and forward request to jsp on jsp use following
request.setAttribute("subscribed",true);
on jsp, in javascript
if(${subscribed == 'true'}){
alert("Peep Peep..");
}
In servlet
String strExpired = (String) session.getAttribute("Login_Expired");
response.sendRedirect("jsp/page.jsp");
In jsp
<%
String strExpired = (String) session.getAttribute("Login_Expired");
out.print("alert('Password expired, please update your password..');");
%>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.