jQuery in Action, 3rd edition
The moose likes Servlets and the fly likes SQL and Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "SQL and Javascript" Watch "SQL and Javascript" New topic

SQL and Javascript

Gemma Cameron

Joined: Feb 15, 2005
Posts: 14
firstly I have 2 problems...

I want to catch an empty SQL statement to deliver an error message to the user - currently the last SQL statement posted by the user is returned... Is there an isEmpty() method or similar? I have looked an found nothing on sun's website.. or if anyone has any ideas I would be greatful. ( :

Also I have a Javascript problem. I want to check that the user has only entered numbers into a field. I have a .js file to create a pop up and that doesn't seem to work... here is the code I used:

String url = getInitParameter("popup-url");

if(url==null || url.equals(""))
url = "http://localhost/CCNs/help.htm";


//set the MIME type of the response, "text/html"

RequestDispatcher dispatcher = request.getRequestDispatcher("/WEB-INF/javascript.functions.js");

dispatcher.include(request, response);

out.println("<input type=\"button\" name=\"help\" " + "value=\"Help\" onKlick=\"CreateWindow('" + url+ "')\">");

And here is the function.js:
<script language="JavaScript">
function CreateWindow(uri)
var newWin=window.open(uri, 'newwin1',width=500,height=400,resizable,' + 'scrollable,scrollbars=yes');


When I click on the "help" button I get "error on page" message in the status bar.

Thanks in anticipation!

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
your missing a quote in your window.open statement, hence an error message appears.
Gemma Cameron

Joined: Feb 15, 2005
Posts: 14
Thank you!!!

Another classic "Gemma Error". ( :

Thanks again!!!
I agree. Here's the link: http://aspose.com/file-tools
subject: SQL and Javascript
It's not a secret anymore!