Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我可以根据请求参数值在加载 JSP 文件时调用 javascript 函数吗?我想从我的 Servelt 向 JSP 发送一个请求,如果参数的值 =“某事”我想调用一个特定的 JS 函数。那可能吗?如果可用,请向我发送任何相关示例。
提前谢谢
根据您的问题,我认为这是您想要尝试的
<% String text = request.getParameter("parameter"); %> <html> <head> <script> var text1="<%=text%>"; if(text1.length>0) { //do what you want call function or something } </script> </head> <body> </body> <html>