简体   繁体   English

JavaScript 在屏幕上的所有按钮的 onclick 事件中调用一个方法,即使指定按钮的 onclick 调用不同

[英]JavaScript a method is called in onclick event in all of the buttons on the screen, even if the call onclick at a specified button is different

I have a caching problem on a button event in Java EE.我在 Java EE 中的按钮事件上遇到缓存问题。 In JSP, I call an inline JavaScript method in JSP page.在 JSP 中,我在 JSP 页面中调用内联 JavaScript 方法。 This method requests a function in a Java class.此方法请求 Java 类中的函数。 Communication between the JSP and the method of java class occurs via structs. JSP 和 java 类的方法之间的通信是通过结构进行的。 The problem is that after I modified this java class, all JSP screen links squeegee when the application calls the same JavaScript method.问题是我修改了这个java类后,当应用程序调用同一个JavaScript方法时,所有JSP屏幕链接squeegee。 But this method is only called through a onClink() event is a screen button.但是这个方法只能通过一个 onClink() 事件调用,是一个屏幕按钮。 Now all JSP buttons are calling this method, even if your event JavaScript onClink is calling another method.现在所有的 JSP 按钮都在调用这个方法,即使你的事件 JavaScript onClink 正在调用另一个方法。 If the problem is not the call of JavaScript methods, how do I solve this problem?如果问题不是 JavaScript 方法的调用,我该如何解决这个问题? Refreshing this page does not.刷新此页面不会。

An alternative would be to clear the cache only javascript.另一种方法是仅清除缓存 javascript。 And keep the session java application and any other infromação of aplciação java web browser.并保持会话 java 应用程序和任何其他 aplciação java web 浏览器的 infromação。 The problem began to occur when I made an appointment in a java method using as parameter the "ApplicationForm" that takes the form data and use it as research.当我在java方法中使用“ApplicationForm”作为参数进行预约时,问题开始出现,该“ApplicationForm”接受表单数据并将其用作研究。 But for some reason this confunfoiu the browser但由于某种原因,这混淆了浏览器

I do not want to sound ridiculous, but I can not put the code here.It is copyrighted and owned the company.我不想听起来很荒谬,但我不能把代码放在这里。它是受版权保护的公司所有。 But it is quite simple.但它很简单。 Generic something would be.通用的东西。

JSP Page JSP页面

The method includes call该方法包括调用

// code jsp
<script>

incluirChamada function () {
// Calls the "javascript: incluirChamadaJava" java class via structs

}

the problem is that all the buttons call the incluirChamada () method.问题是所有的按钮都调用了 incluirChamada() 方法。 even if your onclink are specifying to another class即使您的 onclink 正在指定另一个类

In the java code ...在java代码中...

javascript: incluirChamadaJava (ApplicationForm form) {

mehod slectUsingHibernate (Filter form) {

}
}

debug your code.调试您的代码。 You problem have some function that is not closed properly.您的问题有一些未正确关闭的功能。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM