• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Making a servlet call from a form in a JSP, but the servlet is inside a .jar

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, Good day!

I'm used to working with MVC architecture based projects, however, i'm trying to remove completely the view from one of my projects, so that the person that will deploy the project would have to provide a custom (jsp) view by themself. I'm working with java 11 and apache tomcat 8 (dynamic webModule 3.1).

So, i know that usually one would call a servlet trough a form in a jsp, using one of its servlet mappings, like this:


         <form action="LogIn" method="post">
<input id="inputEmail" name="inputEmail" type="text" placeholder="Email" required="required">
<br>
<input id="inputPassword" name="inputPassword" type="password" placeholder="Password" required="required">
<br>
<button type="submit">Log In!</button>
</form>


How could i do the same but having my servlet inside a .jar?

for more context, my project looks something like this:



Project/
├── README.md
├── src
│   ├── data
│   ├── entities
│   ├── logic
│   └── servlets
|
└── WebContent  -------------> folder (the "view" layer) to not be packaged into the .jar. Rest of the project is inside a .jar
        ├── META-INF
        ├── index.jsp
        ├── LogInForm.jsp
        └── WEB-INF




Thanks in advance for the replies!
 
Saloon Keeper
Posts: 28325
210
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch, Matt!

All of the classes (and classpath resources) in JARs inside the WAR's /WEB-INF/lib directory get added to the webapp's classpath just as if they were in /WEB-INF/classes. You don't have to do anything.
 
Matt Navop
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank You for the quick and concise reply,Tim!

I'm loving the forums, feels great to be here, very comfy <3

Have a nice day
 
If tomatoes are a fruit, then ketchup must be a jam. Taste this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic