Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

call servlet from applet

Status
Not open for further replies.

fuadhamidov

Programmer
Sep 22, 2003
98
TR
hi

i need to call servlet from applet to login users.

myUrl = "
Login servlet is in jar in web-inf/lib without any package.

while i try in java 1.3.x, it runs successfully.

the problem occur when i try in java 1.4.x. so i put my servlets to test.servlet package. but still i can't run them.

i try to call them from IE.
( but i meet "page not found" message

i don't know where is my mistake

i use Tomcat 5

thanks for any help
 
In your web.xml, you need these lines :

Code:
  <servlet>
	<servlet-name>MyServlet</servlet-name>
	<servlet-class>test.servlet.MyServlet</servlet-class>
  </servlet>
  <servlet-mapping>
	<servlet-name>MyServlet</servlet-name>
	<url-pattern>/servlet/MyServlet</url-pattern>
  </servlet-mapping>

assuming that your MyServlet is in package test.servlet - ie :

Code:
package test.servlet;

public class MyServlet ... {

}

Then you can hit the servlet via this URL :


--------------------------------------------------
Free Database Connection Pooling Software
 
thanks sedj

it works good

i have used this structure to call servlet when the user call jsp.
Code:
  <servlet>
    <servlet-name>MyServlet</servlet-name>
    <servlet-class>test.servlet.MyServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>MyServlet</servlet-name>
    <url-pattern>MyServlet.jsp</url-pattern>
  </servlet-mapping>

it is understandable that : the user call jsp and you redirect it to a servlet
but now i am calling servlet

And i can't understand why it is not problem java 1.3. and it is problem in java 1.4.

Do you know reason of problem?

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top