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 页面表单,如果用户单击提交按钮,那么 JSP 应该将值传递给 Java 类(而不是 servlet)我该怎么做?
您需要使用 Servlet 或 JSP。如果不想要 Servlet,则创建另一个 JSP。例如otherJsp.jsp,只有如下脚本:
otherJsp.jsp
<% MyClass obj = new MyClass(); obj.myMethod(request.getParameterMap()); %>
MyClass 是您要发送参数的类。在提交点击您的 jsp 时,将操作称为otherJsp.jsp