0

I have a bit of a problem here.

The situation.

1. I have created a Dynamic Web Project. (good)
2. I have created a logon JSP (good)
3. I have created a css (good)
4. I have created a JS file (good)

JSP, CSS are located in WebContent/WEB-INF/
JS located in WebContent.

The issue.


My JS functions are not working.


this is a part of my jsp

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script type="text/JavaScript" language="JavaScript" src="alerts.js"></script>
<link rel="stylesheet" type="text/css" href="ibs.css" />
<title>hehehehehe</title>
</head>
<body >
<form>
<button class="with_border" type="submit" value="submit" onClick="greet()">Submit</button>
</form>
</body>
</html>

this is my JS File

function greet()
{
	alert('Hello');
}

When I click the submit button nothing happens, the Hello is not displayed.

However, when i tried this

<button class="with_border" type="submit" value="submit" onClick="alert('Hello')">Submit</button>

it works. ??

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by peter_budo
0

Application cannot find pages (JSP) as their are in wrong location. In basic setup as you showed here they should be on same level as WEB-INF that means in WebContent. There is a way to have them in different location but then you would have to set it in web.xml if I'm not mistaken

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.