I'm having my login page as:

<form action="validateuser.jsp" method="POST">
username - <input type="text" name="userName">
password - <input type="password" name="passWord">
<input type="submit" value="Submit">
<input type="reset" value="Reset">

And Validator Page as :

<%@page contentType="text/html"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.*" %>
<jsp:useBean id="idHandler" class="com.suntec.tbms3.ui.Login" scope="request">
<jsp:setProperty name="idHandler" property="*"/>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"

String userName = request.getParameter("userName");
String passWord = request.getParameter("passWord");
if (idHandler.authenticate(userName, passWord))

where I'm validating the username and pass word from my DB.
Now I want to display the user login name in my welcom.jsp page. what are the modification i've to do in validator.jsp and welcome.jsp

Recommended Answers

All 6 Replies

I am new to jsp but I would do either one of the following:

1. Set the username as a session variable and then in welcome.jsp u can use


2. Send the username in the querystring when redirecting to the welcome page then just use


to display it.

can you please little bit eloborative in the second point.
Here is my reedirect code :


then how could I able to display the value in the welcome.jsp

If the redirect is to look like this


then to get the username from the query string you would use it just as u did earlier (from your original post "String userName = ......") , like this:


Thank you so much. It's working fine.

Your code works.. great work deek trisha

i didnt get the topic........ i redirected to a page and i have to diaplay user name in that page
i am unable to get hold of that trick.... can u elabrate with the complete code

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.