我试图提交表单但由于某种原因它无效。这是我创建的servlet:
@SuppressWarnings("serial")
public class CreateCreditCardServlet extends HttpServlet implements Servlet {
private final static Logger LOGGER = Logger.getLogger(CreateCreditCardServlet.class.getName());
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
LOGGER.debug("doGet");
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
LOGGER.debug("doPost");
}
}
及其在 web.xml
中的说明<servlet>
<servlet-name>braintree-create-credit-card</servlet-name>
<servlet-class>com.mahlzeit.server.servlet.braintree.CreateCreditCardServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>braintree-create-credit-card</servlet-name>
<url-pattern>/app/create-credit-card</url-pattern>
</servlet-mapping>
这是FormPanel
:
<g:FormPanel ui:field="formCreditCard" action="/app/create-credit-card" method="post">
<g:HTML>
<input data-braintree-name="number" value="4111111111111111"/>
<input data-braintree-name="cvv" value="100"/>
<input data-braintree-name="expiration_date" value="10/20"/>
<input data-braintree-name="postal_code" value="94107"/>
<input data-braintree-name="cardholder_name" value="John Smith"/>
</g:HTML>
</g:FormPanel>
我基本上只在submit()
FormPanel
this.formCreditCard.submit();
由于某种原因,服务器端永远不会执行。 doPost()
永远不会被执行。
这里有什么问题?