473,503 Members | 3,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

jsp string syntax

57 New Member
How to escape double quotes within a string to include the value of a variable from a JSP?

Two variables, "start" and "end" are dates from a calendar function. I need the variable "query" to update with the start and end variables but can't get it to work.

Expand|Select|Wrap|Line Numbers
  1.  
  2. String     Start = request.getParameter("start");
  3. String     End   = request.getParameter("end");
  4.  
  5.  
  6. if ((Start != null) && (!Start.equals("")) || ((End != null) && (!End.equals(""))))
  7.     {    
  8.     query += "+AND+NEAR{Start,End}:MODIFIED";
  9.     }
  10.  

I tried encoding the curly brackets because I need them in the output like %7B${start},${end}%7D but that doesn't work either. Also tried a variety of quotes.

Thanks for your suggestions
Jul 29 '14 #1
2 2164
keydrive
57 New Member
I understand how to return the value of a variable in JSP. I'm just having problems escaping the double quotes required on the query += line.

Expand|Select|Wrap|Line Numbers
  1. <%=Start%>
Jul 29 '14 #2
keydrive
57 New Member
Solution:

Expand|Select|Wrap|Line Numbers
  1. query += "+AND+NEAR{" + Start + "," + End + "}:MODIFIED";
  2.  
Jul 29 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
1897
by: jez123456 | last post by:
Hi I'm attempting to pass a string into another string but I get an error This code work ok jro.CompactDatabase(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Compact.mdb",...
1
1292
by: jez123456 | last post by:
I have the following code which runs ok Jet OLEDB:System Database=C:\\Test\\system\\Sys.Mdw; When I use Jet OLEDB:System Database=@C:\Test\system\Sys.Mdw; or Jet OLEDB:System...
4
2049
by: D. Shane Fowlkes | last post by:
I'm trying out a whole bunch of new (to me) techniques. Using asp.net 2 (vb), can someone correct my connection syntax. The problem seems to be that I'm not properly referening the config...
2
2937
by: Diana | last post by:
I thought I had this process pretty well down pat, but I'm getting a syntax error on the following code: *****Code***** 'Check for users - can't get this to work... Dim strUser As String ...
2
15180
by: a.r.austin | last post by:
There was some PHP built in syntax method to enter huge strings as blocks of text. I don't remember exactly how it goes and not many people use it, thus, google search was unsuccessful to me: ...
0
1199
by: madeofrose | last post by:
How can i change classic asp pages' query string syntax? ------------------------------------------------------------------------------------ Hi i give a sample below original query string :...
3
12158
priyan
by: priyan | last post by:
hai everybody, I need to copy data from a text file to a table i used copy command like this copy city from 'e\ccccc.txt' with delimiter as ',' it worked successfully. But now i...
7
1569
imrosie
by: imrosie | last post by:
Hello, I'm getting syntax error with this, does anyone see a glaring problem? I thought it was fine, but the compiler is complaining. thanks in advance. Private Sub custname_AfterUpdate()...
4
18479
by: Lucanos | last post by:
Hey Guys, Probably a simple question, but one I am struggling with all the same. I know that in PHP you wrap a text string in apostrophes or quotations - (examples $variable = 'this string' OR...
2
3181
by: splendid9 | last post by:
Microsoft OLE DB Provider for ODBC Drivers error '80040e14' Incorrect syntax near the keyword 'AND'. this is the line....... strSql = strSql & "AND customer = '" & Session("Account") & "'" ...
0
7192
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7064
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7261
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7315
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6974
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5559
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3158
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3147
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.