2012-05-20 88 views
0

我有一個簡單的表格:的Restlet POST方法參數始終是空

<form action="send_email" method="post"> 
<input type="text" id="message"> 
<button type="submit">Send</button> 
</form> 

它關係到我的資源handlePost方法。但Representation entity總是傳遞null。

@Post 
public Representation handlePost(Representation entity) throws ResourceException{ 
    Form form = new Form(entity); 
    ... 
    return StringRepresentation("test"); 
    } 

這是爲什麼?我怎樣才能獲得我的表單輸入值?

回答

0

得到了答案。愚蠢的錯誤。我必須將name屬性放在元素中

<input type="text" id="message" name="message">