|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Jul 2001
Messaggi: 9947
|
[JSP] Altro errore, stavolta nell'uso di 1 bean!
Che balle siamo alle solite ...
Generated servlet error: Rotator cannot be resolved or is not a type. Codice:
HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message 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: 4 in the jsp file: /AdRotator.jsp Generated servlet error: Rotator cannot be resolved or is not a type An error occurred at line: 4 in the jsp file: /AdRotator.jsp Generated servlet error: Rotator cannot be resolved or is not a type An error occurred at line: 4 in the jsp file: /AdRotator.jsp Generated servlet error: Rotator cannot be resolved or is not a type An error occurred at line: 27 in the jsp file: /AdRotator.jsp Generated servlet error: Rotator cannot be resolved or is not a type An error occurred at line: 30 in the jsp file: /AdRotator.jsp Generated servlet error: Rotator cannot be resolved or is not a type org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84) org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:328) org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:397) org.apache.jasper.compiler.Compiler.compile(Compiler.java:288) org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
__________________
Aiuta la ricerca col tuo PC: >>Calcolo distribuito BOINC.Italy: unisciti anche tu<< Più largo è il sorriso, più affilato è il coltello. Ultima modifica di Matrixbob : 21-06-2005 alle 17:28. |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Jul 2001
Messaggi: 9947
|
Il file.jsp è questo:
Codice HTML:
<?xml version = "1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <jsp:useBean id = "rotator" scope = "application" class = "Rotator" /> <html xmlns = "http://www.w3.org/1999/xhtml"> <head> <title>AdRotator Example</title> <style type = "text/css"> .big { font-family: helvetica, arial, sans-serif; font-weight: bold; font-size: 2em } </style> <% rotator.nextAd(); %> </head> <body> <p class = "big">AdRotator Example</p> <p> <a href = "<jsp:getProperty name = "rotator" property = "link" />"> <img src = "<jsp:getProperty name = "rotator" property = "image" />" alt = "advertisement" /> </a> </p> </body> </html>
__________________
Aiuta la ricerca col tuo PC: >>Calcolo distribuito BOINC.Italy: unisciti anche tu<< Più largo è il sorriso, più affilato è il coltello. Ultima modifica di Matrixbob : 21-06-2005 alle 17:28. |
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Jul 2001
Messaggi: 9947
|
Questo dovrebbe essere il bean.java:
Codice:
public class Rotator { private String images[] = { "images/jhtp3.jpg", "images/xmlhtp1.jpg", "images/ebechtp1.jpg", "images/iw3htp1.jpg", "images/cpphtp3.jpg" }; private String links[] = { "http://www.amazon.com/exec/obidos/ASIN/0130125075/" + "deitelassociatin", "http://www.amazon.com/exec/obidos/ASIN/0130284173/" + "deitelassociatin", "http://www.amazon.com/exec/obidos/ASIN/013028419X/" + "deitelassociatin", "http://www.amazon.com/exec/obidos/ASIN/0130161438/" + "deitelassociatin", "http://www.amazon.com/exec/obidos/ASIN/0130895717/" + "deitelassociatin" }; private int selectedIndex = 0; // returns image file name for current ad public String getImage() { return images[ selectedIndex ]; } // returns the URL for ad's corresponding Web site public String getLink() { return links[ selectedIndex ]; } // update selectedIndex so next calls to getImage and // getLink return a different advertisement public void nextAd() { selectedIndex = ( selectedIndex + 1 ) % images.length; } }
__________________
Aiuta la ricerca col tuo PC: >>Calcolo distribuito BOINC.Italy: unisciti anche tu<< Più largo è il sorriso, più affilato è il coltello. Ultima modifica di Matrixbob : 21-06-2005 alle 17:29. |
![]() |
![]() |
![]() |
#4 |
Senior Member
Iscritto dal: Jul 2001
Messaggi: 9947
|
Ok adesso creando un package mi da quest'altro, ma mia pre un passo avanti:
Codice:
HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: /AdRotator.jsp(4,0) The value for the useBean class attribute Rotator is invalid. org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39) org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:405) org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:146) org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1223) org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219) org.apache.jasper.compiler.Node$Root.accept(Node.java:456) org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) org.apache.jasper.compiler.Generator.generate(Generator.java:3270) org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:189) org.apache.jasper.compiler.Compiler.compile(Compiler.java:286) org.apache.jasper.compiler.Compiler.compile(Compiler.java:267) org.apache.jasper.compiler.Compiler.compile(Compiler.java:255) org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:556) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:293) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:291) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.5.9 logs.
__________________
Aiuta la ricerca col tuo PC: >>Calcolo distribuito BOINC.Italy: unisciti anche tu<< Più largo è il sorriso, più affilato è il coltello. Ultima modifica di Matrixbob : 21-06-2005 alle 17:29. |
![]() |
![]() |
![]() |
#5 |
Senior Member
Iscritto dal: Jul 2001
Messaggi: 9947
|
Funziona, si ma che stress ho dovuto modificare in questo modo:
<jsp:useBean id = "rotator" scope = "application" class = "bean.Rotator" /> il file.jsp. Qui ogni cosa va fatta in un modo diverso. Sono distrutto!! ![]()
__________________
Aiuta la ricerca col tuo PC: >>Calcolo distribuito BOINC.Italy: unisciti anche tu<< Più largo è il sorriso, più affilato è il coltello. |
![]() |
![]() |
![]() |
#6 |
Senior Member
Iscritto dal: Jan 2001
Città: Milano
Messaggi: 5705
|
metti il package anche nell'attributo class di useBean
edit: non avevo visto che avessi già risolto. ma i post li fai in tempo mentre lavori? aspetta di avere qualcosa che non riesci a risolvere prima di postare ![]() Ultima modifica di kingv : 08-06-2005 alle 13:23. |
![]() |
![]() |
![]() |
#7 | |
Senior Member
Iscritto dal: Jul 2001
Messaggi: 9947
|
Quote:
Ma tanto li includo come link d'esempio al [Tutorial], non ho voglia di riordinarli apposta, quindi li linko.
__________________
Aiuta la ricerca col tuo PC: >>Calcolo distribuito BOINC.Italy: unisciti anche tu<< Più largo è il sorriso, più affilato è il coltello. |
|
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 11:48.