- 这个问题现在已经解决了。我忘了添加JSTL库 -
我有一个使用jquery-toastmessage-plugin的基于网络的应用程序。我正在使用JSTL捕获URL参数并通过Toast消息显示它们。以下是我在index.jsp
的相关代码。
<!--show messages-->
<script type="text/javascript" src="js/jquery.toastmessage.js"></script>
<link type="text/css" href="css/jquery.toastmessage.css" rel="stylesheet"/>
<script type="text/javascript">
function showSuccessToast() {
$().toastmessage('showSuccessToast', "${resultMessage}");
}
function showStickySuccessToast() {
$().toastmessage('showToast', {
text : 'Success Dialog which is sticky',
sticky : true,
position : 'top-right',
type : 'success',
closeText: '',
close : function () {
console.log("toast is closed ...");
}
});
}
function showNoticeToast() {
$().toastmessage('showNoticeToast', "Notice Dialog which is fading away ...");
}
function showStickyNoticeToast() {
$().toastmessage('showToast', {
text : 'Your Trial is expired. Please apply for an paid account.',
sticky : true,
position : 'top-right',
type : 'notice',
closeText: '',
close : function () {console.log("toast is closed ...");}
});
}
function showWarningToast() {
$().toastmessage('showWarningToast', "Warning Dialog which is fading away ...");
}
function showStickyWarningToast() {
$().toastmessage('showToast', {
text : 'Warning Dialog which is sticky',
sticky : true,
position : 'top-right',
type : 'warning',
closeText: '',
close : function () {
console.log("toast is closed ...");
}
});
}
function showErrorToast() {
$().toastmessage('showErrorToast', "${resultMessage}");
}
function showStickyErrorToast() {
$().toastmessage('showToast', {
text : 'Error Dialog which is sticky',
sticky : true,
position : 'top-right',
type : 'error',
closeText: '',
close : function () {
console.log("toast is closed ...");
}
});
}
</script>
<!--/show messages-->
<!--error message display-->
<c:if test="${param.isTrial!=null}">
<c:if test="${not param.isTrial}">
<script>
window.onload = function() {
showStickyNoticeToast();
};
</script>
</c:if>
</c:if>
以下是我从URL传递参数的方法。
response.sendRedirect("index.jsp?isTrial=true");
现在我的问题是,isTrial
param是真还是假,无论是否为空都无关紧要,toastmessage总是会显示出来。我在这做错了什么?