0

I'm performing migration of project from JSP to JSF.

In JSP pages I have these imports

<%@ page import="org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter"%>
<%@ page import="org.springframework.security.core.AuthenticationException"%>
<%@ page import="org.springframework.security.web.WebAttributes"%>

What is the purpose of these imports in JSP? I'm asking it because JSF login page is working without it. From this point I have another question, should I replace it with anything in JSF page?

andriy
  • 4,074
  • 9
  • 44
  • 71
  • If you want to use a class in a JSP you have to tell the jsp engine about it (i.e. import it). Some reading: http://stackoverflow.com/questions/3177733/how-to-avoid-java-code-in-jsp-files –  Dec 18 '14 at 16:15
  • The original JSP code is not mine. I can't find any code in JSP that uses classes that I've mentioned. My main doubt if it is really necessary here or is it just a junk code? – andriy Dec 18 '14 at 16:28

1 Answers1

1

http://docs.oracle.com/javaee/5/tutorial/doc/bnahe.html

JSP are converted to servlets and so compiled. Which mean like in Java you need to import classes before using them.

If it's working without, there're chances that dev just copy/pasted some JSP where its needed to create this one.

Just look at the JSP code, is there any Java code that could use it?

Also you can take a bit of reading here : What is the difference between JSF, Servlet and JSP?

Community
  • 1
  • 1
Michael Laffargue
  • 10,116
  • 6
  • 42
  • 76