Showing posts with label html. Show all posts
Showing posts with label html. Show all posts

Monday, January 30, 2012

Difference between GET and POST method in Form Submission

In HTML, we can specify two different submission methods for a form. The method is specified inside a form element, by using the "method" attribute.

GET and POST methods of a form is used to send data to the data processing page. Both methods are used in form data handling where each one has some difference on the way they work.

GET - POST methods comparision table:


GET Method Properties:


POST Method Properties:


1. All the name value pairs are submitted as a query string in URL.


1. All the name value pairs are submitted in the Message Body of the request.


2. Amount of data submitted is restricted.


2. Amount of data submitted is not restricted.


3. This is the default method used in the form tag.


3. Should be explicitly specified.


4. Get method is not secured (information appear in browser).


4. Post method is secured (information does not appear in the browser).


5. "GET" is basically for retrieving data.


5. "POST" is basically for sending data.


6. Data transmission is faster.


6. Data transmission is comparatively slow.



Simple Usage:

< form id="myForm" name="myForm" action="myAction" method="GET" >...< /form >
< form id="myForm" name="myForm" action="myAction" method="POST" >...< /form >

References:
1. http://www.w3schools.com/html/
2. http://en.wikipedia.org/wiki/POST_(HTTP)
3. http://wiki.answers.com/Q/What_is_the_difference_between_get_and_post_method_in_HTTP
4. http://www.wereyouwondering.com/what-is-the-difference-between-get-and-post/


Tuesday, May 17, 2011

Jsoup HTML Parser


There are so many open source java html parser. In this blog post just I will try to give some information about Jsoup. It is an open source Java HTML parser that I have been working on recently. Instead of Jsoup, you can use HTML parser, Jericho HTML parser or other parser libraries you want.

jsoup is a Java library for working with real-world HTML.

By using this library,

  • You can parse HTML from a URL, file, or string.
  • You can find and extract data, using DOM traversal or CSS selectors.
  • You can manipulate the HTML elements, attributes, and text.
  • You can clean user-submitted content against a safe white-list.

Getting Source Code.

Download the library and use it in your project. The current release version is 1.5.2.

Visit the example and start with jsoup to parse html.

If you use Maven to manage the dependencies in your Java project, you do not need to download; just place the following into your POM's section:

This post is an introduction to Jsoup. In other posts I will give some examples that I use in my real project. The examples will be about getting elements in html.

I wish to be useful.