Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

<%# %> vs <%= %> [duplicate]

Tags:

asp.net

Possible Duplicate:
ASP.NET “special” tags

What is the difference between <%# ... %>, <%= ... %> and <%$ ... %>?

I couldn't find anything information about this. It's impossible to find "<%=" using a search engine.

Do these tags have a name?

like image 498
Bart Avatar asked Apr 13 '10 21:04

Bart


People also ask

What is the use of <% in JSP?

%> is used to embed some java code within the main service() method of the JSP. It is executed during the rendering of the page. <%! ... %> is used to define code outside of the flow of the page, and therefore outside the main service() method.

What is a expression in JSP <%= %> <% %>?

A JSP expression is used to insert the value of a scripting language expression, converted into a string, into the data stream returned to the client.

What are JSP tags?

It stands for Java Server Pages. It is a server side technology. It is used for creating web application. It is used to create dynamic web content. In this JSP tags are used to insert JAVA code into HTML pages.

What is the syntax of scriptlet tag?

A scriptlet tag is used to execute java source code in JSP. Syntax is as follows: <% java source code %>


1 Answers

<%= ... %> is generally equivalent to Response.Write(...) it cannot be used in a control attribute that is runat="server"

<%: ... %> (as of .NET v4.0) is an html encoded version of <%= %> (as @Eric mentions)

<%# ... %> is used in data-binding context for Bind, Eval or Output (as @Ray mentions)

<%$ ... %> is used in the context of a control attribute with runat="server" (google "expression builder" also have a look at making a general purpose 'Code' expression builder. it is evaluated when the attribute/Parameter is required by the control.

like image 175
Myster Avatar answered Oct 04 '22 13:10

Myster