File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Websphere and the fly likes Have problem when I run jsp on server. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Have problem when I run jsp on server." Watch "Have problem when I run jsp on server." New topic
Author

Have problem when I run jsp on server.

Auttapol Pipatpatama
Greenhorn

Joined: May 31, 2004
Posts: 11
|---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 ]

Auttapol Pipatpatama<br />SCJP 1.4, SCWCD 1.4, <br />SCBCD Preparing
Rr Kumaran
Ranch Hand

Joined: Sep 17, 2001
Posts: 548
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.


RR Kumaran
SCJP 1.4
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

Auttapol,
In the future, you can edit your posts by clicking on the page icon with a pencil.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Have problem when I run jsp on server.
 
Similar Threads
using h:inputHidden in JSF
Edit JSP or Servlet refresh error
webshere 5
problem with connectiing to oracle from WSAD
Problem retrieving javabean instance from request in JSP