  | Mailing List | | Home | | Forum Home | | JBoss - Java Application Server | | Tomcat - JSP/Servlet container | | Struts - A MVC web framework | | iText - An open source PDF Java Library | | JDOM - JDOM XML Parser | | JSP - A mailing list about Java Server Pages specification and reference | | J2EE - A mailing list for Java(tm) 2 Platform, Enterprise Edition | | J2EE Pattern - An interest list for Sun Java Center J2EE Pattern Catalog | | Servlet - A mailing list for discussion about Sun Microsystem's Java Servlet API Technology | |
Struts & Hibernate
|
|
|
  | | | Subject: JSP handling of single quote | Subject: JSP handling of single quote 2004-12-03 - By R Riluvan
Back <html><div style='background-color:'><DIV class=RTE> <P>It is good to encode the strings with ascii equivalent.<BR><BR></P></DIV> <DIV></DIV>----Original Message Follows---- <DIV></DIV>From: "Lewis, Sam" <samlewis@(protected)> <DIV></DIV>Reply-To: An interest list for Sun Java Center J2EE Pattern Catalog <J2EEPATTERNS-INTEREST@(protected)> <DIV></DIV>To: J2EEPATTERNS-INTEREST@(protected) <DIV></DIV>Subject: Re: JSP handling of single quote <DIV></DIV>Date: Fri, 3 Dec 2004 14:44:28 -0000 <DIV></DIV>MIME-Version: 1.0 <DIV></DIV>Received: from mc10-f8.hotmail.com ([65.54.166.144]) by mc10-s4 .hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Fri, 3 Dec 2004 07:03:44 -0800 <DIV></DIV>Received: from swjscmail2.java.sun.com ([192.18.99.108]) by mc10-f8 .hotmail.com with Microsoft SMTPSVC(5.0.2195.6824); Fri, 3 Dec 2004 07:03:05 -0800 <DIV></DIV>Received: from swjscmail1 (swjscmail1.Sun.COM [192.18.99.107])by swjscmail2.java.sun.com (Postfix) with ESMTPid 5474F21C01; Fri, 3 Dec 2004 07:55:51 -0700 (MST) <DIV></DIV>Received: from JAVA.SUN.COM by JAVA.SUN.COM (LISTSERV-TCP/IP release 1.8e) with spool id 48128599 for J2EEPATTERNS-INTEREST@(protected); Fri, 3 Dec 2004 07:50:41 -0700 <DIV></DIV>Received: from msw2.fdrc.co.uk (unknown [193.129.243.73]) by swjscmail1.java.sun.com (Postfix) with ESMTP id B0D504A50 for <J2EEPATTERNS-INTEREST@(protected)>; Fri, 3 Dec 2004 07:40:37 -0700 (MST) <DIV></DIV>Received: from NTSE.hph.local (unverified) by msw2.fdrc.co.uk (Content Technologies SMTPRS 4.3.17) with ESMTP id <T6da5d42ebeac19010ddf0@(protected)> for <J2EEPATTERNS-INTEREST@(protected) >; Fri, 3 Dec 2004 14:53:01 +0000 <DIV></DIV>X-Message-Info: y838B63spjy2nyzHYnDsO0qif5isBbpUnOscXpAj3Bg= <DIV></DIV>X-Original-To: J2EEPATTERNS-INTEREST@(protected) <DIV></DIV>Delivered-To: J2EEPATTERNS-INTEREST@(protected) <DIV></DIV>Content-class: urn:content-classes:message <DIV></DIV>X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 <DIV></DIV>X-MS-Has-Attach: <DIV></DIV>X-MS-TNEF-Correlator: <DIV></DIV>Thread-Topic: JSP handling of single quote <DIV></DIV>thread-index: AcTZQCo4379JQSoaQ9mC2jMIbepIkAABdhqA <DIV></DIV>Precedence: list <DIV></DIV>Return-Path: owner-j2eepatterns-interest@(protected) <DIV></DIV>X-OriginalArrivalTime: 03 Dec 2004 15:03:06.0132 (UTC) FILETIME= [319B5540:01C4D949] <DIV></DIV> <DIV></DIV>You could: <DIV></DIV> <DIV></DIV>1) Use a preparedstatement which automatically escapes <DIV></DIV>characters for you. <DIV></DIV> <DIV></DIV>or <DIV></DIV> <DIV></DIV>2) yourStr.replaceAll( "'", "''" ) <DIV></DIV> <DIV></DIV>Not really a patterns question though! <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>-- --Original Message-- -- <DIV></DIV>From: An interest list for Sun Java Center J2EE Pattern Catalog <DIV></DIV>[mailto:J2EEPATTERNS-INTEREST@(protected)] On Behalf Of Kokkilah <DIV></DIV>Suntharraju <DIV></DIV>Sent: 03 December 2004 13:48 <DIV></DIV>To: J2EEPATTERNS-INTEREST@(protected) <DIV></DIV>Subject: JSP handling of single quote <DIV></DIV> <DIV></DIV> <DIV></DIV> <DIV></DIV>Wld like advise here if possible. I'm involved in a jsp project <DIV></DIV>currently using sqlserver. <DIV></DIV>Hv encountered difficulties inserting string values with single quotes <DIV></DIV>into sqlserver. <DIV></DIV> <DIV></DIV>Example <DIV></DIV>O'Brien wld only be inserted if it is entered as O''Brien with two <DIV></DIV>single quotes. <DIV></DIV> <DIV></DIV>Practically this requires parsing of the string variable example strName <DIV></DIV>that captures O'Brien to add additional single quote. <DIV></DIV> <DIV></DIV>Wld you know any good jsp solution to this do, appreciate your advise <DIV></DIV>and help <DIV></DIV> <DIV></DIV>Thanks <DIV></DIV> <DIV></DIV>==================================================================== <DIV></DIV>Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: <DIV></DIV>http://java.sun.com/blueprints/corej2eepatterns List Archive: <DIV></DIV>http://archives.java.sun.com/archives/j2eepatterns-interest.html <DIV></DIV>Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to <DIV></DIV>listserv@(protected) <DIV></DIV> <DIV></DIV>==================================================================== <DIV></DIV>Companion Site: http://www.corej2eepatterns.com <DIV></DIV>J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns <DIV></DIV>List Archive: http://archives.java.sun.com/archives/j2eepatterns -interest.html <DIV></DIV>Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv @(protected) <DIV></DIV></div></html> ==================================================================== Companion Site: http://www.corej2eepatterns.com J2EE BluePrints: http://java.sun.com/blueprints/corej2eepatterns List Archive: http://archives.java.sun.com/archives/j2eepatterns-interest.html Unsubscribing: email "signoff J2EEPATTERNS-INTEREST" to listserv@(protected)
|
|
 |