Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

gatting the details of the user  RSS feed

 
suman vasireddy
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi alll..

im presently working on jsp.my problem here is i just have to get the user names from the database and if i clicked on the name the perticular persons details shoul be displayed which are present in the data base.how can i do this im able to display all the names from the data base but the problem is abot displaying the details...so please help me out....
 
Swastik Dey
Rancher
Posts: 1782
14
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
// passing the name as querystring to another page might work




 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Swastik Dey,
Maybe I'm wrong but I think the code you posted is a good recipe for SQL injection attack.
A prepared statement is better in this situation.
 
Swastik Dey
Rancher
Posts: 1782
14
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Absolutely correct John , PreparedStatement is always a better option, however I just tried to give a clue.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,Swastik Dey may be given this code to give a clue. putting java stuff in jsp consider poor practise.it is not 1998

 
Bauke Scholtz
Ranch Hand
Posts: 2458
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, writing raw Java code in JSP files is receipt for developerĀ“s trouble.

Write Java code in Java classes. This isnĀ“t 2001 anymore. We now have taglibs and EL to control the presentation flow in JSP.
 
Swastik Dey
Rancher
Posts: 1782
14
Android Eclipse IDE Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Fully agreed sir, we should distribute the code in model , view and controllers but for a beginner who might have just started learning jsp I dont find any thing wrong with this.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65832
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem with showing poor practices to beginners is that they don't know it's a poor practice and learn by developing bad habits. If you are going to take shortcuts in an example, it's best to point it out so that they know it's just a simplified example that doesn't use proper practices.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!