一個Struts問題,很頭疼

HTTP Status 404 - /strutsTest/WebRoot/Login.do


type Status report

message /strutsTest/WebRoot/Login.do

description The requested resource (/strutsTest/WebRoot/Login.do) is not available.


Apache Tomcat/6.0.10

 

*********************************************************************************************

自己在網上搜到了一些相關的方法,但是似乎沒用:

[Error!]the type java.lang.object cannot be resolved. it is indirectly reference

文章分類:Java編程

MyEclipse 導入項目時出現如下錯誤,檢查過,包的導入都正常

Error!]the type java.lang.object cannot be resolved. it is indirectly referenced from required .class files



找了半天,才發現,原來是jdk的問題,原來是沒有導入jdk的包。

也有可能是這個原因:電腦上有多個jdk的版本,這樣MyEclipse導入的時候就會出現問題,一般情況下,使用MyEclipse自己帶的Jdk版本,我裝的是jdk 1.6.013 ,即使重新導入這個也不管用,後面只好用Myeclipse自己帶的1.6.0013的版本就好了。



操作步驟:project->properties->Java Bulid Path  將原有的jdk刪除 

   然後Java Build Path -----> Libraries---->Add Libraries----->JRE System Library   選擇MyEclipse自帶的jdk或是選擇自己適合的包即可。
摘自:http://zhuxinzx.javaeye.com/blog/697200
*********************************************************************************************

It is indirectly referenced from required .class file 問題解決

關鍵字: eclipse

原因:你正要使用的類調用了另一個類,而這個類又調用了其他類,這種關係可能會有好多層。而在這個調用的過程中,某個類所在的包的缺失就會造成以上那個錯誤。

解決方法:導入缺失的包

**********************************************************************************************

Servlet問題:servlet cannot be resolved to a type解決辦法

Servlet測試代碼:

package testservlet;
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;

 

public class servlet1 extends HttpServlet {
private static final String CONTENT_TYPE="text/html;charset=GBK";
public void init() throws ServletException{
  
}
public void doGet(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
   response.setContentType(CONTENT_TYPE);
   PrintWriter out=response.getWriter();
   out.println("<html>");
   out.println("<head><title>讓中文不再是亂碼</title></head>");
   out.println("<body bgcolor=/"#ffffff/">");
   out.println("<span style=/"font-size:9pt;/">&nbsp;&nbsp;&nbsp;&nbsp;讓輸出的中文不再是亂碼!<br><br>");
   out.println("這回總算可以看到你的真面目啦</span>");
   out.println("</body></html>");
}
public void doPost(HttpServletRequest request,HttpServletResponse response)throws ServletException,IOException{
   doGet(request,response);
}
public void destroy(){
  
}

}

然而在eclipse裏卻顯示

servlet cannot be resolved to a type

servlet.http cannot be resolved to a type

找了半天資料才知道jdk 裏不包括servlet-api.jar這個包,於是到tomcat裏找到這個包複製到jdk/jre/lib下

再設置classpath,結果還是無濟於事,後來闖進一個英文論壇看到似乎好像說工程裏的路徑權限高,並且eclipse併到classpath裏尋找jar位置,所以我就到我的java項目裏

項目名-->右鍵

Property-->選擇

Java Build Path-->選擇

Add External JARs-->選擇

把servlet-api.jar的路徑輸入即可 該包在tomcat裏有 搜索即課找到

 

來自: http://hi.baidu.com/night%5Fto%5Fn/blog/item/94de35a222e573a8cbefd0e4.html
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章