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

<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" />
<body >
<button class="with_border" type="submit" value="submit" onClick="greet()">Submit</button>

this is my JS File

function greet()

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. ??

7 Years
Discussion Span
Last Post by peter_budo

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.