Skip to main content

JSP page is doing the same thing as a Web service. Why use a Web service?

Accessing a JSP page could be considered the same as accessing a Web service. If you think about it, calling a JSP page is a large method packaged in the form of a servlet, which sends back character output. The biggest difference is in the packaging.

A Web service defines an interface through which it's possible to define exactly the data being sent to and from the Web service. 

The JSP page, on the other hand, just hands back a large character text stream in the HTTP wrapper. This makes it hard to parse a JSP result for finer work. This makes a Web service easier to use programmatically over a straight JSP page. Whenever fine control of the data being sent over a HTTP request is required, it is time to use a Web service.

The next fact to consider is state. One thing JSP and servlets give the programmer is a concept of state: application, session, page, and so on. A service isn't as tied to the concept of state. In fact, keeping a Web service stateless has the advantage of making a Web service easier to scale and move around from project to project. 

However, a Web service doesn't necessarily have access to maintaining state in the same manner as a JSP page. State within a Web service will depend on the Web service server implementation being used by a project. Some Web service servers will not maintain state; others, such as Microsoft's .NET, will provide their Web services the exact same options of state that an ASP page enjoys (application, session, and so on). Apache SOAP does provide state management, and we will explore this idea further.

Reference:
Kochmer, C., & Frandsen, E. (2002). JSP™ and XML Integrating XML and Web Services in Your JSP™ Application R. Kronzek, M. Newcomb & M. Ray (Eds.), (pp. 592).

Comments

Popular posts from this blog

Retrieve Data from Database and Compare it with user input using Java

In this Lesson we will create a form page " form.jsp " that takes the user email. After that we will check the user existence in our DB. If the user email stored in the DB, a welcoming page will be opened to him/her. If the user is a new user then a message will be displayed that tells him/her this email is not stored in our DB. Note: I use access 2013 database and Eclipse Juno     Basic step, Create a new project: Open Eclipse then click on File > New > Other > Web > Dynamic Web Project. First, Load the DB class: In this step we will connect with database so we will gather all its code in a java class named " DBConnection.java " under a package called " code ". Expand your project then right click on java resources > New > Package . After-that Give a name for your package ex, code   Right click on your created new package that called code > New > Class.   After-that Give a name for your Class ex, DBConnection.  

An attempt was made to insert a node where it is not permitted

Do you face this Error while you are writing code to generate xml file from java? Exception in thread "main" org.w3c.dom.DOMException : HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.        at com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl.insertBefore(Unknown Source)        at com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild(Unknown Source)        at generatexml.WriteXMLFile.main( WriteXMLFile.java:30 ) Well the answer is: Don't insert the node where it isn't permitted. Change your generated directory file path from 'C' to other directory ex, D or to any directory you have. Make sure the ‘appendChild’ is referring to the right element. Don’t appending twice, only make it once. Ex, //Writetoxml.java   Element rootElement = doc . createElement ( " Company " );   doc . appendChild ( rootElement );                Element subElement = doc . cre

Do you want to know about your computer in one window screen?

System Toolbox (Sys Toolbox) If you want to know information about your computer from processor, drivers, motherboard, memory, operating system,...and more, you can depend on this software. Sys Toolbox (see screen shoot from the software) provides a software and hardware information for windows operating system. It is a simple software that you can use it to know about your PC. To run the software, you need to: Extract the zipped software.  After that, right click on the software icon and choose "Run as administrator". Finally, you will find a pop up screen telling you information about you PC. To go to the software site: http://sys-toolbox-pro.soft112.com/ To Download the software: Download