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



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

Have Programming Question? Ask it here!
 
 
 


John
Java client posting to a servlet
1 Answer(s)      5 years and 9 months 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
Posting Copy and Paste HTML
Posting Copy and Paste HTML   Posting Copy and Paste HTML
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
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 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
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
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
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
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
Java servlet
Java servlet  What is servlet
java (servlet) - JSP-Servlet
java (servlet)  how can i disable back button in brower while using servlet or JSP
who is client
who is client   tell me who is client is management
Java(Servlet) - Servlet Interview Questions
Java Servlet examples  Java and Servlet programming examples
Java servlet
Java servlet  What is the difference between an applet and a servlet
JAVA SERVLET - JSP-Servlet
JAVA SERVLET Log   Hi, A servlet file which create the log files ,then writing values to the list & log, we should have a thousand separator and no decimal values. This means instead of writing 986300.0 in the Log file
Client Interview
Client Interview  Hi, I am kumar i am having client round in polaries client is a BANK. how to face client interview. what are the expected questions from CITI
java servlet
java servlet   im using ubuntu 12.04 and ialready installed eclipse but i dont know how to run the servlet programs please give brief procedure to run the servlet program in eclipse
Thin client
Thin client  What is a thin client?   A thin client is a lightweight interface to the application that does not have such operations like query databases, execute complex business rules, or connect to legacy
servlet prog - Java Interview Questions
servlet prog  how to forward or redirect the client request from servlet to jsp? how a thread or request pass from one servlet prog to one jsp prog? is it possible of communicating from servlet to jsp prog? please explain briefly
Server calling of .exe file in the client
Server calling of .exe file in the client   I have a requirement with java webapplication. We are using jboss as appserver on Linux machine. How can I call a .exe file from client machine? I want to run .exe from webpage like
java servlet - JSP-Servlet
java servlet  hi friends, Thanks in advance. Am poornima am created new servlet in eclipse its open but without including any code am getting..., Put servlet-api.jar into the lib folder of apache tomcat server. Thanks
Java Servlet - JSP-Servlet
Java Servlet   Hello Sir Could you help me in understanding directory Structure for servlet page in eclipse (IDE). I save my Sevlet in WEB-INF but it is not displaying, it is displaying code of servlet. Process used
Rmi client
Rmi client  Sir i just created client and server following the RMI rule, its running properly in the localhost, when i am trying to run the program in the different machine its not working, i changed the ip also, when i copied
Header Information available from the client in Servlet
Header Information available from the client in Servlet... to display the header information in servlet. When a HTTP client sends a request... which the browser is accepting. Connection - If a servlet gets a keep-Alive
Explain the process of implementing a CORBA client using a Java programming example and the steps involved.
Explain the process of implementing a CORBA client using a Java programming example and the steps involved.  plz tell me answer of this question... the process of implementing a CORBA client using a Java programming example
Java - JSP-Servlet
Java  Using Servlet,JSP,JDBC and XML How to create a web application... can create JSP/Servlet web application. http://www.roseindia.net/jsp.... Thanks for posting questions. RoseIndia Team
run exe on remote client
run exe on remote client  I am making a client server application using netbins 6.1 , Jsp servlet, Mysql5.1... I want to run an batch file or exe file on client pc in my network if i know the username & password. I have
Sitemap Java Servlet Tutorial Section
Map | Business Software Services India Java Servlet Tutorial Section... | Snooping Headers | Dice Roller in Java Servlet | Getting Init Parameter... value Using Servlet | Hit Counter Servlet Java Servlet Tutorial Section
 

 

 

DMCA.com