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



Home Answers Viewqa Development-process Java client posting to a servlet
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


John
Java client posting to a servlet
1 Answer(s)      6 years ago
Posted in : Development process



Advertisement
View Answers

November 14, 2008 at 1:21 AM


Hi friend,

"getData.html"
<html>

<head>
<title>New Page 1</title>
</head>

<body>

<h2>Login</h2>
<p>Please enter your username and password</p>
<form method="GET" action="/htmlform/LoginServlet">
<p> Username <input type="text" name="username" size="20"></p>
<p> Password <input type="text" name="password" size="20"></p>
<p><input type="submit" value="Submit" name="B1"></p>
</form>
<p>&nbsp;</p>

</body>

</html>

"LoginServlet.java"

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

public class LoginServlet extends HttpServlet{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html");
PrintWriter out = response.getWriter();
String name = request.getParameter("username");
String pass = request.getParameter("password");
out.println("<html>");
out.println("<body>");
out.println("Thanks Mr." + " " + name + " " + "for visiting roseindia<br>" );
out.println("Now you can see your password : " + " " + pass + "<br>");
out.println("</body></html>");
}
}


web.xml file for this program:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">; -->

<web-app>
<servlet>
<servlet-name>Hello</servlet-name>
<servlet-class>LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Hello</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
</web-app>

For more information on servlets visit to :

http://roseindia.net/servlets/

Thanks


Related Tutorials/Questions & Answers:
Java client posting to a servlet - Development process
Java client posting to a servlet  Hi, I would like to create a java client that post to a servlet. I am trying to test out a webserver and would like to drive a number of connections using this process. Thanks  Hi
what is posting?
what is posting?  what is posting?   Posting is an event that writes Inserts, Updates & Deletes in the forms to the database but not committing these transactions to the database
Advertisements
ssl client - JSP-Servlet
ssl client  How do you write SSL Client? Take example of SSL Socket Client
Java Client Application
Java Client Application  Java Client Application
Java Client Application example
Java Client Application example  Java Client Application example
Java HTML Client Application
Java HTML Client Application  Java HTML Client Application
JSP to client side - JSP-Servlet
JSP to client side  Hi I have a JSP(graph.jsp) page which calls a servlet and get the output. The output is a JSON object. I want to use the same to plot a graph in flotr. How can I use the same
Posting Copy and Paste HTML
Posting Copy and Paste HTML   Posting Copy and Paste HTML
How to get client's address in a servlet
How to get client's address in a servlet       This is detailed java code to get client's address in a servlet. In this example we have used method getremoteAddr
Java FTP Client Example
Java FTP Client Example  How to write Java FTP Client Example code? Thanks   Hi, Here is the example code of simple FTP client in Java which downloads image from server FTP Download file example. Thanks
Client Server Java app
Client Server Java app  I developed a client server based java networking Instant Messaging app. The client program is needed to be run on the client... some servers and so,so that my friend who is in another city can run the client
Java FTP Client
Java FTP Client  What all Java FTP Client available to the Java programmers? Is there any Free FTP Client Library? Thanks   Hi, Apache commons-net library is open source robust library in Java. It also contains FTP
What is Java Client Socket?
What is Java Client Socket?  Hi, What is client socket in Java... socket connections. To get connection in client socket in java used the class... problem of some sort occurred. More information about client socket in Java
Client's Data with Axis2 and Java
client's data? First of all back-end will be build in Java(will try to implement some...Client's Data with Axis2 and Java  Hello everyone, I am studying... worked with Eclipse(duh) there is very nice feature of generating server/client
proxy server and client using java - Java Beginners
proxy server and client using java  how to write program in java for proxy server and client
Posting comments to same page with textarea
Posting comments to same page with textarea  I have been given some code which allows a user to type a comment and on submit it will return the text to the same page. Many thanks for that. However I wanted it to add other
selenium rc java client driver - WebSevices
selenium rc java client driver  how to implement getcookies functions in selnium rc??? i m using getcookies function in selenium rc java client driver. but its given some error. pls tell me whether i have 2 write code
thin-client project - Java Interview Questions
thin-client project  what is thin-client project??? Plz help me  Hi Friend, Please visit the following link: http://www.roseindia.net/linux/linux-thin-client-terminals.shtml Hope that it will be helpful for you
File transfer from client to server - Java Beginners
File transfer from client to server  hi,, I've been trying to make an application where the user select a file using JFileChooser and then the program directly send it to the server using client/server sockets, I've tried
File download from server to client machine - JSP-Servlet
File download from server to client machine  hi, I want to save a pdf file to my client machine from a button provoded in a jsp page.The file...//Myreport.pdf); i want to provide a way to client to save the report in above
Unable to create web service client in java
Unable to create web service client in java  When i try to create a client for the WSDL http://infml00871:82/MapperWebService/Mapper?wsdl... error as I click Finish button for Client creation: IWAB0014E Unexpected exception
Take print out from printer at client machienusing jsp - JSP-Servlet
Take print out from printer at client machienusing jsp  Sir/Mam I want do is to take out print out of my report which will be created from the Mysql database with out displaying him/her the results or report from the printer
Post Message In servlet
to the client . The servlet container creates a ServletResponse object and passes...Post Message In servlet       In this example, we are going to implement posting massage
how to expose blob in restful web service client java rest template
how to expose blob in restful web service client java rest template  how to expose blob in restful web service client java rest template
Sending and receiving information to the UDP Client in Java
Sending and receiving information to the UDP Client in Java... will provide send and receive information by the UDP client in Java. UDP client... and a 'Send' command button. All information or messages are written by client
Hi i want java code that diaplays server scren at the client side
Hi i want java code that diaplays server scren at the client side  Hi I'm Shivaprasad i want java socket code that shows the server side screen when client gets connected with the server. Please help me   Please visit
how to expose blob in restful web service client java
how to expose blob in restful web service client java   how to expose blob in restful webservice clientside and how to convert the blob into a file,please help me
how to expose blob in restful web service client java
how to expose blob in restful web service client java   how to expose blob in restful webservice clientside and how to convert the blob into a file,please help me
Multicast Client in Java
UDP Multicast Client in Java   ... to send and receive the IP packet or message by multicast client. Here, we provide...') and port number(5000). Those of any client sends and receives IP packet
Servlet Session
Servlet Session Sometimes it is required to maintain a number of request requested by the same client to associate them. Session in the sense that to maintain a client stability. In Java Servlet Technology there is an API which helps
UDP Client in Java
UDP Client in Java     ... or messages for UDP server by the UDP client. For this process you must require...;Text Client");   frame.setDefaultCloseOperation(JFrame.EXIT
 

 

 

DMCA.com