1

I am trying to resolve a problem but i am not able to find my way out.My code is showing me The requested resource () is not available error.Can anyone please help me out

index.jsp

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
</head>
<body>
    <form action="addition" method="post">
        <input type="text" name="t1">
        <input type="text" name="t2">
        <input type="submit" value="add">
    </form>

</body>

addition.jsp

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
</head>
<BODY>
    <%
    PrintWriter pw=response.getWriter();
    int no1 = Integer.parseInt(request.getParameter("t1"));
    int no2 =Integer.parseInt(request.getParameter("t2"));
    pw.print(no1+no2);
    pw.close();
    %>
</BODY>

  • I'm not familiar with JSP, but this might be related ? --> http://stackoverflow.com/questions/14364449/jsp-the-requested-resource-is-not-available – nicolas Oct 01 '14 at 22:09
  • Welcome to the community! Is "The requested resource () is not available" the full error description? Does it happen after you click submit button? Can you provide additional information about frameworks you use? Please, notice that the more clean your question will be, the more likely you will get an answer. – Valentin P. Oct 01 '14 at 22:13

1 Answers1

0

In the form you must specify the jsp you are trying to post the form addition.jsp. For your code I assume you want to send the data to addition.jsp, if you put just "addition" you're asking a resource that doesn't exist, also take in mind the url addition.jsp must be in the same level of your index.jsp, otherwise provide the relative path to addition.jsp

<form action="addition.jsp" method="post">
Cesar Loachamin
  • 2,740
  • 4
  • 25
  • 33