i m trying to set value in request scope and getting it another jsp as i click on button pop window open and getting null value , cause my requirement is getting the value of button on other jsp to validate the two section of code if user on button 1 then find by id text area open and if click on button 2 then find by name text area open then that pop window should be closed
<HTML>
<HEAD>
<TITLE>Using Buttons</TITLE>
<script type="text/javascript">
function button1()
{
var mywindow= window.open("file.jsp", "file","status=1,width=350,height=150");
}
</SCRIPT>
</HEAD>
<BODY>
<H1>Using Buttons</H1>
<INPUT TYPE="BUTTON" name="butto" VALUE="Button 1" ONCLICK="button1()"/>
<% request.setAttribute("button1" ,"butto");%>
<% request.setAttribute("button1" ,"butto");%>
</BODY>
</HTML>
and this is my file .jsp
<!
DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt"%>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql"%>
<%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml"%>
<%@page
import="com.nousinfo.tutorial.employee.service.model.bo.EmployeeBO"%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<%= (String)request.getAttribute("button1") %>
<body>
</body>
</html>
what is the error in this why i getting null value
By simple calling window.open() it doesn’t transfer your request scope object to other jsp.You cannot send data from request scope to another JSP without using forward();
Example USAGE
But, in your example it doesn’t work by simply calling window.open()