Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet Invocation problem through Hyperlinks

 
abhinav singhal
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have developed a very simple application.The problem I am facing is calling servlet through an HTML's hyperlink.

I have given the code as:

<a Href="http://localhost:7001/Forum/Servlet" >Servlet</a>

in the HTML

Here the "Forum" is a folder which has WEB-INF and within WEB-INF Class called Servlet is kept.

So now as I am using weblogic I am unable to direct the servlet request directly to the "Servlet" class. Actually, I am avoiding invocation of class through the DD.And, I want to get the "servlet" invoked when the user clicks on the hyperlink

Please let me know what may be the problem.

Regards,
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it needs to be {YOUR_APP}/WEB-INF/classes/{YOUR_PACKAGE}/{YOUR_SERVLET_CLASS}

You then need to map your servlet in your deployment descriptor (web.xml).

Here is a deployment descriptor for a simple hello, world type servlet
 
abhinav singhal
Greenhorn
Posts: 29
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Do you mean that in the hyperlink itself I have to give

"http://localhost:7001/Forum/WEB-INF/Classes/Servlet"

1) Does the hyperlink send the request to server or it just acts as a simple link?

Regards,
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13047
6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, he means what he said - your web.xml has to define the servlet and the url that will connect to it. Your link must use the url defined in web.xml - see the servlet mapping entry in the example.

1) Does the hyperlink send the request to server or it just acts as a simple link?

ALL links cause a separate GET request.
Bill
[ August 22, 2005: Message edited by: William Brogden ]
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by abhinav singhal:
Hi,

Do you mean that in the hyperlink itself I have to give

"http://localhost:7001/Forum/WEB-INF/Classes/Servlet"

1) Does the hyperlink send the request to server or it just acts as a simple link?

Regards,


Assuming the contextPath (application name) is "MyApp", the url would be.
Also assuming an "out of the box" Tomcat installation..

http://localhost:8080/MyApp/simple-servlet
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic