我的JSP在運行時給出錯誤404有人能幫我找到我的錯誤在哪裏嗎?我創建了帶請求參數(背景顏色)並響應的jsp頁面。我需要從java類調用方法。我還將我的JSP頁面放在WEB-INF文件夾中。這裏是我的代碼。JSP錯誤404我的錯誤在哪裏
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="com.java.MyJsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form action="./myjsp.jsp">
<input type="radio" name="color" value="color1" > Yellow<br>
<input type="radio" name="color" value="color2"> White<br>
<input type="radio" name="color" value="color3"> Gray<br>
<input type="submit" value="go">
</form>
<% String colors[]=request.getParameterValues("color");
for(int i=0;i<colors.length;i++){
if(colors[i].equals("")||colors[i]==null){ %>
<body style="background-color:<%=com.java.Myjsp.myColor()
%>;">
<% }
if(colors[i].equals("yellow")){
out.println("<html> <style> body{background-color:yellow;} </style>
</html>");
}
if(colors[i].equals("white")){
out.println("<html> <style> body{background-color:white;} </style>
</html>");
}
if(colors[i].equals("gray")){
out.println("<html> <style> body{background-color:gray;} </style>
</html>");
}
}
%>
</body>
</html>
你怎麼訪問你的JSP頁面條件在瀏覽器中? –
我剛剛在eclipse上運行服務器ee – user245548
發佈你的服務器代碼和'url'你正在訪問 –