Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 24th, 2006, 12:35 PM
Registered User
 
Join Date: Aug 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Syntax error using request.getParameter in query

I'm trying to pass a variable in a URL to a print version page for my web site. I'm getting an error stating:
Lexical Error: String constant not properly terminated
at this point in the code:
pageTitle=<%= request.getParameter("title")
Below is the entire snippet. I know it's something simple, but I'm new to jsp and just can't get it to work.

thanks,
Kirk


<%

//select the content from database according to the id
String query="SELECT pageTitle, pageMetaDescription, pageMetaKeywords, pageHeadline, pageText, callout, image, pageFileName FROM tblPageContent WHERE pageTitle=<%= request.getParameter("title") %>";
ResultSet rs=statement.executeQuery(query);
while(rs.next()){
title=rs.getString(1);
metadescription=rs.getString(2);
metakeywords=rs.getString(3);
headline=rs.getString(4);
pagetext=rs.getString(5);
callout=rs.getString(6);
image=rs.getString(7);
filename=rs.getString(8);
}
%>

 
Old August 24th, 2006, 02:13 PM
Registered User
 
Join Date: Aug 2006
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

<%
String query="SELECT pageTitle, pageMetaDescription, pageMetaKeywords,pageHeadline, pageText, callout, image, pageFileName FROM tblPageContent WHERE pageTitle=%><%= request.getParameter("title")%><%";
%>

Try above code. Basically, wat i found out is dat u r trying to use scriplet tags(<%%>) inside another scriplet tags. JSP dont allow this kind of programming. i think it should work up now.
Cheers!;)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax error (missing operator) in query expressio annwilly Classic ASP Databases 1 June 7th, 2006 09:53 AM
Syntax Error in Report Query mateenmohd Access 3 May 1st, 2005 03:41 AM
Syntax Error /missing operator in Query Expression dsealer Classic ASP Databases 4 September 4th, 2004 07:19 PM
Syntax error in query. Incomplete query clause. dispickle ADO.NET 3 April 16th, 2004 01:04 PM
Syntax error (missing operator) in query expressio mvollmer Classic ASP Databases 7 December 5th, 2003 11:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.