*
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
Author

SQL and Javascript

Gemma Cameron
Greenhorn

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";

url=request.getContextPath()+url;

//set the MIME type of the response, "text/html"
response.setContentType("text/html");

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

dispatcher.include(request, response);

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

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');
newWin.focus()
}

</script>

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

Thanks in anticipation!

Gemma
Eric Pascarello
author
Rancher

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

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

Another classic "Gemma Error". ( :

Thanks again!!!
 
wood burning stoves
 
subject: SQL and Javascript
 
Similar Threads
Using jQuery $.post() - Does it affect request.getRequestDispatcher?
insert command not give me error and not give result
calling a java Script file into the Jsp
Help with servlets
Help needed with DOJO and JSP