Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7899459
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:42:29+00:00 2026-06-03T08:42:29+00:00

I have a index.jsp file that has two different types of forms <form action=searchpath

  • 0

I have a index.jsp file that has two different types of forms

<form action="searchpath" name="searchForm" method="get">
<p>BedType</p>
   <select name="bedType">
     <jsp:include page="/WEB-INF/embeds/bedType.jsp"/>
   </select>
   <p>Max Price</p>
     <input size="10" maxlength="10" name="mPrice"/>
     <br/><br/>
     <input name="Reset" type="reset" value="RESET" class="input"/> <input type="submit" class="input" value="SUBMIT"/>
</form>

and

    <form action="loginController" method="post" id="loginForm">
        Please Login :<input name="username" size="30" maxlength="30"/> 
        Password : <input name="pass" type="password" size="30" maxlength="30"/>    
        <input type="submit" value="SUBMIT" class="input"/>
    </form>

I thought that the action field type directed to the web.xml <url-pattern>/searchpath</url-pattern> would allow me to direct whatever input information I place in those forms to the servlet of that path. That is, the first form will interact with my searchpath servlet. When I tried submitting a form and printing out information nothing seemed to work and I kept receiving a http 404 error . Can someone please help me out with this?

web.xml :

  <servlet-mapping>
    <servlet-name>Search</servlet-name>
    <url-pattern>/searchpath</url-pattern>
  </servlet-mapping>

inside my search.java servlet :

protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<HTML>");
    out.println("<HEAD>");
    out.println("<TITLE>Static Servlet</TITLE>");
    out.println("</HEAD>");
    out.println("<BODY>");
    out.println("<h1>WTF</h1>");
        out.println("</BODY>");
    out.println("</HTML>");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T08:42:31+00:00Added an answer on June 3, 2026 at 8:42 am

    Check browser URL. You are missing context.

    Let Say, You are running at http://localhost:8080/test/index.jsp where test is your context path.

    So, When calling Servlet It should be like http://localhost:8080/test/searchpath.

    In your case, Its not like that.

    So, Adding cotextpath will solve your problem.

    e.g. action="<%=request.getContextPath()%>/searchpath"

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: index.jsp: <form name=f action=db/ajoutConducteur.jsp method=post> <input type=text pattern=\d{8} required
I have a index.php file that will include several external files: content/templates/id1/template.php content/templates/id2/template.php content/templates/id3/template.php
I'm wondering if it is possible to pass form data from index.jsp file to
I have a web app, I want to define my index.jsp file to be
I have a webapp in Tomcat with a main JSP file that includes another
I have an index view that I want to update automatically as the user
I have a Struts based web application that has a structure similar to the
I need to pass a variable from Admin.java file to index.jsp. I get the
I have a simple Struts2 app that is serving JSP files just fine. But
I have a JSF/RichFaces setup with an index.jsp which a4j:include s another piece of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.