473,387 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

jsp string syntax

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 2161
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
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
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
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
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
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
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
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
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
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
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
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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
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,...

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.