Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unable to get column values

 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i need to get the data which is entered in text field..i had written the query in java..but i m unable to get the values..can you help me out..here is the query.


browseRequest.getTags()--from here i m getting the tag names

any help
 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you tested if browseRequest.getTags() returns the values you expect?
Does that work?
If yes, give us an example of what it returns.
If no, please inform us, and we will move your post to the JSP forum.

 
Jan Cumps
Bartender
Posts: 2602
13
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(by the way, you are using a very dangerous mechanism to run queries. A user can corrupt your database by putting a cunningly forged piece of sql in your text box.
What would happen if a user enters "TAG1%'; delete from customers; delete from vendors; select * from dual where x = 'X"

See sql injection
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if i give only one value i.e., app1 im getting.. the output correct output i.e., the corresponding values ... and the query is

if i give multiple values in text box i.e., app1,app2..im not getting any output.. and the query is showing like this if i give two values.


what goes wrong with my query...
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,

Your query needs to be more like:
Sean
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried that one im mysql query editor im getting...but i need to implement that code in java...can you suggest me how..i tried..but unable to get it.
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
I guess you'll need to split your tags and then loop and append each argument to your query string.
I don't think that it is particularly difficult.

Sean
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i had implemented that one..if i do i m getting all the data irrespective of the condition.here is the code.

what the problem with my code
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey,
I'm not really sure on your logic of what you are trying to do.
In my opinion this method should return a List<String> tags which you can then use as you wish in your other query. Why have you decided to return comma seperated results?

Sean
 
madhuri kunchala
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its my project requirement that i need to enter the values separated by commas..but i m not getting..any help regarding this.
 
Sean Clark
Rancher
Posts: 377
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, perhaps the input should come in seperated by commas, but I think when it comes to writing the query surely you should be implementing it by splitting the string on the commas and looking for matches.

Perhaps we should step back a touch and you should explain exactly what you are trying to achieve, how does the user interact with the system, what actions do they need to do and what are they expected to get in return?

Sean
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic