Home Answers Viewqa JSP-Servlet post method does not support this url

 
 


Prakhar Jain
post method does not support this url
0 Answer(s)      a year ago
Posted in : JSP-Servlet

This is Get product servlet class of Shoping site example of Http Session. I want to add selected product in the cart thorough this class i want to delegate control to add product servlet. but I am receiving one error that is post method does not supported by this url.

package com.prakhar.servlet;

import java.io.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*;

public class GetProductsServlet extends HttpServlet { public void init()throws ServletException { productsdao=new ProductsDAO(); }

public void doGet(HttpServletRequest req,HttpServletResponse res)throws ServletException,IOException
{
    HttpSession hs=req.getSession(false);
    if(hs==null)
    {
        RequestDispatcher rd=req.getRequestDispatcher("Login.html");
        rd.forward(req, res);
        return;
    }
    String uname=(String)hs.getAttribute("UserName");
    res.setContentType("text/html");
    PrintWriter out=res.getWriter();

    out.println("<html><head>");
    out.println("<title>Shoping Cart Example</title>");
    out.println("</head><body>");
    out.println("<table width='100%' height='90%' border='1'>");
    out.println("<tr align='center'>");
    out.println("<td height='39' colspan='2'><strong><font size='5'>MyShoppingSite</font></strong></td>");
    out.println("</tr>");
    out.println("<tr>");
    out.println("<td width='18%' height='500' valign='top'><p>&nbsp;</p>");
    out.println("<blockquote><p>");
    out.println("<a href='"+res.encodeURL("getProducts")+"'>");
    out.println("View Products</a></p><p>");
    out.println("<a href='"+res.encodeURL("getCart")+"'>");
    out.println("View Cart Detail</a></p><p>");
    out.println("<a href='"+res.encodeURL("logout")+"'>");
    out.println("Logout</a></p>");
    out.println("</blockquote></td>");
    out.println("<td width='82%' align='left' valign='top'><p>");
    out.println("<font size='6'>Welcome , "+uname+"</font></p>");
    out.println("<form method="post" action='"+res.encodeURL("addProducts")+"'>");
    System.out.println(res.encodeURL("GetProductsServlet"));
    out.println("<table width='100%' border='1'>");
    out.println("<tr>");
    out.println("<th width='8%'>Check</th>");
    out.println("<th width='24%'>Product Code</th>");
    out.println("<th width='28%'>Product Name</th>");
    out.println("<th width='20%'>Available Quantity</th>");
    out.println("<th width='20%'>Required Quantity</th>");
    out.println("</tr>");

    Collection products=productsdao.getProducts();

    System.out.println("GetProductsServlet"+products);

    if(products==null)
    {
        out.println("<tr><td colspan=5 align=center>");
        out.println("No Products Available");
        out.println("</td></tr>");
    }
    else
    {
        Iterator i=products.iterator();

        System.out.println("Iterator"+i);

        while(i.hasNext())
        {
            Product p=(Product)i.next();
            out.println("<tr>");
            out.println("<td align='center'>");
            out.println("<input type='checkbox' name='products' value='"+p.getCode()+"'/>");
            System.out.println("GetProductServlet p.getCode()"+p.getCode());
            out.println("<input type='hidden' name='"+p.getCode()+"Name' value='"+p.getName()+"'/></td>");
            out.println("<td>"+p.getCode()+"</td>");
            out.println("<td>"+p.getName()+"</td>");
            out.println("<td>"+p.getQty()+"</td>");
            out.println("<td>");
            out.println("<input type='text' name='"+p.getCode()+"'/>");
            out.println("</td></tr>");
        }
    }   
        out.println("</table>");
        out.println("<br/><center>");
        out.println("<input type=submit value='Add Product to Cart'/>");
        out.println("</center>");
        out.println("</form>");
        out.println("</td></tr>");
        out.println("<tr align='center'>");
        out.println("<td colspan='2'>");
        out.println("<em>&copy;Copyrights 2005-09</em></td");
        out.println("</tr>");
        out.println("</table>");
        out.println("</body></html>");
        out.flush();
        out.close();

}

ProductsDAO productsdao=new ProductsDAO();

}

View Answers









Related Pages:
post method does not support this url
post method does not support this url  This is Get product servlet.... but I am receiving one error that is post method does not supported by this url...;"); out.println("<form method="post" action='"+res.encodeURL("addProducts")+"'>
post
post method in PHP  Write an example of the post method in PHP... values in the url will be hidden   in post   post is the method in php   PHP Post method
Object does not support proprty or method
Object does not support proprty or method  Hi I have been given some... on a network machine it returns a error which say's Object does'nt support this property or method. It seems to have a problem with this type of line
Post Method of the Form In JSP
POST method in the form. This method doesn't append the URL. This method... Post Method of the Form In JSP   ... of the post method of the form in JSP. The HTTP post method sends data
POST or GET
method the value given in the text field is also available in the URl which takes more execution time for processing.In the POST method no information is given to ULR that's why POST is faster then GET method
Does hibernate support polymorphism?
Does hibernate support polymorphism?  Hi, Does hibernate support polymorphism? thanks
why java does not support multiple inheritance - Java Beginners
why java does not support multiple inheritance  hello friend, i... complexity.Therefore java does not support it directly. Thanks... A1,A2,A3 classes have same method identifier but with different parameters class A1
POST METHOD
POST METHOD      ... the data from the server. In POST the data will not get appended in the URL but sent... action and the method which will be used to send the data to server is post which
What is the difference between GET and POST method?
Method in PHP, as POST method never shows the assigned values into the URL. Where...What is the difference between GET and POST method?  In PHP, both GET and POST method serves the same feature to get the data in variable. Still
HTML Post Radio Button
; HTML Post attribute used in method, when a user is not able to see the data in the URL of browser. Post method is used for sending, updating and sending a mail. The Post method is not so effective method of hiding a data
How to send URL in Post request from local server to remote server?
How to send URL in Post request from local server to remote server?  ... to another server remotely?What to do in code??? 2> How to send a Post Request... for execution. Here IPAddress is for Remote Tomcat server. Which method to implement
Does Java support multiple inheritance?
Does Java support multiple inheritance?  Hi, Does Java support multiple inheritance? thanks   hi, Please visit the following link: http://www.roseindia.net/java/language/inheritance.shtml Hope
Creating URL using <c:url>
; <form action="JSTLCreatingURL.jsp" method="post"> <table>...Creating URL using <c:url>     ... it or by or by using the existing one. If the browser doesn't support the cookies
Difference between GET and POST
. The method used in the Servlet for processing either a GET or a POST is different..., HttpServletResponse). The doGet method is also called if there is no GET or POST data. If you use a POST, the method called is doPost(HttpServletRequest
Why does Java not support operator overloading?
Why does Java not support operator overloading?  Hi, Why does Java not support operator overloading? thanks
php $_GET and $_POST functions
request is for one URL and since GET method does not change,  browsers..., whereas $_POST does not have such kind of limitations, we can send any amount... can see the values in address bar, on the contrary $_POST does not allow any
<c: url> in JSTL
; <body> <form method="POST"> <center> <table border...="${pageContext.request.method=='POST'}"> <hr> <c:url value... it or by or by using the existing one. If the browser doesn't support the cookies
Java Servlet : Difference between GET and POST
; will differentiate the GET and POST method of servlet. GET - It is HTTP method, asks to get thing at the requested URL. POST - It is HTTP method, asks... you can use POST in such case because POST method provides security. If we
How to work with POST method in jsp page
); %> // use POST method to avoid show data in url <FORM NAME... How to work with POST method in jsp page... POST method instead of GET method in jsp page. GET is default method for sending
What is a pointer and does Java support pointers?
What is a pointer and does Java support pointers?   Hi, What is a pointer and does Java support pointers? Thanks   Hi, Pointer... to memory leaks and reliability issues hence Java doesn't support the usage of pointers
HTTPClient Post method
HTTPClient Post method    HTTPClient Post method HI friends, I am trying a JAVA API for this i want a Java HTTPClient program. i tried but i am unable to complete. can any one plz help me.......... Plz, PLz help me out
GET and POST Method of HTTP
GET  and POST Method of HTTP   .... In get method the data we send get appended to the URL so whatever you will send... method is more powerful request. By using Post we can request as well as send
get and post
get and post  what is php and get   PHP get and post method
POST AND GET METHOD - JSP-Servlet
POST AND GET METHOD  I AM LITTLE BIT CONFUSED IN GET() AND POST() METHODS. PLZ GIVE ME BREIF INTRODUCTION ABOUT THESE ??:)  Hi Friend, Please visit the following links: http://www.roseindia.net/jsp
jQuery to Post Data Check
jQuery to Post Data Check      ... that checking the data Post to server and displays on the user browser. In this example we..., or ASP program. Steps to develop the Post Data Check program Step 1: Create php
URL Encoding and URL Decoding
URL Encoding and URL Decoding  What is URL Encoding and URL Decoding ?   URL encoding is the method of replacing all the spaces and other extra characters into their corresponding Hex Characters and Decoding
Post Message In servlet
Post Message In servlet      ... to servlet. In the following program, you will learn how to post massage.  Code Description: The following program uses getOutputStream() method
HTTP Post PHP
HTTP Post PHP  HTTP post method example in PHP
How does Social Media Marketing Work
How does Social Media Marketing Work In this section we will understand... Marketing really works for your website. How does Social Media Marketing Work... url, products and discount coupons to them. If your products and services
Java Servlet : URL Rewriting
another way of session tracking that is URL rewriting where your browser does not support cookies. It is mechanism by which the requested URL is modified...Java Servlet : URL Rewriting In this tutorial, we will discuss about URL
The $_POST Function
submit with method="post". When you send data using POST method...;/form> Fetching form data sent via POST method You can fetch data... to use POST method : Example : <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML
Converting a Filename to a URL
, for this we use a method toURL(). It returns a URL object and throws...() : It is used to convert the file name into the URL. getFile() : This is the method... Converting a Filename to a URL     
post
post  what is post   vxvxcvxcv   Please visit the following link: Post in PHP
How to handle traversing in CustomItem of J2ME in a mobile phone which does not support traversing?
of J2ME in a mobile phone which does not support traversing? Im doing a mobile... process in a mobile which does not support traversing. Thanks & Regards...How to handle traversing in CustomItem of J2ME in a mobile phone which does
Struts 2 Url Validator
;method="POST" action="urlValidation1">  </td>...Struts 2 Url Validator      ... the given field is a valid URL or not. If the entered value is not a valid URL
Create URL using <c:url> tag of JSTL Core tag library
Create URL using <c:url> tag of JSTL Core tag library... to create a url according to the user's given parameter by using <c:url> tag... to create url with some optional parameters. Attributes
PHP HTML forms and Post Method Code
PHP HTML forms and Post Method Code PHP html function With the given PHP HTML... HTML Code <HTML><BODY> <FORM METHOD=?POST... to create html forms and display data using PHP Post Method in PHP
how i do url encoding process - JSP-Servlet
how i do url encoding process  hai to all how i do the url encoding., when i passing data from one jsp page to another page,while passing some... post method., but here i want some of the url encodings plz help me., thanx
what does mean of method("1") in below struts.xml file
what does mean of method("1") in below struts.xml file  Hi, here is my code /register.jsp /register.jsp /success.jsp
Sun's JDBC-ODBC driver does not implement the getPrimaryKeys() method for the DatabaseMetaData Objects.
Sun's JDBC-ODBC driver does not implement the getPrimaryKeys() method...) for an Access Database table? Sun's JDBC-ODBC driver does not implement the getPrimaryKeys() method for the DatabaseMetaData Objects
url parameter using retrive data from database in jsp
show their support for their team   Post your code   ...url parameter using retrive data from database in jsp  The user can..., preview and save and post buttons. Once the user entered all the datas and if he
Software Support Services, Application Support Solutions, Support and Maintenance Services and Solutions
are looking for post-product development support and maintenance or on-going...Software Support Services from Rose India Rose India is prominent software... maintenance support and services to various organizations. Software services
JQuery url validation
jQuery url Validation : jQuery "required url" is the method to validate or check url if the element is empty (text input) or  wrong url type entered .We can validate our url in another type by writing the "url
JSP URL Encoding
JSP URL Encoding          JSP URL Encoding is used to encode the url in JSP. URL Encoding is the process of converting string into valid URL format
JSP Get URL
;%=request.getRequestURL()%> : The method is used to obtain the URL of the current JSP page.  ... JSP Get URL          JSP Get URL is used to get the url of the current
HTTP GET or POST for my AJAX call
request URL. An HTTP POST should be used when state is updated on the server...HTTP GET or POST for my AJAX call  hello, Should I use an HTTP GET or POST for my AJAX calls?   Hii, AJAX requests should use an HTTP
UIImageView set Image URL
UIImageView set Image URL  Show image by URL   UIImageView set image url Create NSURL object and add the Image URL to it. Create NSData... to it by imageWithData: method Finally, you can add UIImage to Image view. Find
How does Email works
How does Email works      ... represents standard method used at each end of a communication channel..., that SMTP Server will transfer the message to recipient SMTP Server. POP (Post
url capture in javaScript
url capture in javaScript  Hi All, I m creating a bookmark to capture the url of the site and the user's input in the bookmark,in javaScript.this url and user input is to be saved into DB. Following is my code.Result
How to store url path?
How to store url path?  Image is stored in physical directory like...() + ".PNG"; this physical directory is working fine but I want store in url...) at java.io.RandomAccessFile.open(Native Method) at java.io.RandomAccessFile.<

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.