Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa JSP-Servlet Solve this problem plzzz
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


prashant khandekar
Solve this problem plzzz
3 Answer(s)      3 years and 6 months ago
Posted in : JSP-Servlet


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


Advertisement
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



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
Simple problem to solve - JSP-Servlet
Simple problem to solve  Respected Sir/Madam, I am R.Ragavendran.. Thanks for your kind and timely help for the program I have asked.... But in that I am facing a very very minute problem. The alert boxes are displayed
Simple problem to solve - JSP-Servlet
Simple problem to solve  Respected Sir/Madam, I am.... But in that I am facing a very very minute problem. The alert boxes are displayed.../Regards, R.Ragavendran..   Hi Raghavendran, The problem is not so
How to solve button problem - Java Beginners
to solve this problem. Thank you Sir, Yours truly, T.Ramesh Puttaparthy...How to solve button problem  I have created button (Open File Dialog... Open Dialog Box and from that displaying image files. But problem is I‚??ve used
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
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
Help Me plzzz
.....how to solve dis error
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
solve this pbm
solve this pbm  its not working the code for databae access using servlets
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
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
A Program To Solve In Java
A Program To Solve In Java  x!/x+(x+2)!/x+(x+4)!/x ... (x+n)!/x
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
please solve this program
please solve this program  Build a package EMPPACK that contains one stored function Validatesal() and two stored procedures Insertemp() and Getempdetails().The Insert_emp() procedure inserts a particular employee
please solve the programme
please solve the programme  Develop a java program to find the roots of a quadratic equation ax2+bx+c=0, with the following specification :- Class name :- Quad Data members float a,b,c,d, with a,b,c are the co-efficient
plz solve my query?
plz solve my query?  how to remove all the options from select control in html using java script?   JavaScript remove all items <html> <script language="javascript" > function removeAllItems(selectbox
help me to solve this question...
help me to solve this question...  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
Solve Program - Java Beginners
Solve Program  Write a progaram in java to display all odd number from 1 to 100   hi use this code package rajanikant.code.sep_2008; public class EvenOdd { public static void main(String s
Solve it - Java Beginners
Solve it  Hi Friends, Thanks for continue reply.. I have some query please solved...its urgent.. I have two table,emp,exam.both have e... is write here. no information display in the jsp file please solve it and let me
Advertisements
 

 

 

DMCA.com