JWorld@TW the best professional Java site in Taiwan
      註冊 | 登入 | 全文檢索 | 排行榜  

» JWorld@TW » Servlet/JSP 討論區  

按列印兼容模式列印這個話題 列印話題    把這個話題寄給朋友 寄給朋友   
reply to topicthreaded modego to previous topicgo to next topic
本主題所含的標籤
作者 Unable to compile class for JSP如何解決[以解決]
as0955344054





發文: 107
積分: 0
於 2013-10-27 16:17 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我想請問一下我連結CLASS檔轉移到另一個網頁後取值發生問題

請問一下正規的程式PO法 下面白底要怎麼PO 知道了馬上從編輯 因為不知道去哪找跟下那些關鍵字所以只好在此發問

class檔內容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package system;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
 
public class testhttp extends HttpServlet{
  public testhttp() {
  }
 
  protected void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
    String url ="/related_tool.jsp";
    ServletContext sc = getServletContext();
    HttpSession session = req.getSession();
    String testint = "100";
    req.setAttribute("testint", testint);
    session.setAttribute("testint", testint);
    RequestDispatcher rd = sc.getRequestDispatcher(url);
    rd.forward(req, resp);
  }
  
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {
  
    doPost(req,resp);
  }
}

以下為錯誤資訊

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
type Exception report
 
message Unable to compile class for JSP:
 
description The server encountered an internal error that prevented it from fulfilling this request.
 
exception
 
org.apache.jasper.JasperException: Unable to compile class for JSP: 
 
An error occurred at line: 115 in the jsp file: /related_tool.jsp
testint cannot be resolved to a type
1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2: <%@ page contentType="text/html; charset=Big5" import = "java.sql.*"%>--->
3: <html xmlns="http://www.w3.org/1999/xhtml">
 
An error occurred at line: 116 in the jsp file: /related_tool.jsp
Duplicate local variable out
1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2: <%@ page contentType="text/html; charset=Big5" import = "java.sql.*"%>--->
3: <html xmlns="http://www.w3.org/1999/xhtml">
 
An error occurred at line: 116 in the jsp file: /related_tool.jsp
Syntax error on token ".", ; expected
1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2: <%@ page contentType="text/html; charset=Big5" import = "java.sql.*"%>--->
3: <html xmlns="http://www.w3.org/1999/xhtml">
 
An error occurred at line: 116 in the jsp file: /related_tool.jsp
The method write(String) is undefined for the type related_005ftool_jsp
1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2: <%@ page contentType="text/html; charset=Big5" import = "java.sql.*"%>--->
3: <html xmlns="http://www.w3.org/1999/xhtml">
 
Stacktrace:
  org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:103)
  org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:199)
  org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:467)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:378)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
  org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
  org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:606)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:403)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:347)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
  system.testhttp.doPost(testhttp.java:19)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:647)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
  org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

CLASS檔中轉移到另一個網頁有成功 但是卻無法讀取出需要的東西請問問題在哪裡!?[


as0955344054 edited on 2013-10-31 19:34
reply to postreply to post
作者 Re:Unable to compile class for JSP如何解決 [Re:as0955344054]
chuanchu





發文: 120
積分: 0
於 2013-10-27 22:35 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
http://www.javaworld.com.tw/jute/post/view?bid=2&id=15745
是JSP編譯有問題


reply to postreply to post
作者 Re:Unable to compile class for JSP如何解決 [Re:as0955344054]
cjc1010





發文: 49
積分: 0
於 2013-10-28 10:17 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
為什麼你的JSP會多紅色部分呢
<%@ page contentType="text/html; charset=Big5" import = "java.sql.*"%>--->


reply to postreply to post
作者 Re:Unable to compile class for JSP如何解決 [Re:chuanchu]
as0955344054





發文: 107
積分: 0
於 2013-10-28 15:40 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我知道是編譯有問題 不過有點看不懂他的問題所在

網址部分是能用的 有確實轉到對應網址 但是取變數時卻發生錯誤


reply to postreply to post
作者 Re:Unable to compile class for JSP如何解決 [Re:as0955344054]
chuanchu





發文: 120
積分: 0
於 2013-10-28 15:50 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
試著把JSP內容po上來
容器會在請求時轉譯、編譯再載入
所以是JSP內容有問題


reply to postreply to post
作者 Re:Unable to compile class for JSP如何解決 [Re:chuanchu]
as0955344054





發文: 107
積分: 0
於 2013-10-28 17:33 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
感謝您我去翻書嘗試看看 有問題再補充 感謝

reply to postreply to post
作者 Re:Unable to compile class for JSP如何解決 [Re:as0955344054]
chuanchu





發文: 120
積分: 0
於 2013-10-28 20:37 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
先翻書,是值得鼓勵的

reply to postreply to post
作者 Re:Unable to compile class for JSP如何解決 [Re:chuanchu]
as0955344054





發文: 107
積分: 0
於 2013-10-28 21:08 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
因為整體東西觀念不夠 我比較無法判斷是哪部分問題 所以不知從何下手
尤其是剛接觸 大概知道哪裡問題就盡量自己先找辦法解決


reply to postreply to post
作者 Re:Unable to compile class for JSP如何解決 [Re:chuanchu]
as0955344054





發文: 107
積分: 0
於 2013-10-31 19:34 user profilesend a private message to userreply to postreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
感謝您 從你說JSP部分有錯誤 我去翻書後找到解決辦法了

reply to postreply to post
» JWorld@TW »  Servlet/JSP 討論區

reply to topicthreaded modego to previous topicgo to next topic
  已讀文章
  新的文章
  被刪除的文章
Jump to the top of page

JWorld@TW 本站商標資訊

Powered by Powerful JuteForum® Version Jute 1.5.8