第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Tomcat服務(wù)器運行Eclipse失敗

Tomcat服務(wù)器運行Eclipse失敗

汪汪一只貓 2023-07-19 15:45:53
我正在嘗試使用 tomcat 服務(wù)器版本 9 運行 java 應(yīng)用程序。當(dāng)我創(chuàng)建第一個項目并且項目運行成功但問題是當(dāng)我創(chuàng)建另一個項目并將該項目分配給服務(wù)器時,我收到以下錯誤。服務(wù)器 Tomcat v9.0 本地主機上的服務(wù)器無法啟動。這是index.html的代碼<!DOCTYPE html><html><body><body><form action="login">User Name:<input type="text" name="userName"/>Password:<input type="password" name="userPassword"/><input type="submit" value="submit"/></form></body></html>這是 Servlet 代碼。package Edureka;import java.io.*;import javax.servlet.annotation.WebServlet;import javax.servlet.http.*;@WebServlet("/login")public class MyServlet1 extends HttpServlet{/**     *      */    private static final long serialVersionUID = 1L;public void doGet(HttpServletRequest request,  HttpServletResponse response) {try{response.setContentType("text/html");PrintWriter pwriter = response.getWriter();String name = request.getParameter("userName");String password = request.getParameter("userPassword");pwriter.print("Hello here:"+name);pwriter.print(" Your Password is: "+password);//Creating two cookiesCookie c1=new Cookie("userName",name);Cookie c2=new Cookie("userPassword",password);//Adding the cookies to response headerresponse.addCookie(c1);response.addCookie(c2);pwriter.print("<a href='welcomehere'>View Details</a>");pwriter.close();}catch(Exception exp){System.out.println(exp);}}}這是 web.xml 文件。<?xml version="1.0" encoding="UTF-8"?><web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd" id="WebApp_ID" version="4.0">  <display-name>Cookies</display-name> <servlet><servlet-name>Servlet1</servlet-name><servlet-class>Edureka.MyServlet1</servlet-class></servlet>這是我嘗試在 Eclipse 中運行它時的屏幕截圖。
查看完整描述

1 回答

?
胡子哥哥

TA貢獻(xiàn)1825條經(jīng)驗 獲得超6個贊

您正在使用具有相同 URI 的部署描述符中的WebServlet注釋和映射。url-pattern只在一個地方這樣做。



查看完整回答
反對 回復(fù) 2023-07-19
  • 1 回答
  • 0 關(guān)注
  • 128 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號