Results 1 to 3 of 3
Thread: Displaying user details in jsp
- 03-30-2012, 02:17 PM #1
Member
- Join Date
- Mar 2012
- Location
- somewhere in between the codes
- Posts
- 2
- Rep Power
- 0
Displaying user details in jsp
Hey,
I m developing an web application in which there is a link like "view profile" after clicking that user will redirect to another page and that page contains user detail which is fetched from database(db2). So is anyone can help me by telling me the way how to implement it..
I have two ways to implement--
1. store the detail in a class object and save it in session
Problem:- I read many places that we should not store big objects in session.
2.I can write database connection code on jsp page and can show the detail..
Problem:- user can see the table details by editing page source code.
Is there any other way which is secure and efficient??
Sorry for asking such kind of noob question. I was not knowing that by editing page source, java codes will not be visible.
a request to admin to delete this post..Last edited by dojha00; 03-30-2012 at 07:19 PM.
- 04-02-2012, 11:04 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,439
- Rep Power
- 16
Re: Displaying user details in jsp
If you're concerned about the amount of data loaded into the session (which is reasonable, especially if the data isn't needed throughout the site) then read the data in as they access the page.
That is, have a servlet call your data layer (a DAO) to get an object that represents the profile. Stick that in the request (addAttribute), forward to the JSP which will then display the relevant bits.
As for option (2), apart from never doing this in a JSP anyway as it's bad practice, it is not insecure at all. The code that does the database access would be Java code, which is executed on the server.Please do not ask for code as refusal often offends.
- 04-04-2012, 08:29 AM #3
Member
- Join Date
- Mar 2012
- Location
- somewhere in between the codes
- Posts
- 2
- Rep Power
- 0
Re: Displaying user details in jsp
Last edited by dojha00; 04-04-2012 at 08:31 AM.
Similar Threads
-
Displaying a square based on user's input
By luke in forum New To JavaReplies: 15Last Post: 07-14-2012, 09:43 AM -
Loading and Displaying a user chosen image
By forwardbias in forum AWT / SwingReplies: 9Last Post: 03-18-2012, 08:54 AM -
help with displaying calculation with user input
By bamagirl31 in forum New To JavaReplies: 18Last Post: 05-26-2011, 04:00 AM -
Displaying the right details of a resource taken from a JSP results page
By rushhour in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 01-20-2011, 10:36 AM -
finding details in database using JSP and forwards user to a HTML page
By sandraW in forum JavaServer Pages (JSP) and JSTLReplies: 7Last Post: 08-31-2010, 09:47 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks