This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JSP and the fly likes help Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "help" Watch "help" New topic


jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
i want to display records of the user whose name is found in the search results page..
in my search results , i wrote the stmt:
select fname,lname,Desg,user_login from login.
and in the next page: where records are being displayed iam trying to get the use_login like this:
String user_link=request.getParameter("user_login");
bt iam still not able toget the login for the user.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 641
your question is not very clear....try to put it in steps
Im have soNso.jsp which takes serch input this page is calles
soNso.jsp wich fires this query..and so on..
this help us to help you better

All desirable things in life are either illegal, banned, expensive or married to someone else !!!
jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
Hi Praful,
U r right.. my qs is not very clear.ok will explain this.

iam developing an intranet site in jsp for my dept.
-> made a search page where a user can search another's records based on name,lastname and year. now when he enters anoop chawla as the name and year as 2003.
-> my next jsp page: search_results page i can display the names and made a link to the name for showing his own records.
-> here in my_page.jsp i want to know how to display that user's own records.
in the search_results page, i used this stmt for displaying the users names
select fname,lname,Desg,user_login from login where "+subquery+";
-> in the next my_page i want to take the user_login of that user whose name is being displayed.
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 641
much better...still if i got you correctly...
On first page you will provide text boxes to entre fname,lname and year..
then u submti your page...which will fetch recoreds from data base with respect to fname,lname and year...say in followin way
Praful Thakare ... . ... .... ... ...
San Pats ... . ... .... ... ...
bla bal ... . ... .... ... ...
and if user clicks on Praful Thakare you want to display his record.

If im getting you correct then u just need to send user_login with request
<a href="your next jsp page?user_login="+<%=Name%>>Praful Thakare </a>........
<a href="your next jsp page?user_login="+<%=Name%>>San Pats </a>........
<a href="your next jsp page?user_login="+<%=Name%>>bla bal </a>........
and if you want to display record of user who has currently logged in ..then store his use_id in session and retrive it as
user_link=(String)session.getAttribute("user_login"); .
Here I woud suggest you to use some unique id instead of name cause it may conflict for records with same name
[ March 04, 2004: Message edited by: Praful Thakare ]
[ March 04, 2004: Message edited by: Praful Thakare ]
jyotsana dang
Ranch Hand

Joined: Sep 26, 2003
Posts: 135
<table align="center" border="1" width="400">
<td bgcolor="#FFFFCC"><a href ="my_page.jsp?user_login=""><%=fname+" "+lname %></a></td>
<td bgcolor="#FFFFCC"><%=Desg%></td>
user_login is a unique empcode of the user. what do i give inside the user_login.
got the user_login part..
but iam still not getting the session for the user.
and records are being displayed randomly from the table..and not of that particular user
[ March 04, 2004: Message edited by: jyotsana dang ]
Praful Thakare
Ranch Hand

Joined: Feb 10, 2001
Posts: 641
you need to fetch it from database and give its value there in user_login=<%= user_login fetched from data base%>
[ March 04, 2004: Message edited by: Praful Thakare ]
Nicholas Cheung
Ranch Hand

Joined: Nov 07, 2003
Posts: 4982
Does it better to store the information into the session, rather than simply put it into the query string?
Seems to me that, if put the login name in the query string, every people know how the userid is retrieved, and some users may try to use other name to see whether it works.
Thus, a better way is:
1. Retrieve the data or info from DB.
2. Put it into the session by: session.setAttribute("userid", userid);
3. Other pages within the same session can get the userid by session.getAttribute("userid");
Does this make more sense?

SCJP 1.2, OCP 9i DBA, SCWCD 1.3, SCJP 1.4 (SAI), SCJD 1.4, SCWCD 1.4 (Beta), ICED (IBM 287, IBM 484, IBM 486), SCMAD 1.0 (Beta), SCBCD 1.3, ICSD (IBM 288), ICDBA (IBM 700, IBM 701), SCDJWS, ICSD (IBM 348), OCP 10g DBA (Beta), SCJP 5.0 (Beta), SCJA 1.0 (Beta), MCP(70-270), SCBCD 5.0 (Beta), SCJP 6.0, SCEA for JEE5 (in progress)
Have you checked out Aspose?
subject: help
It's not a secret anymore!