给你一个参考
>
转化完之后 通过 对象的属性去拿值
比如说
var json = [{"name":"test","conditions":[
{"subject":"ip",
"predicate":"default",
"value":"10180261"}],
"actions":[{
"act":"force edge to cache",
"seconds":2}]}];
var jsonObj = JSONparse(json);
jsonObjconditions就是你要的吧
数据库一般有个ID号字段。可以唯一标志一行记录
显示页面实际是个查询页面,把每一行记录都显示出来。例如你可以在每一行记录加一个删除按钮。将这个按钮和这行记录的ID号关联起来(这当然是个特循环的过程)
<a href="abcjspid=<%=rsgetInt("id")%>">sdf</a>点击这个链接就会向abcasp传递一个ID号,跟据这个ID就可以知道所有数据了
其实分不分页也无所谓,你也不必知道当前是那页,因为相当于你把每一行的记录都标了号,并且和数据库里的一一对应。
FileInputStream fr=new FileInputStream(new File("d:/1txt"));
BufferedReader br=new BufferedReader(fr);
String str;
String substr;
final int begin=0;
int end=1;
while((str=brreadLine())!=null)//读取文件的一行,循环直到文件读取完成
{
//对文件中的一行,进行字符串的截取。
while(end!=-1)
{
end=strIndxOf(","); //查找“,”在字符串中的位置,不存在返回-1;
substr=strsubstring(begin,end+1);//截取字符串的一部分,从begin开始到end+1结束。
str=strsubstring(end+1,strlenth()); //将剩下的字符串赋值,并再次截取
}
}
public voidinit(String filename) throws FileNotFoundException, IOException{
//读取数据
double[] x;
double[] y;
int num;
String strbuff;
BufferedReader tspdata = newBufferedReader(new InputStreamReader(new FileInputStream(filename)));
strbuff = tspdatareadLine();
int num = IntegervalueOf(strbuff);
// Systemoutprintln(IntegervalueOf(strbuff));
x = new double[num];
y = new double[num];
for (int citys = 0; citys <num; citys++) {
strbuff = tspdatareadLine();
String[] strcol =strbuffsplit(",");
x[citys] = IntegervalueOf(strcol[1]);
y[citys] =IntegervalueOf(strcol[2]);
}
}
//找驱动
ClassforName("oraclejdbcdriverOracleDriver");
//建连接
Connection conn=DriverManagergetConnection("jdbc:oracle:thin:@127001:1521:oracle", "scott","tiger");
//建通道
Statement stm=conncreateStatement();
//执行sql语句
int iden=stmexecuteUpdate(sql);
systeminread()做不到,
用输入输出流吧:
很长很多的代码,我学一年才记住的,现在忘了……
查了查:先加这个包:import
javaio;()主函数代码如下:
public
static
void
main(String[]
args)
throws
IOException{
InputStreamReader
reader
=
new
InputStreamReader(Systemin);
BufferedReader
input
=
new
BufferedReader(reader);
String
s
=
inputreadLine();/执行输入流 *** 作/
int
x
=
IntegerparseInt(s);/加个int型的转换/
以上就是关于关于java一个登陆页面获取数据的实现,急全部的内容,包括:关于java一个登陆页面获取数据的实现,急、Java中JSONArray如何获取数据、java高手请进;问题:如何用java代码获取任意一张网页中数据(可能是动态数据);等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)