out printin(<html><head><title>singerparamter<title></head>);
时间: 2023-11-16 14:01:01 浏览: 36
根据提供的引用内容,无法完全理解您的问题。但是,根据引用和引用的代码,可以看出这是Java Server Pages(JSP)的代码。其中,out.println()是用于将文本输出到JSP页面的方法。而在您提供的问题中,缺少了结束的标签,应该是</title>而不是<title>。因此,正确的代码应该是:
out.println("<html><head><title>singerparamter</title></head>");
相关问题
给定JSP程序源码如下,可以在下划线处插入并且能够正确输出"WELCOME,ACCP"的语句是()。<htm1> <body> <%String name="AcCP" ; %>WELCOME,----- </body> </htm1> (选择二项) A: name B:<%=name%>c: out.printIn(name); D:<% out.printIn(name);%>
B: <%=name%> 和 D: <% out.printIn(name);%> 都可以正确输出"WELCOME,ACCP"。
解释如下:
- 选项B:使用 `<%=name%>` 可以输出name变量的值,即"ACCP"。
- 选项D:使用 `out.println(name);` 也可以输出name变量的值,即"ACCP"。
因此,选项B和D都是能够正确输出"WELCOME,ACCP"的语句。
补全代码public class Mongoconnect{ public static void main( String args[ ){ try{ MongoClient mongoClient = new_ (1)_ ; MongoDatabase mongoDatabase = mongoClient.getDatabase("mydb1"); mongoDatabase.drop0; mongoDatabase.createCollection("test1"); MongoC ollection<Document> collection =_ _(2)_ ; Document document1 = new Document); document1.append("_ id", "1"); (3)___ ; document1.append("sex", "man"); (4)_ ; List<Document> documents = new ArrayList <Document>0; documents.add(document1); collection.insertMany( (5)_ ); Findlterable <Document> iter =_ (6)_; iter.forEach(new Consumer <Document>0 { @Override public void accept(Document document) { System.out.printIn(document.toJson0); }); Document doc =_ (7)_ ; collection._ (8)_ ; }catch (Exception e) { System.er.println( e.getClass0.getName0 + ": " + e.getMessage0 ); }
public class Mongoconnect{
public static void main(String args[]) {
try{
MongoClient mongoClient = new MongoClient(); // (1) 创建MongoDB客户端
MongoDatabase mongoDatabase = mongoClient.getDatabase("mydb1");
mongoDatabase.drop();
mongoDatabase.createCollection("test1");
MongoCollection<Document> collection = mongoDatabase.getCollection("test1"); // (2) 获取集合
Document document1 = new Document();
document1.append("_id", "1"); // (3) 添加字段
document1.append("name", "John");
document1.append("sex", "man"); // (4) 添加字段
List<Document> documents = new ArrayList<Document>();
documents.add(document1);
collection.insertMany(documents); // (5) 插入文档
FindIterable<Document> iter = collection.find(); // (6) 查询集合中所有文档
iter.forEach(new Consumer<Document>() {
@Override
public void accept(Document document) {
System.out.println(document.toJson());
}
});
Document doc = collection.find(eq("_id", "1")).first(); // (7) 查询指定文档
collection.deleteMany(eq("_id", "1")); // (8) 删除文档
} catch (Exception e) {
System.err.println(e.getClass().getName() + ": " + e.getMessage());
}
}
}