• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

help

 
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to display records of the user whose name is found in the search results page..
in my search results , i wrote the foll.select 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.
 
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
jyotsana,
your question is not very clear....try to put it in steps
like....
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
Cheers
Praful
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
user_link=request.getParameter("user_login");
 
Praful Thakare
Ranch Hand
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
as
<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
Cheers
Praful
[ March 04, 2004: Message edited by: Praful Thakare ]
[ March 04, 2004: Message edited by: Praful Thakare ]
 
jyotsana dang
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi..
<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>
</table>
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
Posts: 645
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ranch Hand
Posts: 4982
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
Nick.
 
Evacuate the building! Here, take this tiny ad with you:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic