Answer the question
In order to leave comments, you need to log in
How to make jsp and jsf friends?
Hello. Help, please, to solve a problem.
Wrote an application on EJB. I displayed variables on the page using jsf
index.xhtml :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<title>JSF 2.0</title>
</h:head>
<h:body>
<h3>Enter tariff title</h3>
<h:form>
<h:inputText value="#{beanController.tariff}"></h:inputText>
<br/>
<br/>
<h:commandButton value="Get report" action="#{beanController.getInfo}"></h:commandButton>
</h:form>
</h:body>
</html>
Answer the question
In order to leave comments, you need to log in
In my opinion JSP and JSF are 2 different versions of the same thing. Those. You need to use one. If we take JSP, then we need to use JSTL . We change the sign '#' to '$' and live happily ever after.
It can be done, but as Eugene
noted above, it does not make practical sense. The only case I can think of is the gradual migration of a project from jsp to jsf or vice versa.
Try configuring DEFAULT_SUFFIX and FACELETS_VIEW_MAPPINGS by adding to web.xml
<web-app>
<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.jsp</param-value>
</context-param>
<!-- Facelets pages will use the .xhtml extension -->
<context-param>
<param-name>facelets.VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<!-- Use prefix mapping for Facelets pages, e.g. http://localhost:8080/webapp/faces/mypage.xhtml -->
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question