?
Solved

double quotes problem in jsp while showing a string  with " by <input value="<%=string%>">

Posted on 2003-03-28
6
Medium Priority
?
393 Views
Last Modified: 2008-03-03
    I 'm using PreparedStatement to insert records. There is no single quotes or double quotes problem while inserting the record. The string is found as such in database also. While retrieving the record and showing in the browser, the string after the double quotes is not found but its there in the table.
 
example:
string s=(Hello' world "welcome to jsp" );
 
if i bring back to screen from database thru HTML input tag
 
<input type="text" name="s" value="<%=s%>">
 
the string displayed in screen is Hello' world
 
"welcome to jsp" is not found.
 
0
Comment
Question by:deserve2000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 

Accepted Solution

by:
SRF_01 earned 80 total points
ID: 8229925
You could try an escape

eg
string s=(Hello' world \"welcome to jsp\" );
0
 
LVL 5

Expert Comment

by:msa2003
ID: 8233475
Replace quotes and double quotes with \' and \" accordingly:

string s="Hello\' world \"welcome to jsp\"";
0
 

Expert Comment

by:dfrankson
ID: 8239583
Are you using SQL Server?  If so, single quotes are special characters are need to be escaped when used in queries.  To escape them replace the single quote with two single quotes.

Example:  You are trying to find the word I'm in the database.

SELECT * FROM words WHERE word = 'I''m'
0

Featured Post

Setting up LaraDock for Laravel

Learn how to set up LaraDock in a Laravel project - LaraDock gives us an easy way to run a Laravel application using Docker in a single command.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question