是否有使用scriptlet标记为aspx页面出了问题? [英] Is there a problem using scriptlet tags for aspx page?

查看:152
本文介绍了是否有使用scriptlet标记为aspx页面出了问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已在其中大部分内容的大干快上,我已经写在scriptlet标记逻辑生成的aspx页面。
对于如

I have made an aspx page in which much of the content gets generated on the logic that I have written in scriptlet tags. For eg

<%
  foreach(var data in dataCollection)
  { 
    int i=0;
%>
   <div>Enter value : &nbsp; <input id="<%=i %>" type="text" /></div>

<% } %>

这样我建立基于如何将数据从后面来的逻辑整页和数据是如何在页面上被适当地显示。

like this I have built the whole page based on the logic of how the data is coming from back and how the data is to be appropriately shown on the page.

那么,有没有与具有aspx页面小脚本的问题吗?有什么样的最佳做法,建议不要使用小脚本的aspx页面?

So, is there an issue with having scriptlets in aspx page? Is there something like best practice which advises against the use of scriptlets in aspx page?

谢谢
Saarthak

Thanks Saarthak

推荐答案

所有的小脚本首先是Java的概念,不是吗?每一种技术都有其术语和最佳实践之一其正式名称是调用的东西。

First of all "scriptlet" is a Java concept, isn't it? Every technology has its terminology and one of best practices is call things by their proper name.

这是行内的服务器code。

This is inline server code.

关于如果有一些问题与,当然这并不像3.0共用名称,但ASP和ASP.NET是完全不同的事情。

About if there's some issue with that, certainly this isn't the recommended approach for ASP.NET, but for earlier classic ASP like 3.0 which share the name but ASP and ASP.NET are absolutely different things.

在ASP.NET中,在任意页面有一个标记code(页声明,控件注册,标准的XHTML客户端code和用户,并自定义服务器控件)。

In ASP.NET, in any page there's a markup code (page declaration, control registration, standard XHTML client-side code and user and custom server controls).

任何逻辑,处理或任何处理客户的互动和渲染必须放置在System.Web.UI.Page派生类,通常被称为code-背后(例如,Default.aspx.cs)。

Any logic, processing or anything handling client interaction and rendering must be placed in a System.Web.UI.Page derived class, usually called "code-behind" (for example, Default.aspx.cs).

ASP.NET强制标记和客户端脚本从服务器端后端共分离。

ASP.NET enforces a total separation of markup and client-side scripting from server-side backend.

这篇关于是否有使用scriptlet标记为aspx页面出了问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆