Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compare textbox data with sql table data

 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm creating an app, that displayes a String from a database. This String is then displayed in a textbox that cannot be edited.

I now require that varible (String passed) in the text box to be compared with a column in a SQL database table which is an identical String. Once the matching String is found I need to update other columns based on the queries.

when i use request.getParameters() method it is giving output as null.

i need it to be done purely in jsp. please help.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64822
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rakesh Keerthi wrote:I'm creating an app, that displayes a String from a database. This String is then displayed in a textbox that cannot be edited.

Please be precise when posting. Does this mean that you made the control disabled or readonly? They are not the same and which you used may be the answer to your question. Just saying "cannot be edited" doesn't give us the information we need to answer your question.

But I'm guessing that you used disabled, which means that the value will not be submitted.

i need it to be done purely in jsp

I sincerely hope that this does not mean that you are putting Java code in your JSPs!
 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i made it read only.
here the data is getting retrieved from a sql query and below is the code that i used to do so.



and the jsp used to compare the data is as below

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64822
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please read this JspFaq entry.
 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for the suggestion but i'm new to JSP technology and i'm not aware of this subject. please help me with the JSP code

 
Rakesh Keerthi
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,
could you please help me in solving this using JSP instead of going with JSTL as it is entirely a new concept for me.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64822
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The first sep is to move the Java code out of the JSP and into a servlet controller. Please read this article for information on proper web app structure.

If you are a novice to JSP you should be learning to do things the right way rather than wasting time establishing bad habits that you'll just need to unlearn later.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic