Handling Double Quotes from Database
Posted on 2004-04-26
There are 4 students including myself working for our college in the web department having trouble with the web pages we are working on.
The problem comes from whenever we pass double quotes to and retrieve them from the database. We are working with jsp pages and using stored procedures (that use sql) to access the database. We can't see the stored procedures, they are created by our supervisor, and he hasn't been able to help us work this out. Its getting quite messy and confusing and when one student can get it to work for some pages when another tries to apply it to the pages they are working on it doesn't work.
So far we've managed to pass double quotes to the database and get them back and print/view them. When we try to pass double quotes to an update page though they come out as question marks ? and then that gets passed to the database. Also when we type a double quote in an add form it will send double quotes to the database and we can retrieve it correctly but if we copy from a word document it gets sent as a question mark ?.
I'm not including the code because its happening in different ways between 3 different programs so I'm hoping that I can get a solution that we can apply to any page we use.
Our basic system tho is that we students create the web pages in .jsp, we sometimes use .js for functions and such. We call a java .class page when we need to access the database for adds, updates, deletes and just printing out a page dynamically from a database. We encode this in either a hypertext link or in form submit and we pass values such as ids to refine what we will get back from the database. Our java file is a huge if clause where we pass a mode (ie, mode is updateStaff, deleteHardware, addMember) and if mode = what we've sent it then we use a stored procedure (which we never see) to the database and if we get something back as an object we input it into a hashmap on our jsp pages. We don't use beans though I wonder if it might be useful to try to get into but we students don't know jsp when we start here and I, being second year, only covered basic beans that we made. I'm not sure where to find what information there is on pre-made beans and if they come with our software. For testing purposes we use Tomcat on our machines. We make pages using Dreamweaver and Textpad.
Can anyone offer any advice or point to any page that might have a solution that we will all be able to use and implement easily into future projects?
Thanks for any replies!