romanos
romanos

Reputation: 1338

JSP - when use directives and when jsp tags?

For example, consider you want forward user to another page. Which solution is better?

<%@ page forward = "anotherPage.jsp" %>

or

<jsp:forward page = "anotherPage.jsp" %>

In this case, I really can't find any differences between them.

Upvotes: 1

Views: 142

Answers (1)

JB Nizet
JB Nizet

Reputation: 691635

First of all, forwarding to another page shouldn't be done from a JSP. That's a responsibility of the controller, which should be written in Java (as a servlet, or action of your preferred MVC controller).

Now to answer your question: there is no forward directive. So you can't use it. The only existing directives are page, include and taglib. See http://careerride.com/JSP-directives.aspx (for example) for additional details.

Upvotes: 2

Related Questions