Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/213.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在Android中发布jsf数据_Android_Post_Jsf 2_Http Post - Fatal编程技术网

如何在Android中发布jsf数据

如何在Android中发布jsf数据,android,post,jsf-2,http-post,Android,Post,Jsf 2,Http Post,我可以在Android中发布jsf表单数据吗 <h:form> <h:panelGrid columns="2" border="0"> <h:outputLabel value="Adınız : "/> <h:inputText value="#{pd.ad}"/> <h:outputLabel value=""/> &l

我可以在Android中发布jsf表单数据吗

<h:form>
        <h:panelGrid columns="2" border="0">
            <h:outputLabel value="Adınız : "/>
            <h:inputText value="#{pd.ad}"/>
            <h:outputLabel value=""/>
            <h:commandButton value="Gönder" action="#{pd.kontrol()}"/>
        </h:panelGrid>
    </h:form>
<h:outputText value="#{pd.sonuc}" />

我想在Android中发布“广告”数据。这是我的Android代码

private TextView postData;
private String url = "http://localhost:8084/AndroidIc_nPOSTsayfa";

@SuppressLint("NewApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    if (Build.VERSION.SDK_INT >= 9) {
        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
        StrictMode.setThreadPolicy(policy);
    }

    HttpClient httpClient = new DefaultHttpClient();
    HttpPost httpPost = new HttpPost(url);

    postData = (TextView)findViewById(R.id.postData);

    try {
        List<NameValuePair> pairs = new ArrayList<NameValuePair>();
        pairs.add(new BasicNameValuePair("#{pd.sonuc}", "Mesut Emre"));
        httpPost.setEntity(new UrlEncodedFormEntity(pairs));

        ResponseHandler<String> responseHandler = new BasicResponseHandler();
        String response = httpClient.execute(httpPost,responseHandler);
        System.out.println(response);
        postData.setText("Alınan veri:"+response);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
private TextView postData;
专用字符串url=”http://localhost:8084/AndroidIc_nPOSTsayfa";
@SuppressLint(“新API”)
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
如果(Build.VERSION.SDK_INT>=9){
StrictMode.ThreadPolicy policy=新建StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(策略);
}
HttpClient HttpClient=新的DefaultHttpClient();
HttpPost HttpPost=新的HttpPost(url);
postData=(TextView)findViewById(R.id.postData);
试一试{
列表对=新的ArrayList();
添加(新的BasicNameValuePair(“#{pd.sonuc}”,“Mesut-Emre”);
setEntity(新的UrlEncodedFormEntity(对));
ResponseHandler ResponseHandler=新BasicResponseHandler();
String response=httpClient.execute(httpPost,responseHandler);
System.out.println(响应);
setText(“Alınan veri:+响应”);
}捕获(例外e){
e、 printStackTrace();
}
}

运行应用程序时没有错误,但无法在textview上查看发送的数据。

是否打印响应。。在日志中,请更深入地描述你想要实现的目标。你到底想干什么?你有什么错误吗?没有,我没有错误。但我在textview上看不到任何结果。我有一个本地jsf页面。我想在来自jsf表单的文本框上实现显示,换句话说,在android中发布帖子。