JavaScript代码:
var ref =dojo.byId("xyz");
var optn = document.createElement("OPTION");
optn.text="txt"
optn.value="val"
ref.options.add(optn);
Run Code Online (Sandbox Code Playgroud)
我想要dojo相当于上面的代码
我需要201 Created为POST请求放置一个Response代码和一个Location头,但由于某种原因,我仍然得到302响应.
这就是我所拥有的:
header('HTTP/1.1 201');
header("Location: ..."); // The new resource URL
header('Content-type: application/json; charset=utf-8');
echo $response;
exit;
Run Code Online (Sandbox Code Playgroud)
我已经尝试删除内容类型,echo并且exit没有任何运气,仍然得到302.我读到我需要指定两个标题,但这就是我正在做的事,没有运气.我也尝试过:
header("Location: ...", TRUE, 201);
Run Code Online (Sandbox Code Playgroud)
没什么,仍然有302 :(
有人知道我没看到什么吗?
谢谢.
我正在尝试使用从Web Service检索的一些数据创建DataGrid.在经历了很多痛苦后,我意识到问题不在数据中,也不在服务中.我能够以声明方式创建DataGrid,但我需要以编程方式进行,因为我将在更复杂的场景中执行此操作.
我从一个复杂的用例转到一个非常简单的用例,它仍然失败了.我所看到的只是DataGrid,但经典的"抱歉,发生错误"错误.
+----------+----------------------------+
| id | name |
+----------+----------------------------+
| Sorry, an error occurred |
| |
Run Code Online (Sandbox Code Playgroud)
这是我的简化示例:
<html>
<head>
<link rel="stylesheet" href="MyCSS.css">
<script type="text/javascript" src="lib/dojo/dojo.js" charset="utf-8"></script>
<script>
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("dojox.grid.DataGrid");
</script>
</head>
<body class="soria">
<div id="node" style="width:650px;height:300px"></div>
<script>
var structure = [
{field: "id", width: 20},
{field: "name", width: 100}
];
var data = [
{"id": 1, "name": "John"},
{"id": 2, "name": "Lucy"}
];
var node = dojo.byId("node");
var store = new dojo.data.ItemFileReadStore({
data: data
});
var grid = …Run Code Online (Sandbox Code Playgroud) 我知道它的局限性,但是如果我只打算上课,比如说
public class GUIWindow
{
static JFrame theGUI = new JFrame();
public static void main(String[] args)
{
theGUI.setSize(900, 600);
theGUI.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
theGUI.setLocationRelativeTo(null);
}
public static void main(Object obj)
{
String[] array = new String[1];
main(array);
theGUI.setTitle(obj.getClass().getName());
}
public static void main()
{
String[] array = new String[1];
main(array);
theGUI.setTitle(null);
}
}
Run Code Online (Sandbox Code Playgroud)
我可以调用创建一个特定大小的默认GUI窗口来测试多个应用程序,这是一件好事吗?
我正在学习,我是新手,但我想知道我做了什么来"跑"它.这发生了一个错误:
Static Error: This class does not have a static void main method accepting String[].
Run Code Online (Sandbox Code Playgroud)
这是代码:
/**
* @author "LionH"
*/
public class Caneirinho {
public static void contar() {
int i = 1;
String a = " Carneirinho",
b = " pulando a cerca.",
c = "s";
for (i = 1; i <= 100; i++) {
if (i == 1) {
System.out.println(i + a + b);
} else {
System.out.println(i + a + c + b);
}
}
} …Run Code Online (Sandbox Code Playgroud) dojo ×2
java ×2
datagrid ×1
http ×1
http-headers ×1
httpresponse ×1
javascript ×1
php ×1
post ×1