Java 在两个不同的html表中显示从GAE数据存储检索到的数据
下面是从数据存储中获取数据并将其显示在单个HTML表中的代码。现在,我想根据statusdate变量对数据进行分类,并将它们显示在两个不同的HTML表中Java 在两个不同的html表中显示从GAE数据存储检索到的数据,java,html,jsp,google-app-engine,google-cloud-datastore,Java,Html,Jsp,Google App Engine,Google Cloud Datastore,下面是从数据存储中获取数据并将其显示在单个HTML表中的代码。现在,我想根据statusdate变量对数据进行分类,并将它们显示在两个不同的HTML表中 <h2 align="center">The list of Companies with Details is given below:</h2> <table> <tr> <td>Company Name</td> <td>CTC&l
<h2 align="center">The list of Companies with Details is given below:</h2>
<table>
<tr>
<td>Company Name</td>
<td>CTC</td>
<td>10th %</td>
<td>PUC/Diploma</td>
<td>Engg</td>
<td> History Bclog</td>
<td>Current Bclog</td>
<td>Year gap</td>
<td>Visiting Date</td>
<td>Status</td>
</tr>
<%
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
Date date=new Date();
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
Query q=new Query("PlacementDB");
PreparedQuery pq= datastore.prepare(q);
for(Entity p1:pq.asIterable()){
String company_name=p1.getProperty("CompanyName").toString();
String Hist_bclog=p1.getProperty("HistoryBacklogs").toString();
String Current_bclog=p1.getProperty("CurrentBacklogs").toString();
String year_gap=p1.getProperty("YearGap").toString();
String ctc=p1.getProperty("CTCOffered").toString();
double tenth=Double.parseDouble(p1.getProperty("10th%").toString());
double twelth=Double.parseDouble(p1.getProperty("12th%").toString());
double cgpa1=Double.parseDouble(p1.getProperty("CGPA").toString());
String dateofvisit =p1.getProperty("DateOfVisit").toString();
Date dateofvisit1 =formatter.parse(p1.getProperty("DateOfVisit").toString());
String eligible_branch=p1.getProperty("EligibleBranches").toString();
int comp_h;
int comp_c;
int comp_y;
String statusdate;
if(dateofvisit1.after(date)){
statusdate="upcoming"; // display in table 1
}
else{
statusdate="past"; // display in table 2
}
if(Hist_bclog.equals("Yes")){
comp_h=1;
}
else{
comp_h=0;
}
if(Current_bclog.equals("Yes")){
comp_c=1;
}
else{
comp_c=0;
}
if(year_gap.equals("Yes")){
comp_y=1;
}
else{
comp_y=0;
}
if(eligible_branch.contains(branch)){
if(ten>=tenth && twelve>=twelth && cgpa >=cgpa1){
if(comp_h==1 && comp_c==1 && comp_y==1){
eligibility_flag="ELIGIBLE";
}
else if((history_bl <= comp_h) && (current_bl <=comp_c) && (yeargap <= comp_y)){
eligibility_flag="ELIGIBLE";
}
else{
eligibility_flag="NOT ELIGIBLE";
}
}
else{
eligibility_flag="NOT ELIGIBLE";
}
%>
<tr>
<td><%=company_name%></td>
<td><%=ctc%></td>
<td><%=tenth%></td>
<td><%=twelth%></td>
<td><%=cgpa1%></td>
<td><%=Hist_bclog%></td>
<td><%=Current_bclog%></td>
<td><%=year_gap%></td>
<td><%=dateofvisit %></td>
<td><%=eligibility_flag %></td>
<td><%=status_date %></td>
</tr>
<%
}
}
}
%>
</table>
</body>
</html>
详细公司名单如下:
公司名称
反恐委员会
10%
临市局/文凭
工程师
历史Bclog
当前Bclog
年差
访问日期
地位
=第十个和第十二个>=第二个和第十二个>=cgpa1){
if(comp_h==1&&comp_c==1&&comp_y==1){
合格性\ u flag=“合格”;
}
否则,如果((history_bl您可以通过将每个实体放入两个列表中的一个来完成此操作
LinkedList<Entity> upcomingStatusEntities = new LinkedList<Entity>();
LinkedList<Entity> pastStatusEntities = new LinkedList<Entity>();
for(Entity p1:pq.asIterable()){
Date dateofvisit1 =formatter.parse(p1.getProperty("DateOfVisit").toString());
if (dateofvisit1.after(date)){
upcomingStatusEntities.add(p1);
}
else{
pastStatusEntities.add(p1);
}
}
LinkedList upcomingStatusEntities=new LinkedList();
LinkedList pastStatusEntities=新建LinkedList();
对于(实体p1:pq.asIterable()){
Date dateofvisit1=formatter.parse(p1.getProperty(“DateOfVisit”).toString());
如果(访问日期1.在(日期)之后){
upcomingStatusEntities.add(p1);
}
否则{
pastStatusEntities.add(p1);
}
}
现在,您可以迭代这些列表来创建每个表。您可以复制表显示代码来执行此操作,但实际上,您应该创建一个用于显示此类表的函数,并调用它两次,每个列表调用一次。解释如何将Java函数放在jsp文件中