Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.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
Jsp 页面呈现JavaBeanAdobeCQ5_Jsp_Aem - Fatal编程技术网

Jsp 页面呈现JavaBeanAdobeCQ5

Jsp 页面呈现JavaBeanAdobeCQ5,jsp,aem,Jsp,Aem,这是我在JSP文件中的当前工作代码。代码只是访问bundles服务接口,以检索用户信息并将其更新到MYSQL数据库中。我已经读到使用scriptlets是一种不好的做法,而使用javabean是一种好的做法 我的问题是如何通过一些代码示例创建一个TraineeSdatarender Java bean,这将允许我停止使用scriptlet代码来呈现数据库contenet,同时也使用引用我的OSGI包提供的TraineeService接口的“sling.getService”方法 <%@in

这是我在JSP文件中的当前工作代码。代码只是访问bundles服务接口,以检索用户信息并将其更新到MYSQL数据库中。我已经读到使用scriptlets是一种不好的做法,而使用javabean是一种好的做法

我的问题是如何通过一些代码示例创建一个TraineeSdatarender Java bean,这将允许我停止使用scriptlet代码来呈现数据库contenet,同时也使用引用我的OSGI包提供的TraineeService接口的“sling.getService”方法

<%@include file="/libs/foundation/global.jsp"%>
<%@ page import= "java.util.Iterator"%>

<html>
 <head>
  <title></title>
 </head>
<body>

   <%-- References an OSGI bundles interface through sling --%>
   <% com.netbuilder.trainees.bundle.TraineesService trainee = sling.getService(com.netbuilder.trainees.bundle.TraineesService.class); %>

   <%-- references method from an OSGI bundle to update database --%>
   <% trainee.updateTraineesData("Ben", "Brown", "ben@mail.com", 1, 1, 1, "999"); %>

   <%-- Reads and displays the data from the database --%>
   <% 
      Iterator<String> iterator = trainee.readTraineesData("all").iterator();
          while (iterator.hasNext()) {    
             out.println(iterator.next());
         }
   %>
</body>
</html>

我不能为您提供一个代码示例,因为它需要太多的代码。有来自不同公司的框架负责这一点:或者对于sling的更高版本,直接:需要澄清。在迭代器语句中。iterator.next是否实际输出html?iterator正在输出存储在本地MySQL数据库中的a用户详细信息。。。