{"id":111,"date":"2025-02-23T05:05:22","date_gmt":"2025-02-23T05:05:22","guid":{"rendered":"https:\/\/alpeshconnect.in\/blog\/?p=111"},"modified":"2025-02-23T05:05:22","modified_gmt":"2025-02-23T05:05:22","slug":"write-a-program-to-develop-jsp-to-get-and-display-value-from-an-html-page","status":"publish","type":"post","link":"https:\/\/alpeshconnect.in\/blog\/2025\/02\/23\/write-a-program-to-develop-jsp-to-get-and-display-value-from-an-html-page\/","title":{"rendered":"Write a program to develop JSP to get and display value from an HTML page."},"content":{"rendered":"\n<p>Write a program to develop JSP to get and display value from an HTML page.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. Create the HTML Page (form.html)<\/h3>\n\n\n\n<p>This HTML page will have a form where users can enter data (e.g., their name), and submit it to the JSP page.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n    &lt;title&gt;JSP Input Form&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;h2&gt;Enter Your Name&lt;\/h2&gt;\n    &lt;form action=\"display.jsp\" method=\"GET\"&gt;\n        &lt;label for=\"name\"&gt;Name: &lt;\/label&gt;\n        &lt;input type=\"text\" id=\"name\" name=\"name\" required&gt;\n        &lt;input type=\"submit\" value=\"Submit\"&gt;\n    &lt;\/form&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2. Create the JSP Page (display.jsp)<\/h3>\n\n\n\n<p>This JSP file will receive the data submitted from the HTML form and display the value.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;%@ page language=\"java\" contentType=\"text\/html; charset=ISO-8859-1\" pageEncoding=\"ISO-8859-1\"%&gt;\n&lt;!DOCTYPE html&gt;\n&lt;html lang=\"en\"&gt;\n&lt;head&gt;\n    &lt;meta charset=\"UTF-8\"&gt;\n    &lt;meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\"&gt;\n    &lt;title&gt;JSP Display Value&lt;\/title&gt;\n&lt;\/head&gt;\n&lt;body&gt;\n    &lt;h2&gt;Received Information&lt;\/h2&gt;\n    &lt;p&gt;\n        &lt;strong&gt;Name: &lt;\/strong&gt; \n        &lt;%= request.getParameter(\"name\") %&gt;\n    &lt;\/p&gt;\n&lt;\/body&gt;\n&lt;\/html&gt;\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">How It Works:<\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>HTML Page (<code>form.html<\/code>)<\/strong>:\n<ul class=\"wp-block-list\">\n<li>The user enters their name into the input field and submits the form.<\/li>\n\n\n\n<li>The form sends the data via the GET method to <code>display.jsp<\/code>.<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li><strong>JSP Page (<code>display.jsp<\/code>)<\/strong>:\n<ul class=\"wp-block-list\">\n<li>The <code>request.getParameter(\"name\")<\/code> method retrieves the value of the <code>name<\/code> parameter sent by the HTML form.<\/li>\n\n\n\n<li>The retrieved value is displayed on the page using the <code>&lt;%= %><\/code> scriptlet, which outputs the result to the browser.<\/li>\n<\/ul>\n<\/li>\n<\/ol>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Write a program to develop JSP to get and display value from an HTML page. 1. Create the HTML Page (form.html) This HTML page will have a form where users can enter data (e.g., their name), and submit it to the JSP page. 2. Create the JSP Page (display.jsp) This JSP file will receive the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":97,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,4],"tags":[33,34,37,36],"class_list":["post-111","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-advanced-java","category-bscit","tag-bsc-it","tag-bsc-it-paper-solution","tag-java-server-pages","tag-jsp"],"_links":{"self":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts\/111","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/comments?post=111"}],"version-history":[{"count":1,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts\/111\/revisions"}],"predecessor-version":[{"id":112,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/posts\/111\/revisions\/112"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/media\/97"}],"wp:attachment":[{"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/media?parent=111"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/categories?post=111"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/alpeshconnect.in\/blog\/wp-json\/wp\/v2\/tags?post=111"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}