jeudi 23 avril 2015

.js method "undefined" in a jsp

I have this code in a jsMethods.js file:

function openPopup(url, name) {
    var options = 'height=650px, width=1050px, scrollbars=no, resizable=yes, toolbar=no, location=no, directories=no, status=no, menubar=no';
    window.open(url,name,options);
}

and then, I have a .jsp file trying to access this code, but I get an error that says "'openPopup' is undefined". Here is the code in my .jsp file:

<%@ page import="[some imports here]"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="ISO-8859-1"%>
<%@ include file="[some jspf files included here]" %>

<%@ page import="[some more imports here]" %>

<%@ taglib prefix="bean" uri="http://ift.tt/18NLDGF" %>
<%@ taglib prefix="html" uri="http://ift.tt/18NLDGG" %>
<%@ taglib prefix="logic" uri="http://ift.tt/1c9Z5PU" %>
<%@ taglib prefix="i18n" uri="/WEB-INF/tld/i18n.tld" %>
<%@ taglib prefix="display" uri="http://ift.tt/JXB0VM" %>
<%@ taglib prefix="c" uri="http://ift.tt/QfKAz6" %>
<%@ taglib prefix="spring" uri="http://ift.tt/18bwTB1" %>

<bean:define [some code] />     

<style>
.hiddenColumn{
    display: none;
}
</style>

<script type="text/javascript" charset="ISO-8859-1" src="<html:rewrite page='/js/jsMethods.js'/>"></script>  // the path is correct

<script type="text/javascript">        
function myFunction(id, type) { 

    if (type == '3') {
        // PROBLEM - METHOD NOT FOUND ???
        openPopup('<html:rewrite page="/app/tasks/"/>' + id, '');
    }
}
</script>

<%@ include file="[a jspf file included here]"%>

<div id="page">
<html:form action="blabla.do" method="GET">    

    <%@ include file="[a jspf file included here]"%>

    <div id="page-body">
// the page body in which myFunction is called

Why is the function openPopup not accessed? I've checked with other .jsp in the project and this is exactly the way they import .js files in the .jsp files. Please, help...

Aucun commentaire:

Enregistrer un commentaire