Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

unable to get column values

 
Ranch Hand
Posts: 350
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 2661
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Rancher
Posts: 377
Android Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Good heavens! What have you done! Here, try to fix it with this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic