Friday, 6 September 2013

I want to write only jsp, jstl in .jsp file

I want to write only jsp, jstl in .jsp file

I'm learning JSTl+EL and I don't like that I have to use <% %> tags inside
of JSP files. I also haven't found good documentation on the topic as well
- good pointers welcomed. (This:
http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/ isn't helping
much). So my question is can I write some better JSTL+EL below so that i
could get <% %> tags out of my JSP? :)
<% if (session.getAttribute("error") != null) {%>
<jsp:useBean id="error" class="java.lang.String"
scope="session"></jsp:useBean>
<%=error %>
<%}else if(session.getAttribute("searchData")!= null){%>
<%=session.getAttribute("searchData")!=null %>
<jsp:include page="session_object_ok.jsp"></jsp:include>
<%}%>
<%
session.setAttribute("searchData", null);
%>

No comments:

Post a Comment