mardi 4 août 2015

Html POST method not working

Why is my method does not work? My Java code:

@POST
@Path("/request=PostStage")
@Produces(MediaType.APPLICATION_JSON)
public String getStagePOST(@QueryParam("fn")String fn,
    @QueryParam("tn")String tn,
    @QueryParam("stat")String stat,
    @QueryParam("length")String length,
    @QueryParam("lon")String lon,
    @QueryParam("lat")String lat,
    @QueryParam("crgw")String crgw,
    @QueryParam("lane")String lane) throws SQLException{
    return "Lat: " + lat + " lon: " + lon + " crgw: " + crgw;
}

My HTML code:

<form action="http://localhost:9090/services/stage/request=PostStage" method="POST">                  
    <p>Localization:</p>
    <p> fn : <input  name="fn" /></p>
    <p> tn : <input  name="tn" /></p>
    <p>stat : <input  name="stat" /></p>
    <p>length : <input name="length" /></p>   
    <p>Geoposition:</p>
    <p>lon : <input name="lon" /></p>
    <p>lat : <input name="lat" /></p>
    <P> Other:</P>
    <p>crgw :  <input name = "crgw" /></p>
    <p> lane : <input  name="lane" /></p>
    <input type="submit" value="Searchh" />
</form> 

I give examples of parameters in a html page: lon - 12, lat - 12 etc. As a result, I get:

Lat: null lon: null crgw: null

Why?

I can not find the problem :(

Very thanks for all answers .



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire