Я пытаюсь реализовать уведомления в своем веб-проекте, использующем шаблон проектирования mvc с EJB и JPA. Также верхний и нижний колонтитулы находятся в отдельном файле для каждого. Проблема в том, что когда я пытаюсь использовать оповещения, он не работает. пример кода из jen:
<script src="js2/js/jquery.js" type="text/javascript"></script>
<script src="js2/js/jquery.ui.draggable.js" type="text/javascript"></script>
<script src="js2/js/jquery.alerts.js" type="text/javascript"></script>
<link href="js2/css/jquery.alerts.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript">
function gback(){
document.FM.action = "<c:url value='FModificar'/>";
document.FM.method = "get";
document.FM.submit();
}
$(document).ready(function(){
$("#FElim").click(function () {
jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
jAlert('success', 'Confirmed: ' + r, 'Confirmation Results');
if (r) {
document.FEliminar.action = "<c:url value='FEL'/>";
document.FEliminar.method = "get";
document.FEliminar.submit();
} else {
return false;
}
});
});
});
</script>
код скрипта:
<%-- Eliminar Fornecedor is Requested --%>
<c:if test="${fn:contains(PagesInF,'FEliminar')}">
<table id="ProductTable" class="detailsTable">
<tr class="header">
<th colspan="8" >Products</th>
</tr>
<tr class="tableHeading">
<td>ID</td>
<td>Nome</td>
<td>Endereço</td>
<td>Descrição</td>
<td>Nº de Celulare</td>
<td>Nº de Telefone</td>
<td>Email</td>
<td>Fax</td>
<td></td>
</tr>
<c:forEach var="ELForn" items="${EFornecedorList}" varStatus="iter">
<tr class="${'white'} tableRow">
<td>${ELForn.getFid()}</td>
<td>${ELForn.getFNome()}</td>
<td>${ELForn.getFEndereco()}</td>
<td>${ELForn.getFDescricao()}</td>
<td>${ELForn.getFNCel()}</td>
<td>${ELForn.getFNTel()}</td>
<td>${ELForn.getFEmail()}</td>
<td>${ELForn.getFFax()}</td>
<td>
<form action="<c:url value='FEL'/>" method="post" name="FEliminar">
<input type="hidden"
name="MEId"
value="${ELForn.getFid()}">
<input id="FElim" type="button"
value="Eliminar">
</form>
</td>
</tr>
</c:forEach>
</table>
</c:if>
<%-- END Eliminar Fornecedor is Requested --%>
вот код заголовка jsp страницы:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="Css/Style.css">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<script src="/AffableBean/js/jquery-1.6.4.js" type="text/javascript"></script>
<script src="/AffableBean/js/jquery-ui-1.8.4.custom.min.js" type="text/javascript"></script>
<script src="/AffableBean/js/jquery.corners.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function(){
$('.rounded').corners();
$('a.categoryButton').hover(
function () {$(this).animate({backgroundColor: '#b2d2d2'})},
function () {$(this).animate({backgroundColor: '#d3ede8'})}
);
$('div.ActionBox').hover(over, out);
function over() {
var span = this.getElementsByTagName('span');
$(span[0]).animate({opacity: 0.3});
$(span[1]).animate({color: 'white'});
}
function out() {
var span = this.getElementsByTagName('span');
$(span[0]).animate({opacity: 0.7});
$(span[1]).animate({color: '#444'});
}
});
</script>
<title>Rimpex Stock Application</title>
</head>
<body>
<div id="main">
<div id="header">
<a href="<c:url value='Home'/>">
<img src="/StockWebApp/img/Letter_R_blue_Icon_64.png" id="logo" alt="Rimpex logo">
<img src="/StockWebApp/img/Letter_I_blue_Icon_64.png" id="logo" alt="Rimpex logo">
<img src="/StockWebApp/img/Letter_M_blue_Icon_64.png" id="logo" alt="Rimpex logo">
<img src="/StockWebApp/img/Letter_P_blue_Icon_64.png" id="logo" alt="Rimpex logo">
<img src="/StockWebApp/img/Letter_E_blue_Icon_64.png" id="logo" alt="Rimpex logo">
<img src="/StockWebApp/img/Letter_X_blue_Icon_64.png" id="logo" alt="Rimpex logo">
<img src="/StockWebApp/img/Letter_L_blue_Icon_64.png" id="logo" alt="Rimpex logo">
<img src="/StockWebApp/img/Letter_T_blue_Icon_64.png" id="logo" alt="Rimpex logo">
<img src="/StockWebApp/img/Letter_D_blue_Icon_64.png" id="logo" alt="Rimpex logo">
</a>
<div class="clr"></div>
<div id="Menu">
<c:if test="${fn:contains(PagesIn,'Home')}">
<ul>
<li class="active"><a href="<c:url value='Home'/>"><span class="bigText">Home</span></a></li>
<li><a href="<c:url value='Utilizador'/>"><span class="bigText">Utilizador</span></a></li>
<li><a href="<c:url value='LogOff'/>" id="LOf"><span class="bigText">Log Off</span></a></li>
<li><a href="<c:url value='About'/>"><span class="bigText">About</span></a></li>
</ul>
</c:if>
<c:if test="${fn:contains(PagesIn,'Utilizador')}">
<ul>
<li><a href="<c:url value='Home'/>"><span class="bigText">Home</span></a></li>
<li class="active"><a href="<c:url value='Utilizador'/>"><span class="bigText">Utilizador</span></a></li>
<li><a href="<c:url value='LogOff'/>"><span class="bigText">Log Off</span></a></li>
<li><a href="<c:url value='About'/>"><span class="bigText">About</span></a></li>
</ul>
</c:if>
<c:if test="${fn:contains(PagesIn,'LogOff')}">
</c:if>
<c:if test="${fn:contains(PagesIn,'About')}">
<ul>
<li><a href="<c:url value='Home'/>"><span class="bigText">Home</span></a></li>
<li><a href="<c:url value='Utilizador'/>"><span class="bigText">Utilizador</span></a></li>
<li><a href="<c:url value='LogOff'/>"><span class="bigText">Log Off</span></a></li>
<li class="active"><a href="<c:url value='About'/>"><span class="bigText">About</span></a></li>
</ul>
</c:if>
<c:if test="${fn:contains(PagesIn,'Mar')}">
<ul>
<li><a href="<c:url value='Home'/>"><span class="bigText">Home</span></a></li>
<li><a href="<c:url value='About'/>"><span class="bigText">About</span></a></li>
</ul>
</c:if>
</div>
</div>
<div id="Top1">
<c:if test="${!empty Cart}">
<div id="widgetBar">
<%-- checkout widget --%>
<div class="headerWidget">
<a href="#" class="rounded bubble">Avança a Saida</a>
</div>
<%-- shopping cart widget --%>
<div class="headerWidget" id="viewCart">
<a href="#" class="rounded bubble">
<img src="/StockWebApp/img/cart.gif" alt="shopping cart icon" id="cart">
<span class="horizontalMargin">
${cart.getNumberOfItems()} Itens
</span></a>
</div>
</div>
</c:if>
</div>
<div id="Top"></div>
<div class="clr"></div>
оповещения работают только на странице индекса. Так что, если у кого-то есть какие-либо идеи, пожалуйста, не стесняйтесь поделиться ими.