一个时候应该使用<% - 标签?由于<% - 是转义,难道不只是离开应用程序容易受到攻击?什么是使用<%的好处 - 在EJS标签V/S <%=标签?
-1
A
回答
1
,当你有一个变量值得信赖 HTML你会使用它。
例如,如果你是通过降价解析器运行数据块生成HTML。
0
我告诉你哟时需要使用的每个
CASE 1 <%** DECLARE JAVA CLASS和对象**%>
我用这种形式,当我需要声明ArrayList中,比如注意&活动,在这之后我可以使用表格1中的一些表显示数据
<%
boolean flag = false;
ArrayList<NoticiasyEventos> arrayNoticiasyEventos = (ArrayList<NoticiasyEventos>) request.getAttribute("arrayNoticiasyEventos");
if(arrayNoticiasyEventos != null){
flag = true;
}
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
</body>
</html>
CASE 2 <%= VALUE =>
在这种情况下,我需要得到的Servlet特定值时,记住我声明的ArrayList然后我可以使用此阵列来获得我所需要的值
<table>
<thead>
<tr>
<th>MÓDULO</th>
<th>CATEGORÍA</th>
<th>TÍTULO</th>
<th>RESUMEN</th>
<th>DETALLE</th>
<th>FECHA NOTICIA</th>
<th>IMAGEN</th>
<th>MODIFICAR</th>
<th>ESTADO</th>
</tr>
</thead>
<tbody>
<%
if(flag){
for (int i = 0; i < arrayNoticiasyEventos.size(); i++) {
%>
<tr>
<td ><%=arrayNoticiasyEventos.get(i).getDes_mod()%></td>
<td ><%=arrayNoticiasyEventos.get(i).getDes_cat()%></td>
<td ><%=arrayNoticiasyEventos.get(i).getDes_tit()%></td>
<td ><%=arrayNoticiasyEventos.get(i).getDet_res()%></td>
<td ><%=arrayNoticiasyEventos.get(i).getDes_det()%></td>
<td ><%=arrayNoticiasyEventos.get(i).getFec_not()%></td>
<td align='center'><img id='myImg' src='<%=arrayNoticiasyEventos.get(i).getUrl_img()%>' alt='<%=arrayNoticiasyEventos.get(i).getDes_tit()%>' width='80' height='65' onclick='modalI(this);' /></td>
<td align="center"><button class='btn green-meadow' style='width: 107px;' data-target='#modal_modificar_noticias_eventos' data-toggle='modal' onclick='buscarNoticiaXId(<%=arrayNoticiasyEventos.get(i).getCod_not_eve()%>);'>EDITAR</button></td>
<td align="center"><button class='btn blue' style='width: 107px;' data-target='#modal_desabilitar_noticia' data-toggle='modal' onclick='deshabilitarNoticiaXId(<%=arrayNoticiasyEventos.get(i).getCod_not_eve()%>);'>ACTIVO</button></td>
%>
</tr>
<%
}
}
%>
</tbody>
</table>
我希望我有帮助,至于
相关问题
- 1. 什么是<image>标签,它与<img>标签有什么不同?
- 2. 语义标签的好处是什么?
- 3. 什么是<dl>标签?
- 4. 为什么<image>标签被改变的jQuery <img>标签,在Chrome
- 5. 使用ChartJS的EJS标签?
- 6. 使用ASP <% .... %>标签
- 7. 使用<jsp:useBean>标签
- 8. [HTML]如何如果<fieldset>标签是<form>标签
- 9. 什么是(真的)使用<a>标签?
- 10. 什么是最简单的<script>标签使用参数
- 11. 在html中有什么用<head>或<html>标签?
- 12. Grails中使用了<<标签库
- 13. 我可以在里面使用什么标签<article>标签
- 14. 什么是这些标签名称<%和<%=?
- 15. HTML - 什么是<page>标签在做什么?
- 16. 使用的GIF在<video>标签,或在<img>标签
- 17. <meta name =“title”>标签和<title></title>标签
- 18. 添加<span> +</ span>标签<a>标签
- 19. <u>标签和<ins>标签之间有什么区别?
- 20. php标签不工作。 php标签<php和<之间有什么区别?
- 21. 脚本标签和“<%....%>”标签有什么区别?
- 22. 为什么包括<script>标签
- 23. <script>标签内的标签
- 24. <img>标签内<a>标签只适用于IE
- 25. 在<a href>标签前移动<a id>标签
- 26. <img>标签不能嵌套在<a>标签
- 27. <audio>标签应该放在<head>标签中吗?
- 28. 使用<a>标签链接php页面使用<a>标签
- 29. 我应该在哪里使用标签<menu>,以及标签<nav>?
- 30. 在</head>标签与</body>标签之前包含Javascript的优缺点是什么?
这取决于其中输出的来源。如果因为不被信任而需要逃脱,你应该清楚地逃避它。其他时候,你真的不想逃避输出。这一切都取决于你。 – adeneo