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';,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="" %>
<%@ taglib prefix="html" uri="" %>
<%@ taglib prefix="logic" uri="" %>
<%@ taglib prefix="i18n" uri="/WEB-INF/tld/i18n.tld" %>
<%@ taglib prefix="display" uri="" %>
<%@ taglib prefix="c" uri="" %>
<%@ taglib prefix="spring" uri="" %>

<bean:define [some code] />     

    display: none;

<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') {
        openPopup('<html:rewrite page="/app/tasks/"/>' + id, '');

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

<div id="page">
<html:form action="" 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