58120

Web-xml to a servlet under default package Eclipse

I have a question regarding a servlet placed in a default package.

Under web-xml, I am supposed to map the servlets.

What do I key in under in eclipse if the servlet is in the default package?

I understand that all classes should be put in proper packages but the above is a practice question.

Could anyone let me know as I cant seem to find the answer on the internet.

Thanks

Answer1:

Let's assume your Servlets class is "HelloTest" and name is hello, Then Web.xml entry should be

<servlet> <servlet-name>hello</servlet-name> <servlet-class>HelloTest</servlet-class> </servlet>

Also Please check This post also

Answer2:

The entry in the web.xml should be like this,

<servlet> <servlet-name>Test</servlet-name> <servlet-class>Test</servlet-class> </servlet> <servlet-mapping> <servlet-name>Test Servlet</servlet-name> <url-pattern>/test/*</url-pattern> </servlet-mapping>

You can follow this article for further details http://www.eclipse.org/webtools/community/tutorials/BuildJ2EEWebApp/BuildJ2EEWebApp.html

Recommend

  • Can I implement a socket server on Tomcat using GenericServlet?
  • GWT and web.xml
  • Loading Resources Once in Java
  • Allocating a 2D contiguous array within a function
  • Is it mandatory to have a doGet or doPost method?
  • Refactoring advice: maps to POJOs
  • cordova is not defined - cordova.js has already been loaded :: Ionic
  • jQuery: add elements until a particular height is reached
  • pillow imaging ImportError
  • Combining two different ActiveRecord collections into one
  • Why use database factory in asp.net mvc?
  • Can someone please explain to me in the most layman terms how to use EventArgs?
  • converting text file into xml using php?
  • Problems installing Yesod for Haskell
  • error importing numpy
  • Assign variable to the value in HTML
  • How to use carriage return with multiple line?
  • Java: can you cast Class into a specific interface?
  • AES padding and writing the ciphertext to a disk file
  • Updating server-side rendering client-side
  • Cross-Platform Protobuf Serialization
  • How to extract text from Word files using C#?
  • Javascript Callbacks with Object constructor
  • Statically linking a C++ library to a C# process using CLI or any other way
  • Jquery - Jquery Wysiwyg return html as a string
  • Arrays break string types in Julia
  • Proper folder structure for lots of source files
  • SQL merge duplicate rows and join values that are different
  • WPF Applying a trigger on binding failure
  • python regex in pyparsing
  • Acquiring multiple attributes from .xml file in c#
  • Java static initializers and reflection
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • unknown Exception android
  • Is there any way to bind data to data.frame by some index?
  • Observable and ngFor in Angular 2
  • How can i traverse a binary tree from right to left in java?
  • How can I use `wmic` in a Windows PE script?
  • Unable to use reactive element in my shiny app