Reputation: 7
I am using out.print() to print statements in JSP but can we use <%="..." %> to improve performance?
Upvotes: 0
Views: 83
Reputation: 17733
http://docs.oracle.com/javaee/5/tutorial/doc/bnaov.html
When the scripting language is the Java programming language, an expression is transformed into a statement that converts the value of the expression into a String object and inserts it into the implicit out object.
I don't think there is any performance difference - once the JSP is compiled, the resulting code is effectively the same. See this answer for a bit more context on the jsp lifecycle.
Upvotes: 1
Reputation: 1237
out.print is plenty efficient. The problem you are experiencing might lie somewhere else in your code.
Here is a good article on improving performance in a JSP:
http://www.precisejava.com/javaperf/j2ee/JSP.htm
cheers!
Upvotes: 1