How to output HTML from JSP <%! … %> block?

前端 未结 8 876
温柔的废话
温柔的废话 2020-12-01 10:25

I just started learning JSP technology, and came across a wall.

How do you output HTML from a method in <%! ... %> JSP declaration block?

This do

8条回答
  •  情书的邮戳
    2020-12-01 10:49

    I suppose this would help:

    <%! 
       String someOutput() {
         return "Some Output";
      }
    %>
    ...
    <%= someOutput() %>
    

    Anyway, it isn't a good idea to have code in a view.

提交回复
热议问题