yes
You hav asked "have u used "post" method"
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class PatternExample extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet
{
/**
*
*/
private static final long serialVersionUID = 1L;
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>");
}
}
}
this is the servlet and;
<form method="post" action="/PatternExample">
Enter start: <input type="text" name="num1"><br>
Enter end : <input type="text" name="num2"><br>
<input type="submit" value="Submit" onclick="PatternExample.java">
</form>
this is jsp file and i think both contain POST method so i guess it contains post method~!!!!!
View Answers
May 18, 2011 at 4:25 PM
Make changes in PatternExample.java:
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 {
public 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>");
}
}
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException {
this.doPost(request, response);
}
}
Compile your servlet. Then restart the server and then run the pattern.jsp.
Related Tutorials/Questions & Answers:
ModuleNotFoundError: No module named 'yes'ModuleNotFoundError: No module named '
yes' Hi,
My Python program is throwing following error:
ModuleNotFoundError: No module named '
yes'
How to remove the ModuleNotFoundError: No module named '
yes' error
Advertisements
javascript confirm yes nojavascript confirm
yes no javascript confirm
yes no - how to create confirm dialog box
yes or no in JavaScript?
if (confirm('Are You... are not redirected")
}
How to confirm
yes or no in JavaScript
JavaScript Alert YES NOJavaScript Alert
YES NO How to send an alert to a user to confirm if there request is valid or not? I wants to send the alert message in Java Script.
You can use the confirm() method in Java Script.
if (confirm
fast view web--yes - Strutsfast view web--yes How to enable the fast web view--
yes on pdf file Hi Friend,
Please clarify your problem.
Thanks
Yes/No confirm box with vbscript - FrameworkYes/No confirm box with vbscript I'm using a
Yes/No confirmation with vbscript. But the in the confirm box, the titiel is coming along with 'VBScript' in it. I just want to remove this 'VBScript' title, Can anyone help me
Time Tracker
Time Tracker
Time Tracker is a simple tool to keep track of the time you spend on any
task. Think of it as a to-do-list with a clock. And
yes, it's free.
Read full Description ADS
Struts Interview Questions
Struts Interview Questions
Question: Can I setup Apache Struts to use
multiple configuration files?
Answer:
Yes Struts can use multiple configuration files. Here
XML Interviews Question page9
XML Interviews Question page9
Can I encode mathematics using XML ?
A:
Yes, if the document type you use provides for math, and your users' browsers
Social Media Marketing Services India
Do you want to be the market leader or want to see your company in the elite
group in a very short span of time? If your answer is in
yes, you need the power
of Social Media Marketing Services.
There are several powerful
Purchasing the right GPS unit
Purchasing the right GPS unit
Yes, now you can find the use of Global Positioning System in various ways including in your car, your watch, mobile phone, fleet, boat
Windows Web Hosting
MS FrontPage 2000,
2002 support
Yes
Yes
Flash Support
Yes
Yes
Shockwave support
Yes
Yes
Real Audio/Video
support
Yes tomcattomcat Is it necessary to restart the server if we change the JDK path in tomcat server?
Yes,
Thanks
Yes,
Thanks
Ajax problemAjax problem Dear sir/mam
i want to ask that i am using radio button for the
yes or no but i want when i use
yes then inside the
yes button add on one extra textbox if press no the do not required text button
String doubt replace functionString doubt replace function What is the output and why of below :
String s1 = "Hello";
if(s1.replace('H','H')== "Hello")
System.out.println("
yes...")
System.out.println("
yes");
else
System.out.println
DatabaseDatabase is it possible to view the query code after executing it.if
yes tell me the procedure.
Yes, if you want to retrieve the data that is stored in database, then use the given query:
select * from student
Pointer a variablePointer a variable hii,
Pointer is a variable or not ?
hello,ADS_TO_REPLACE_1
Yes, a pointer is a variable
multithreadingmultithreading is multithreading is inbuilt in java?
if
yes then why we implement thread seperately
Servlet - JSP-ServletServlet Hi,
Can Servlet have instance variables.If
yes please give an example.
Thanks,
Poonam
database - JDBCdatabase hai friend,
yes i want to use java database connection in eclipse IDE.
Thanks in advance
hibernate queryhibernate query hibernate apache par kam karta hai kya
Hi Friend,
Yes.
Thanks
javajava can we make/declare static class in java? if
yes ,why
InheritanceInheritance static methods are inherited or not?
Yes, static methods are inherited
core javacore java can i use native keyword with abstract method ? if
yes explain and if no please explain
arraysarrays while declaring 2-d array, is it compulsary to write no of columns like C or is it different? and if
yes then why
tech. interview tech. interview java support round robin algo. if
yes why? and
if no why
core javacore java Is it possible to create a shallow copy of an arraylist instance? if
yes then please post the code
java servlets - Java Beginnersjava servlets i want to close window when ever he logout from one page...
this closing is done with
yes/no option.
when ever press "
yes" it means he successfully logout from page.
if press "no" it means he not logout from
javascript - Design concepts & design patternsjavascript i want to close window when ever he logout from one page...
this closing is done with
yes/no option.
when ever press "
yes" it means he successfully logout from page.
if press "no" it means he not logout from
override jspInit()override jspInit() Can you override jspInit() method? If
yes, In which cases?
Yes, We do it usually when we need to initialize any members which are to be available for a servlet/JSP throughout its lifetime
iPhone/iPad Project xCodeiPhone/iPad Project xCode hii
Can I compile the same iPhone source code for iPad?
Yes you can do so.ADS_TO_REPLACE_1
Yes. This is called a Universal binary.
so you can compile the same iPhone source code for iPad
java fresher - Java Beginnersjava fresher i am working on php.can i learn JAVA.If
yes,then how much time it will take Hi Friend,
Yes, you can learn java.
Please visit the following link:
http://www.roseindia.net/java/
Thanks
Mysql Alter Table Identity |
+----------+--------------+------+-----+---------+-------+
| username | varchar(100) |
YES | | | |
| fname | varchar(100) |
YES | | | |
| email | varchar(100) |
YES Mysql Alter Constraint |
+----------+--------------+------+-----+---------+-------+
| username | varchar(100) |
YES | | | |
| fname | varchar(100) |
YES | | | |
| email | varchar(100) |
YES | | | |
| count
is _array()is _array() is_array() in php
Hi Friend,
This function is of Boolean type.It checks whether a variable is an array or not.
Here is an example:
<?php
$
yes = array('Hello', 'World');
echo is_array($
yes) ? 'Array
is _array()is _array() is _array()
Hi Friend,
This function is of Boolean type.It checks whether a variable is an array or not.
Here is an example:
<?php
$
yes = array('Hello', 'World');
echo is_array($
yes) ? 'Array
javascript problemjavascript 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 the text button inside the radio button if I press no button then no any other textbox
CMS project using JSFCMS project using JSF Can i use jsf for CMS project..? If
yes pls give some guidelines to how to start
array - Java Beginnersarray Accept a two dimensional array from the user check if this array is symetric display a message
yes,if it is symetric otherwise display it ,is not symetric