answersLogoWhite

0

How will you pass values from HTML page to the servlet?

Updated: 8/16/2019
User Avatar

Wiki User

13y ago

Best Answer

we are passing values from the HTML to the Servlet by using HTML controls.

ex:name,password..........

In servlets we have one method for getting the values from HTML is getParameter()

example:

String s1=req.getParameter("T1");

String s2=req.getParameter("T2");

in above example T1,T2 are the names of the HTML controls, String is a class and req is the object of the HttpServlet.

User Avatar

Wiki User

13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How will you pass values from HTML page to the servlet?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you pass values from an sevlet to an HTML page?

You cannot. A HTML file is a static file and it cannot get or receive dynamic contents that a Servlet may pass or send.


How the pass value from the HTML pages to the servlet?

You need a form to pass value to a servlet. In the form tag, the action element passes the value into the servlet.


How do you pass table values from one page to another using HTML?

You cant you have to use php or javascript.


How do you Retrieve data from drop down box in one servlet and pass to another servlet?

The data that is present in a web page is available in the Form object of the page which can be accessed from the HTTP Request. If the request object gets passed from one servlet to another the data also would get passed.


What is the difference between jsp forward and response sendRedirect?

The <jsp:forward ..> is actually a call to HttpServletRequest.forward(String url) which passes the request object within the server to either a servlet or to another JSP page. The new servlet or JSP page continues to process the same request and the browser is not aware of the fact that more than one servlet or page is involved. i.e., The client is not aware that the request is being forwarded somewhere else. The URL shown in the browser stays unchanged when you do this forward. The <jsp:forward> element forwards the request object containing the client request information from one JSP file to another file. The target file can be an HTML file, another JSP file, or a servlet, as long as it is in the same application context as the forwarding JSP file. The lines in the source JSP file after the <jsp:forward> element are not processed. The page invoked by the <jsp:forward> action has access to all the parameters in the original JSP page's request object. You can add new parameters to the request object to pass to the target page by using the <jsp:param name="..." value="..." />. Be careful when using <jsp:forward> with unbuffered output. If the JSP file has any data in the out object, using this forward action will cause an IllegalStateException to be thrown when the page is displayed. The response.sendRedirect() creates a new request object which doesn't carry any of old request information. The first request handler JSP page tells the browser to make a new request to the target servlet or JSP page. The URL shown in the browser therefore changes to the URL of the new page to which you redirect. A redirect is slower than a forward because the browser has to make a new request. Another difference is that request scope objects are no longer available after a redirect because it results in a new request. If you need to pass data to the page you redirect to, you have to use a query string and pass them as request parameters or save the data in the session or application scope objects Forward is faster than redirect but one disadvantage is that URL is not changed and also it works within the same web application. Also, when you choose to use forward, you need to think and confirm what must happen if the user reloads the page.


What is the difference between servletcontext and servletconfig?

ServletContext Defines a set of methods that a servlet uses to communicate with its servlet container.ServletConfig is a servlet configuration object used by a servlet container used to pass information to a servlet during initialization. All of its initialization parameters can ONLY be set in deployment descriptor.The ServletContext object is contained within the ServletConfig object, which the Web server provides the servlet when the servlet is initialized.You can specify param-value pairs for ServletContext object in tags in web.xml file.The ServletConfig parameters are specified for a particular servlet and are unknown to other servlets. The ServletContext parameters are specified for an entire application outside of any particular servlet and are available to all the servlets within that application.By Santanu


How can you pass a JavaScript value into a PHP file?

JavaScript lives in the browser, PHP lives on the server.To pass a value from JavaScript to a PHP page, you can eitherdo an HTML form submituse AJAXIn both cases, the value is sent to the server and you write your PHP to handle it and send a response.The important thing is that the JavaScript value won't be available in PHP when you first generate the page, creating the page and handling the value submitted from the browser are two distinct steps.


How to pass form data from one page to another by using get and post in HTML?

Generally, you would use some breed of a server-side script:PHP(what i use!!!), ASP and i think you might be able to use Javascript and Perl as well!!!


What is a basic structure of HTML?

A HTML file has the below structure <HTML> <HEAD> <TITLE> Title of the Web page <TITLE> Header of the Web page </HEAD> <BODY> Body of the Web Page </BODY> </HTML> The file has a .HTML extension and can be viewed in any web browser like IE or chrome or Mozilla


How did griots pass on history and values?

they traveled to europe


What is the process by which schools pass a society core values from one generation to the next?

Cultural Transmission of Values


What is the process by which schools pass a society's core values from one generation to the next?

Cultural Transmission of Values