• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

importing package in jsp

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
package test;
public class first{
public String showData(String str){
return str;
}
}

<%@ page language="java"%>
<%@ page import="test.first"%>
<html>

<%
String str=null;
first p=new first();
str=p.showData("Arun");
%>

<%=str%>

</html>

Dear sir i have created a test package and when i am importin it in my jsp package it is thrwing exception that cannot create class file for servlet why sir? can i not import any user define package.
finally i would like to know that what is wrong with above code.

with regard

Arun kumar maalik
 
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
(1) Did you put the class in WEB-INF\classes folder?
(2) Do you have a WEB-INF\web.xml file?
 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
yes sir i am using sun microsystem deployee tool
 
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
check in WEB-INF/classes folder contains test folder.
 
Ranch Hand
Posts: 93
Mac Objective C Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to run your code without modification, so the code at least does what it says it does.

That leads me to believe that:

1) The pojo is not .../webfiles/yourapp/WEB-INF/classes/test/first.class
(replace 'yourapp' with the name of your application), or

2) Somehow your app server (tomcat, resin, etc) is not set up properly
[ August 14, 2006: Message edited by: Rusty Smythe ]
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Rusty Smythe:
.../webfiles/yourapp/WEB-INF/test/first.class



Should be: WEB-INF/classes/test/first.class
 
Rusty Smythe
Ranch Hand
Posts: 93
Mac Objective C Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Bear Bibeault:
WEB-INF/classes/test/first.class



Do'ooh!
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No dessert!
[ August 14, 2006: Message edited by: Bear Bibeault ]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic