0

InsuranceINFO.jsp:

<div class="content">
<h3>Insurance policies</h3><br><br>
<form action="/Project/src/servlet/PolicyServlet" method="POST">
<jsp:useBean id="pBean" class="servlet.Policy"/>
<jsp:setProperty name="pBean" property="policyNo" value="P1"/>
<h2>P1</h2>
<input type="hidden" name="P1value" value="P1">
<input type="submit">
</div>
</form>

is my path of calling the servlet correct? i have tried "form action="/PolicyServlet" as well. It doesnt work :( im at my wit's end. tried many solutions from google but all didnt work. any help is appriciated

Error:

HTTP Status 404 <br>
The requested resource (/Project/src/servlet/PolicyServlet) is not available.

This is my project layout.( I couldn't post images, cause I'm a new user. Sry..)

Project-
    Java Resources-
        src-
            servlet-
                PolicyServlet.java
WebContent-
    views-
        zyViews-
            InsuranceINFO.jsp
RAM
  • 2,413
  • 1
  • 21
  • 33

1 Answers1

0

Try <form action="/servlet/PolicyServlet" method="POST">

And you should have web.xml as it follows

<servlet>
    <servlet-name>PolicyServlet</servlet-name>
    <servlet-class>servlet.PolicyServlet</servlet-class>
</servlet>

<servlet-mapping>
    <servlet-name>PolicyServlet</servlet-name>
    <url-pattern>/servlet/PolicyServlet</url-pattern>
</servlet-mapping>

Not point the action directly to the source code, this need to be done using web.xml mapping for servlets.

Koitoer
  • 18,778
  • 7
  • 63
  • 86