• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

fragment was not found error

 
Preethi Dev
Ranch Hand
Posts: 265
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers!

can anyone explain me how to get rid os this following error?

Fragment "/CalendarServlet" was not found at expected path /LowFareAir/WebContent/ CalendarServlet

does this mean that i have to keep the CalendarServlet.class file in webContent folder?

if so how can i do this in eclipse?

please help me to run this project. this is the only problem i am getting other things are fine.

Thanks in advance
Preetha
 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The class file should be under WEB-INF\classes folder. Can we have a look on your web deployment descriptor file(web.xml)?
 
Preethi Dev
Ranch Hand
Posts: 265
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


this is in web.xml
 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your servlet classes should be within the package named com.ibm.sample, and this package should be within WEB-INF\classes, and your form action should be somewhat like action="LoginServlet".
 
Preethi Dev
Ranch Hand
Posts: 265
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am not getting properly, how can i keep my class files under WebContent where my program was looking for CalenderServlet.java?

could you explain it ?

Thanks
Preetha
 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your web request is not looking for the .java file, rather its looking for the .class file. The folder for source(.java) might differ in different IDE. However the .class files for any web application always goes under WEB-INF\classes. What does your form action say?

In a web application the directory structure goes some what like this

context root folder -> typically contains the static contents like html,gif,jpg etc.
context root folder\WEB-INF- typically contains the descriptor file like web.xml
context root folder\WEB-INF\classes - contains the .class files like servlet, beans.
context root folder\WEB-INF\lib - contains third party runtime libraries for e.g. 3rd party jar files.
 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Once the server starts, if you enter the following in address bar

http://localhost:8080/LowFareAir/CalendarServlet

The port number might differ in your case.

what do you get? Same error or something else.
 
Preethi Dev
Ranch Hand
Posts: 265
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did run the CalendarServlet.Java which gives the URL as "http://localhost:8080/LowFareAir/CalendarServlet" .

That i program is working. my class files are not getting identified by welcome.Jsp which uses itz class file.

In my programming structure i could not see any class files.
I have done something like

bulid path--->I set the default output folder as----->LowFareAir/WebContent/WEB-INF/classes

please help me to solve this.

Thanks In advance
Preetha
SCJP 1.5
 
Swastik Dey
Rancher
Posts: 1601
5
Android Java Java ME
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You won't see the class files in program structure. All web components are compressed in web achieve (.war) file. I am not very sure where eclipse keeps that in netbeans it appears under dist folder under your application folder, and by the way what is the code to invoke the servlet in your welcome.jsp file? As per your servlet mapping in web.xml there should not be any sub folder like webcontent, and the default output folder that you mentioned probably stores the war file.
 
Preethi Dev
Ranch Hand
Posts: 265
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

code] <jsp:include page="/CalendarServlet"> <------------shows error here as fragment was not found at the path
<jsp:param name="type" value="orig" />
</jsp:include>[ [/code]

This is the code i am using to invoke the servlet from welcome.jsp.
 
Preethi Dev
Ranch Hand
Posts: 265
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
anyone there to help me?


Preetha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic