• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

The page doesn't gets refreshed

 
Gaurav Kalra
Greenhorn
Posts: 27
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm developing a site in which i'm continuously overwriting a file with more contents. But the page when refreshed doesn't reflect the changes.
However if i download the page using ftp, the page actually contains more data.
What could be the problem. Please help.
Also in a user input form, if the user enters a text containing quotes, then the sql query reports an error. Is there any possible solution.
Thanx in advance
Gaurav
 
Phil Hanna
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean by "if I download the page using FTP, the page actually contains more data". What is being updated, the JSP page or the file? It's hard to figure out what you're doing wrong if we can't see your code.
The SQL error is caused by your building a query string dynamically from whatever the user enters:

You can see that if userInput contains "O'Brian", you'll get garbled SQL.
A better approach is to use a prepared statement:

Note that you don't need quotes around the "?", whether the value is numeric or string.
------------------
Phil Hanna
Author of :
JSP: The Complete Reference
Instant Java Servlets
[This message has been edited by Phil Hanna (edited April 15, 2001).]
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic