我开始学习Java网络,我需要一些有关为什么我的代码无法正常工作的见解 当我尝试提交我的代码时,我注意到当我转到页面时应该进行更改的地方什么都不会显示。
我将显示一些代码
发布方法
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
from scipy.integrate import solve_ivp
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from animate_plot import animate
def upward_cannon(t, y):
return [y[1], -0.5]
def hit_ground(t, y):
return y[0]
def apex(t,y):
return y[1]
hit_ground.terminal = True
hit_ground.direction = -1
t0 = 0
tf = 10
sol = solve_ivp(upward_cannon, t_span=[t0, tf], y0=[90, 10], t_eval=np.arange(t0,tf, 0.01), events=[hit_ground,apex],
dense_output=True)
linesData = { 1: [[-0.0, 0.0],[0.0, 0.0]]}#,
# 2: [[-0.5, 0],[0.5, 0.0]]}#, 3: [[-0.5, 0],[0.5, 0]]}
pointsofInterest = {}#3: [[0.5, 0.0]]}#, 2: [[180.0, 10]]}
model_markers = np.array([])
plot_title = 'Upward Particle'
plot_legend = ['Forward Dynamics']
q_rep = sol.y.T[:,0]
fig = plt.figure()
ax = fig.add_subplot(111)
xs = np.arange(t0, tf, 0.01)
for idx in range(0,q_rep.shape[0]): #looping statement;declare the total number of frames
y=q_rep[idx] # traveling Sine wave
ax.cla()
ax.scatter(xs[idx],y, s=50)
plt.ylim([-10, 190])
plt.xlim([-100, 100])
plt.pause(0.001)
plt.show()
获取方法
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String titulo = request.getParameter("titulo");
String imagem = request.getParameter("imagem");
String descricao = request.getParameter("descricao");
String categoria = request.getParameter("categoria");
Noticias noticia = new Noticias();
System.out.println(titulo);
noticia.setTitulo(titulo);
System.out.println(descricao);
noticia.setDescricao(descricao);
System.out.println(categoria);
noticia.setCategoria(categoria);
System.out.println(categoria);
noticia.setImagem(imagem);
Noticias.dados.add(noticia);
response.sendRedirect(categoria);
}
输入
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
我的sysout不显示任何输出。 而且它在页面上没有显示任何更改,我想帖子没有初始化
答案 0 :(得分:0)
如果要提交表单,则必须在表单标签中提及方法和操作属性。
<form action="servletname" method="post">
该servlet也应该出现在web.xml中。
您可以点击此链接https://www.journaldev.com/1877/servlet-tutorial-java