Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

importing package in jsp  RSS feed

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • 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
 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
yes sir i am using sun microsystem deployee tool
 
sai prasanna
Ranch Hand
Posts: 167
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
check in WEB-INF/classes folder contains test folder.
 
Rusty Smythe
Ranch Hand
Posts: 93
Mac Objective C Ruby
  • Mark post as helpful
  • send pies
  • 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 ]
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Originally posted by Bear Bibeault:
WEB-INF/classes/test/first.class


Do'ooh!
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66141
141
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No dessert!
[ August 14, 2006: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!