• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Have problem when I run jsp on server.

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
|---jsp
....|---Test.jsp
|---WEB-INF
....|---classes
....|---lib
........|---util.jar
............|---MTHelper (in jar file)
............|---javax.mail.* (in jar file)
............|---com.sun.mail.util.* (in jar file)


=== Test.jsp =================================================
<HTML>
<HEAD>
<%@page import="MTHelper" %>
<%@page import="javax.mail.*" %>
<TITLE>Test.jsp</TITLE>
</HEAD>
<BODY>
<P>Place content here.</P>
<%
String s = MTHelper.formatStringToPrint("122");
System.out.println("Value " + s);
%>
</BODY>
</HTML>

=== Screen Result ============================================
Error 500: Unable to compile class for JSP D:\workspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\IngeniumEar\Test.war\jsp\_Test.java:3: '.' expected import MTHelper; ^ An error occurred between lines: 9 and 12 in the jsp file: /jsp/Test.jsp Generated servlet error: D:\workspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\IngeniumEar\Test.war\jsp\_Test.java:80: cannot resolve symbol symbol : variable MTHelper location: class org.apache.jsp._Test String s = MTHelper.formatStringToPrint("122"); ^ 2 errors

=== Console Result ============================================
[10/11/04 14:14:56:484 ICT] 59cd11e7 WebGroup E SRVE0026E: [Servlet Error]-[Unable to compile class for JSP
D:\workspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\IngeniumEar\Test.war\jsp\_Test.java:3: '.' expected
import MTHelper;
^


An error occurred between lines: 9 and 12 in the jsp file: /jsp/Test.jsp

Generated servlet error:
D:\workspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\IngeniumEar\Test.war\jsp\_Test.java:80: cannot resolve symbol
symbol : variable MTHelper
location: class org.apache.jsp._Test
String s = MTHelper.formatStringToPrint("122");
^
2 errors
]: org.apache.jasper.JasperException: Unable to compile class for JSP
D:\workspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\IngeniumEar\Test.war\jsp\_Test.java:3: '.' expected
import MTHelper;
^


An error occurred between lines: 9 and 12 in the jsp file: /jsp/Test.jsp

Generated servlet error:
D:\workspace\.metadata\.plugins\com.ibm.etools.server.core\tmp0\cache\localhost\server1\IngeniumEar\Test.war\jsp\_Test.java:80: cannot resolve symbol
symbol : variable MTHelper
location: class org.apache.jsp._Test
String s = MTHelper.formatStringToPrint("122");
^
2 errors

at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:129)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.loadJSP(JspServlet.java:941)

----------------------------------------------
How can I run it work? I use websphere 5.1.2
[ October 12, 2004: Message edited by: Auttapol Pipatpatama ]
 
Ranch Hand
Posts: 548
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if MTHelper is java class in default package then you needn't import it explicitly using import statement and it should be available under classes folder or in a jar file in WEB-INF/lib folder.
 
author & internet detective
Posts: 42103
933
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Auttapol,
In the future, you can edit your posts by clicking on the page icon with a pencil.
 
Jeanne Boyarsky
author & internet detective
Posts: 42103
933
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Auttapol,
Do you have the jar containing MTHelper as a "java jar dependency" for your web project? You can check this by looking at the properties for the web project. "java jar dependencies" are used at runtime while the build path is used at compile time.
 
Paper beats rock. Scissors beats tiny ad.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic