aspose file tools*
The moose likes Servlets and the fly likes request into servet thru browser Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "request into servet thru browser" Watch "request into servet thru browser" New topic
Author

request into servet thru browser

sabu ekm
Greenhorn

Joined: Jan 15, 2005
Posts: 19
hellow,
i am working in jboss 3.2.3, srtuts.
im using an applet in my home page which requests into
a servlet, retrives some data and display it in the
requesting applet.

The problem is, while requesting iam getting
an error message "requested resource is not available".

i have witten entries in web.xml for my servlet.

the entry is given below

<servlet>
<servlet-name>checkEventServlet</servlet-name>
<servlet-class>com.mitoiis.servletextension.CheckEventServlet</servlet-class>
<load-on-startup>0</load-on-startup>
</servlet>


i tried all these URL s and got the same error.

http://localhost/checkEventServlet
http://localhost/servletextension.checkEventServlet
http://localhost/servletextension.CheckEventServlet


there is no need to use the port number bcase im using port 80
- which is the default port.

and also pls tell me details abt <load-on-startup>.

thanks in advance.
plese help me because im just a beginner in servlet programming.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

You will also need to map your servlet in web.xml

In this case, you would hit the servlet with: http://localhost:8080/simple-mvc

'load-on-startup' tells the server to load that servlet when it starts up.
It's often helpful, if the servlet has a lot of initialization to do when it's first loaded, to do all this when the app starts instead of waiting until the first time someone hits it with a browser. The number in the body
allows you to control the order in which your servlets are loaded.

Before context listeners, it was also used often for application initialization.

Originally posted by sabu:
there is no need to use the port number bcase im using port 80
- which is the default port.

Have you configured your server to use Port 80?

Tocmat, which I believe, it what JBoss is using as it's servlet container ships configured to use port 8080.

Tomcat
[ January 15, 2005: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
David O'Meara
Rancher

Joined: Mar 06, 2001
Posts: 13459

"sabu",
Welcome to the JavaRanch!

We're pretty light on rules, but one we take very seriously is one about display names. You can read about it here but basically we require your display name to be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and fix your display name, since accounts with invalid display names get deleted, often without warning

thanks,
Dave
sabu ekm
Greenhorn

Joined: Jan 15, 2005
Posts: 19
hellow Ben,
Thanks for your advise. i changed web.xml and got the result very well. but still iam having 1 problem. eventhough iam getting the correct result in browser, in the console of jboss iam getting an exception while iam starting my local jboss.


************

The content of
element type "web-app" must match "(icon?,display-name?,description?,distributab
le?,context-param*,filter*,filter-mapping*,listener*,servlet*,servlet-mapping*,s
ession-config?,mime-mapping*,welcome-file-list?,error-page*,taglib*,resource-env
-ref*,resource-ref*,security-constraint*,login-config?,security-role*,env-entry*
,ejb-ref*,ejb-local-ref*)".
org.xml.sax.SAXParseException: The content of element type "web-app" must match
"(icon?,display-name?,description?,distributable?,context-param*,filter*,filter-
mapping*,listener*,servlet*,servlet-mapping*,session-config?,mime-mapping*,welco
me-file-list?,error-page*,taglib*,resource-env-ref*,resource-ref*,security-const
raint*,login-config?,security-role*,env-entry*,ejb-ref*,ejb-local-ref*)".
************



but iam sure that there is no syntax error in web.xml.
but the only problem is iam getting this error while starting jboss.
if u know any solution pls help me to solve it


the program is running wonderfully and i would like to thank you once again
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

The mesage either means that there is a syntax error in web.xml or if your depending on the version of your servlet container, the order of the elements in web.xml is wrong. The error message lists the order that the elements need to be listed.

Starting with Servlet Spec 2.4 you can use an arbitrary order for sub-elements of web-app.

If I had to guess....
You have:
SERVLET
MAPPING
SERVLET
MAPPING

Change to:
SERVLET
SERVLET
MAPPING
MAPPING
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: request into servet thru browser