If there is a variable named as output defined before this (either as a scriptlet var or as a declaration var) , this code will work fine. Meaning the value of a varibale 'output' will be written to JspWriter. For example the following jsp will work fine.
If there is no variable defined before, then we will get a compilation error. If we just want to get this String "output" itself to browser then we can code like this . <jsp:expression> "output" </jsp:expression> Regards, Maha Anna [ December 13, 2002: Message edited by: Maha Annadurai ]
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="1.2"> <jsp:scriptlet> String output ="Hello World!"; </jsp:scriptlet> <jsp:expression> output </jsp:expression> </jsp:root> I think, in above code, output should be enclosed in %= output %, because this is a request time attribute expression.
A) JSP expression add some data to the output stream. XML style: <jsp:expression> other </jsp:expression> JSP style: <%= other %> -> adds the value of variable other to output stream.
B) Request time attribute expressions allow to pass dynamic values to actions like jsp:include, beans or custom tags. XML style: "%= other %" example: <jsp:include page="%= pageURL %" /> JSP style: "<%= other %>" example: <jsp:include page="<%= pageURL %>" /> -> passes the value of variable other ot include action.
So JSP style uses <%= ... %> in both cases. Hope this helps, Bernd SCJP