Solve this problem plzzz

Solve this problem plzzz

Prashant.jsp (this is my JSP file)

<HTML> <HEAD> <TITLE>Login using jsp

<BODY>
    <H1>My First Project</H1>

    <form action=" /Prashant" method="POST">
            <table>
                <tr>
                    <td> Number 1: </td><td> <input name="number1" size=15 type="text" /> </td> 
                </tr>
                <tr>
                    <td> Number 2: </td><td> <input name="number2" size=15 type="text" /> </td> 
                </tr>
            </table>

            <br><input type="button" value="Click me"/>


        </form>

     </BODY>

Prashant.java(this is my Servlet file)

import java.io.*; import javax.servlet.*; import javax.servlet.http.*;

public class Prashant extends HttpServlet {

/**
 * 
 */
private static final long serialVersionUID = 1L;

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

    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    out.println("<html>");
    out.println("<body>");

    out.println("Number 1: <input name= number1 size=15 type=text /><br>");
    out.println("Number 2: <input name= number2 size=15 type= text /><br>");
    out.println(" <input type= button value = Click me onclick=/>");
    out.println("</body>");
    out.println("</html>");

}

}

web.xml(this is my web.xml file)

Prashant Prashant Prashant Prashant Prashant /Prashant.jsp

i want my jsp file should ask for 2 inputs (2 text boxes) and 1 button(submit button)

when i put 2 numerica value like textbox:1 textbox:6 den it should print 1 12 123 1234...upto 6

so plzz kindly help me and check all those files and solve my problem as soon as possible

thnx in advance

View Answers

May 18, 2011 at 3:27 PM

1)pattern.jsp:

<html>
<form method="post" action="../PatternExample">
<pre>
Enter start: <input type="text" name="num1"><br>
Enter end  : <input type="text" name="num2"><br>
<input type="submit" value="Submit">
</pre>
</form>
</html>

2)PatternExample.java:Put your servlet in classes folder.

import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;

public class PatternExample extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet { 

protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out=response.getWriter();

String number1=request.getParameter("num1");
String number2=request.getParameter("num2");
int n1=Integer.parseInt(number1);
int n2=Integer.parseInt(number2);
for(int i=n1;i<=n2;i++){
   for(int j=n1;j<i+1;j++){
   out.print(j);
   }
   out.println("<br>");
    }
        }
}

3)Do the servlet mapping in web.xml.

<servlet>
        <servlet-name>PatternExample</servlet-name>
        <servlet-class>PatternExample</servlet-class>
    </servlet>

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

May 18, 2011 at 3:39 PM

Hey thnx for ur answer but i am getting

HTTP Status 405 - HTTP method GET is not supported by this URL

type Status report

message HTTP method GET is not supported by this URL

description The specified HTTP method is not allowed for the requested resource (HTTP method GET is not supported by this URL).

Apache Tomcat/5.0.28

when i run it on the server


May 18, 2011 at 3:41 PM

Sorry to bug u again and again but i m very much new to JSP/Servlet so plz kindly help me and just let me know how to run and whioch file xactly to ruin on the server

and u sed abt classes folder...where can i find classes folder~!~~~

plzzz help me

Ads









Related Tutorials/Questions & Answers:
Solve this problem plzzz
Solve this problem plzzz  Prashant.jsp (this is my JSP file) <HTML> <HEAD> <TITLE>Login using jsp <BODY>... kindly help me and check all those files and solve my problem as soon as possible
solve this problem
solve this problem  I typed this program and compiled.The program is compiled but when i eneterd url in tomcat server. Its not giving error but only... in table please tell me the solution for thid problem import java.io.*; import
Advertisements
help me to solve this problem..
help me to solve this problem..  Given below is a class definition for Book. Type and compile the class, and answer the following questions: class Book { String title; //bookâ??s title double price; //bookâ??s price
how to solve an internet connection problem
how to solve an internet connection problem  when i run my application it give me this error: Exception in thread "AWT-EventQueue-0" java.lang.UnsupportedOperationException: Not yet implemented the problem is that i don`t know
can interface solve this problem in java
can interface solve this problem in java  I have a JDialog which displays the calendar [from 2010-2020], i created this in a different class... this calander class. can interface solve this problem. If yes then how. pls
how to solve this problem for oracle connectivity
how to solve this problem for oracle connectivity  Exception in thread "main" java.sql.SQLException: Io exception: The Network Adap ter could not establish the connection
Please Help To Solve My Problem
Please Help To Solve My Problem  PHP I Have 6 Textbox and 1 ok... With B Team when A Team Play With B Team Again Then Generate Error. I Am Solve This Problem With If...Else If...Else Statement But When the More Team
how do i solve this problem?
how do i solve this problem?  Define a class named Circle with the following properties: List item An integer data field named radius with protected access modifier, and a String data field named colour with private access
i need help to solve this problem
i need help to solve this problem  Write a stack class ArrayStack.java implements PureStack interface that reads in strings from standard input and prints them in reverse order. and Show step by step what queue will look like
Solve it
Solve it  How to calculate the value which contains oparator and operand both using command line argument
solve this
solve this   Create a student class. The student object should have studentid, studentname, subject and marks as properties. Also generate the getter and setter methods. Create 5 objects of this class and populate values
plzzz help me!!
plzzz help me!!  . Write a program to display a multiplication table, by entering the start number and the end number. Sample output: Enter start number: 1 Enter end number: 2 {press enter} 1 2 3 4 5 6 7 8 9 10 1
please help me solve this problem when i am create database connection using servlecontext
please help me solve this problem when i am create database connection using servlecontext  hi... I have create a database connection using... understand what is the problem .... the code are as follows. the servlet context
Help Me plzzz
.....how to solve dis error
solve this pbm
solve this pbm  its not working the code for databae access using servlets
in php installation problem ?
in php installation problem ?   php installation in 7th step did not display y/n dialog box how to solve the problem
how to solve
how to solve   log4j:WARN No appenders could be found for logger (org.apache.struts.util.PropertyMessageResources). log4j:WARN Please initialize the log4j system properly
solve this pbm
solve this pbm  sir rows are also inserting i have checked in the database also the rows are not affected in the table . The first pbm wich i have sent to you is not yet solved.......... pls give me detail explaination how we
Solve
how to solve this..
how to solve this..  Given a list of students and their marks Name | Science | Math | English | Computer Ahmad | 28 | 100 | 66 | 34 Samad | 56 | 89 | 55
how to solve this..
how to solve this..  Given a list of students and their marks Name | Science | Math | English | Computer Ahmad | 28 | 100 | 66 | 34 Samad | 56 | 89 | 55
ModuleNotFoundError: No module named 'solve'
ModuleNotFoundError: No module named 'solve'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'solve' How to remove the ModuleNotFoundError: No module named 'solve'
A Program To Solve In Java
A Program To Solve In Java  x!/x+(x+2)!/x+(x+4)!/x ... (x+n)!/x
problem in onlinetest...
problem in onlinetest...  hi, my code getting the problem is ,when user leave a question then the server puts error... pls help me
help me to solve this question
help me to solve this question  Write a program that inputs a series of integers into an array. The numbers are in the range 0 to 100. Calculate and display : a) The Largest number b) The Smallest Number c)The sum of the numbers
Small Bug How to solve in my code
Small Bug How to solve in my code  String season=""; pst...") + ","; it shows bug in findbugs tool.. but it executes successfully how to solve the problem
How to solve the Hibernate Common Exceptions?
How to solve the Hibernate Common Exceptions?  How to solve the Hibernate Common Exceptions
javascript problem
javascript problem  hi guys My problem is that I am using radio button for yes or no but i want to do that if I press yes button then enter... enter please help me this problem
problem on strings
problem on strings  in string1 "123456 ABC DEF...",IN string2 "raveen". iwant to add string2 after 123456 in the first string based on index number.i need logic for this with out using StringBuffer concept. Thanks in advanace
Problem with loginbean.jsp
Problem with loginbean.jsp  http://www.roseindia.net/jsp/loginbean.shtml - I am getting an error in loginbean.jsp.There is some error regarding .What is hello in this? Also in this example how
compilation problem
compilation problem  struts 2.0 : i have included all 5 jars in lib folder,but its giving compilation problem that package open symphony doesnot... havenot set the build path.if this is the problem then tell me how to set

Ads