Sthokala
asked on
Need help about jsp form beans
Hi,
I created a login module with the attached code. I created login module using jsp form beans. I am attaching the code. I am calling login.jsp from index.jsp..from login.jsp I am calling loginbean.jsp. From login.jsp I want to open a window from login.jsp. rightnow I am passing loginname and password as request parameters and is showing up on the title bar. How can I avoid that. I don't want to show the login name and password in window title bar.
I am attaching screens and code. Please help me in solving this.
Thank you,
code.zip
I created a login module with the attached code. I created login module using jsp form beans. I am attaching the code. I am calling login.jsp from index.jsp..from login.jsp I am calling loginbean.jsp. From login.jsp I want to open a window from login.jsp. rightnow I am passing loginname and password as request parameters and is showing up on the title bar. How can I avoid that. I don't want to show the login name and password in window title bar.
I am attaching screens and code. Please help me in solving this.
Thank you,
code.zip
ASKER
Hi Dravidnsr,
Thank you for you reply. I have that in my code..
<form name="loginform" method="post" action="" > in login.txt file. While clicking on submit button I am calling the below method.
function postLogin(){
var adjustHeight = 40;
var adjustWidth = 15;
var height = screen.availHeight-adjustH eight;
var width = screen.availWidth-adjustWi dth;
var winProps = "height="+height+",width=" +width+",l eft=0,top= 0,resizabl e=yes,scro llbars=yes ";
var userName = document.getElementById("u serName"). value;
var password = document.getElementById("p assword"). value;
var strURL = "loginbean.jsp?userName=" + userName+"&password="+pass word+"&log inType="+" cpoeLogin" ;
var winPop = window.open(strURL,"_blank ",winProps );
self.close();
}
how can I send username and password data to the loginbean, without showing them in query string.
Please help me in solving this.
Thank you
Thank you for you reply. I have that in my code..
<form name="loginform" method="post" action="" > in login.txt file. While clicking on submit button I am calling the below method.
function postLogin(){
var adjustHeight = 40;
var adjustWidth = 15;
var height = screen.availHeight-adjustH
var width = screen.availWidth-adjustWi
var winProps = "height="+height+",width="
var userName = document.getElementById("u
var password = document.getElementById("p
var strURL = "loginbean.jsp?userName=" + userName+"&password="+pass
var winPop = window.open(strURL,"_blank
self.close();
}
how can I send username and password data to the loginbean, without showing them in query string.
Please help me in solving this.
Thank you
is that form submit only right ??
then now need to pass username and password in the URL
you can get the value directly using request.getParameter("user Name");
in jsp
<input type="text" name="userName">
text filed name and request parameter name should be same ...
then now need to pass username and password in the URL
you can get the value directly using request.getParameter("user
in jsp
<input type="text" name="userName">
text filed name and request parameter name should be same ...
can you post your code i am not able to download your zip file
var winPop = window.open(strURL,"_blank ",winProps );
self.close();
why you create open a window ?
document.formname.action=" loginbean. jsp?loginT ype="+cpoe Login;
document.formname.submit() ;
self.close();
why you create open a window ?
document.formname.action="
document.formname.submit()
ASKER
Thank you very much for your quick reply. My login page code
<html>
<head>
<title>Login</title>
<LINK href="css/cpoe.css" rel="stylesheet" type="text/css">
</head>
<style>
body {
background-position: 50% 50%;
background-repeat: no-repeat;
}
body{
padding-top: 150px;
padding-left: 120px;
}
.td-padding{
padding-left: 70px;
}
html, body {
height: 50%;
}
</style>
<script type="text/javascript" charset="utf-8">
function postLogin(){
var adjustHeight = 40;
var adjustWidth = 15;
var height = screen.availHeight-adjustH eight;
var width = screen.availWidth-adjustWi dth;
var winProps = "height="+height+",width=" +width+",l eft=0,top= 0,resizabl e=yes,scro llbars=yes ";
var userName = document.getElementById("u serName"). value;
var password = document.getElementById("p assword"). value;
var strURL = "loginbean.jsp?userName=" + userName+"&password="+pass word+"&log inType="+" cpoeLogin" ;
var winPop = window.open(strURL,"_blank ",winProps );
self.close();
}
function submitenter(myfield, e) {
var keycode;
if (window.event)
keycode = window.event.keyCode;
else if (e)
keycode = e.which;
else
return true;
if (keycode == 13) {
postLogin();
return false;
} else{
return true;
}
}
</script>
<body >
<form name="loginform" method="post" action="" >
<br><br>
<table >
<tr><td colspan=2></td></tr>
<tr><td colspan=2> </td></tr>
<tr>
<td nowrap="nowrap"><b>Login Name</b></td>
<td><input type="text" name="userName" id="userName" value="" size="24"></td>
</tr>
<tr>
<td nowrap="nowrap"><b>Passwor d</b></td>
<td><input type="password" name="password" id="password" value="" size="24" onKeyPress="return submitenter(this,event)" onBlur="return submitenter(this,event)">< /td>
</tr>
</table>
<table>
<tr>
<td><button name="ok" id ="ok" onClick="postLogin()" > Login</button></td>
<td><button name="cancel" id ="cancel" onClick="window.location.r eload()" > Cancel</button></td></tr>
<tr><td colspan=2> </td></tr>
</table>
</form>
</body>
</html>
and loginbean code is
<HTML>
<HEAD><TITLE>DataBase Search</TITLE></HEAD>
<BODY>
<%@ page language="Java" import="java.sql.*" %>
<jsp:useBean id="db" scope="request" class="com.sectra.bean.Log inBean" >
<jsp:setProperty name="db" property="userName" value='<%=request.getParam eter("user Name")%>'/ >
<jsp:setProperty name="db" property="password" value='<%=request.getParam eter("pass word")%>'/ >
<jsp:setProperty name="db" property="loginType" value='<%=request.getParam eter("logi nType")%>' />
</jsp:useBean>
<jsp:forward page="hello">
<jsp:param name="username" value="<%=db.getUserName() %>" />
<jsp:param name="password" value="<%=db.getPassword() %>" />
<jsp:param name="loginType" value="<%=db.getLoginType( )%>" />
</jsp:forward>
</body>
</html>
I want to open a the page in a window after a successful login.
Please let me know how to solve this.
Thank you
<html>
<head>
<title>Login</title>
<LINK href="css/cpoe.css" rel="stylesheet" type="text/css">
</head>
<style>
body {
background-position: 50% 50%;
background-repeat: no-repeat;
}
body{
padding-top: 150px;
padding-left: 120px;
}
.td-padding{
padding-left: 70px;
}
html, body {
height: 50%;
}
</style>
<script type="text/javascript" charset="utf-8">
function postLogin(){
var adjustHeight = 40;
var adjustWidth = 15;
var height = screen.availHeight-adjustH
var width = screen.availWidth-adjustWi
var winProps = "height="+height+",width="
var userName = document.getElementById("u
var password = document.getElementById("p
var strURL = "loginbean.jsp?userName=" + userName+"&password="+pass
var winPop = window.open(strURL,"_blank
self.close();
}
function submitenter(myfield, e) {
var keycode;
if (window.event)
keycode = window.event.keyCode;
else if (e)
keycode = e.which;
else
return true;
if (keycode == 13) {
postLogin();
return false;
} else{
return true;
}
}
</script>
<body >
<form name="loginform" method="post" action="" >
<br><br>
<table >
<tr><td colspan=2></td></tr>
<tr><td colspan=2> </td></tr>
<tr>
<td nowrap="nowrap"><b>Login Name</b></td>
<td><input type="text" name="userName" id="userName" value="" size="24"></td>
</tr>
<tr>
<td nowrap="nowrap"><b>Passwor
<td><input type="password" name="password" id="password" value="" size="24" onKeyPress="return submitenter(this,event)" onBlur="return submitenter(this,event)"><
</tr>
</table>
<table>
<tr>
<td><button name="ok" id ="ok" onClick="postLogin()" > Login</button></td>
<td><button name="cancel" id ="cancel" onClick="window.location.r
<tr><td colspan=2> </td></tr>
</table>
</form>
</body>
</html>
and loginbean code is
<HTML>
<HEAD><TITLE>DataBase Search</TITLE></HEAD>
<BODY>
<%@ page language="Java" import="java.sql.*" %>
<jsp:useBean id="db" scope="request" class="com.sectra.bean.Log
<jsp:setProperty name="db" property="userName" value='<%=request.getParam
<jsp:setProperty name="db" property="password" value='<%=request.getParam
<jsp:setProperty name="db" property="loginType" value='<%=request.getParam
</jsp:useBean>
<jsp:forward page="hello">
<jsp:param name="username" value="<%=db.getUserName()
<jsp:param name="password" value="<%=db.getPassword()
<jsp:param name="loginType" value="<%=db.getLoginType(
</jsp:forward>
</body>
</html>
I want to open a the page in a window after a successful login.
Please let me know how to solve this.
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your reply. I tried your approach and I am getting the result. But my problem here is the data is getting displayed in small login window itself. After successful login, the data displays in the same small window like shown in the image. I want to open a full screen window after successful login.
Please let me know how to do this.
index.PNG
page.PNG
Please let me know how to do this.
index.PNG
page.PNG
check ur js file or set the width and heg in the open.window
< form method="post" > then it wont display in the title bar ..