海兰!
我有一个Json对象:
HttpResponse responsePOST = client.execute(post);
HttpEntity resEntity = responsePOST.getEntity();
final JSONObject jObject = new JSONObject(EntityUtils.toString(resEntity));
Log.e("test", jObject.toString());
Run Code Online (Sandbox Code Playgroud)
日志:
{"responseData":null,"responseStatus":200,"responseDetails":null}
Run Code Online (Sandbox Code Playgroud)
码:
Log.e("test", String.valueOf(jObject.getInt("responseStatus")))`;
Run Code Online (Sandbox Code Playgroud)
日志:
200
Run Code Online (Sandbox Code Playgroud)
从Json获取Int:
if (jObject.getInt("responseStatus")== 200)
{
Toast toast ;
toast = Toast.makeText(getApplicationContext(), "OK", 500);
toast.show();
finish();
}
else
{
Log.e("else", "else");
//dismissDialog(DIALOG_LOADING);
if (jObject.getInt("responseStatus")== 500)
{
throw new Exception("Server Error");
}
else if (jObject.getInt("responseStatus")== 400)
{
throw new Exception("Wrong User/Password");
}
else
{
throw new Exception();
}
}
//pd.dismiss();
} catch (Exception e) {
Log.e("catch", "catch"); …Run Code Online (Sandbox Code Playgroud) 海兰!
我的Thread.interrupt不起作用.
代码(我们是全球的):
//Call
us = new UpdateState(params, hup);
us.start();
//Interupt
@Override
public boolean onOptionsItemSelected(MenuItem item) {
if (item.getItemId()== R.id.stopthread)
{
Log.e("Kill", "Kill");
us.interrupt();
}
return super.onOptionsItemSelected(item);
}
Run Code Online (Sandbox Code Playgroud)
类:
package android.skiptvad;
import java.util.List;
import org.apache.http.NameValuePair;
import android.os.Handler;
import android.os.Message;
import android.text.NoCopySpan.Concrete;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
import android.util.Log;
public class UpdateState extends Thread {
public List<NameValuePair> params;
public Handler handler;
public Handler ins;
public UpdateState(List<NameValuePair> params, final Handler handler) {
this.handler = handler;
this.params = params;
this.ins = new …Run Code Online (Sandbox Code Playgroud) 我只是想建立我的第一个动态网站.我想使用PHP,MYSQL,AJAX,HTML,CSS
我有一些初学者问题:
头文件和导航栏是否应在header.php中排除并使用echo打印出来?
应该在php中的echo中设计标签(如:)<a>1 Test test</a>或仅返回数据
我的主要问题是我不知道如何制作清晰的结构.在哪里做出正确的设计(在php中打印出来?)
海兰!
我想在c#中创建一个cardgame.调试器总是抛出一个NullPointerException.但是var卡不是null(它在调试期间显示了一个值)问题必须在cards.add()中.
我的代码:
namespace Uno_Logic
{
class CardStack
{
private List<Card> cards;
public void Cardstack()
{
cards = new List<Card>();
}
public void fillCardstack ()
{
for (Card_Value value = Card_Value.One; value <= Card_Value.DrawTwo; value++)
{
for (Card_Colour colour = Card_Colour.Yellow; colour < Card_Colour.Black; colour++)
{
Card card = new Card(colour, value);
Card card2 = new Card(colour, value);
cards.Add(card); //**here throws the debugger the Exception**
cards.Add(card2);
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
请帮忙!
海兰!
我有一个名为konto(engl.帐户)的jsp站点最后,我有一个按钮,通过单击并重定向回登录页面来使当前会话无效,但这不起作用.
码:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<jsp:useBean id="konto" scope="session" class="at.korn.web.Konto"></jsp:useBean>
<% if (session.getAttribute("user")== null)
{
%>
<jsp:forward page="index.jsp"></jsp:forward>
<% }
if (request.getParameter("logout")!= null)
{
session.invalidate();
%>
<jsp:forward page="index.jsp"></jsp:forward>
<% } %>
<% konto.holeKontostand(String.valueOf( session.getAttribute("user")));%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Konto</title>
</head>
<body>
<h1>Kontoübersicht</h1>
<p>Herzlich Willkommen <% out.print(session.getAttribute("user"));%> </p>
<p>Ihr Kontostand beträgt: ${konto.ktostand} </p>
<input type="submit" value="Logout" name="logout" />
<br>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
错误应该在该文件中.请帮忙!
我有一个来自我的实体的形式(weatherstation).我还有一个名为"bezeichnung"的字段(描述).当我输入一个字符串并按下搜索按钮(用于搜索)时,我总是得到一个异常:
引起:java.lang.ArrayIndexOutOfBoundsException:数组索引超出范围:0
在我的数据库中是bezeichnung"Traunstein"的一个对象
实体(带有getter和setter):
@Entity
@NamedQuery(name="findbybez", query="select w from Weterstation w where w.bezeichnung like :bez")
public class Weterstation implements Serializable {
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
@Column(nullable=false, unique=true)
@Length(min=3, max=20, message="Min.->3 Max->20")
private String bezeichnung;
@Column(nullable=false)
@Pattern(regexp="[0-9][0-9][0-9][0-9]" , message="PLZ ist falsch")
private String plz;
@Column(nullable=false)
@Length(min=3, max=20, message="Min.->3 Max->20")
@Pattern(regexp="^[A-Z][a-z]*", message="Der Ort muss einen Anfangsbuchstaben machen")
private String ort;
@Column(nullable=false)
@TempValid(message="Min -40°C, Max 40°C")
private double temp;
public Long getId() { …Run Code Online (Sandbox Code Playgroud)