Does anyone know how can I send parameters in a POST to a servlet?
I use that in my VC++ code :

....
if ( !(hReq = HttpOpenRequest (hConnect, "POST", szObject, HTTP_VERSION, "",
(LPCTSTR*) AcceptTypes, dwFlags ,0 )))
{
    ErrorOut (GetLastError(), "HttpOpenRequest");
    return 0;
}

const char headers[] = "Compression:false";
LPCTSTR lpszHeaders = headers;
char optional[] = "direccion=sebas";
if ( !HttpSendRequest (hReq, lpszHeaders, sizeof(headers), optional,
sizeof(optional)) )
{
       ErrorOut (GetLastError(), "HttpSendRequest");
...

and in the servlet :

....
public void doPost(HttpServletRequest req, HttpServletResponse res) throws
ServletException, IOException
{
...
direccion = req.getParameter("direccion");
....
}




When I execute the c++ code, i get a exception from the servlet because it
can't get the parameter.

Thank's for you help.



Reply via email to