my application contains some legacy jsp pages and the client doesn't want to convert them to xhtml, and i am trying to configure JSP pages to work in JSF 2 application, but i am getting problem that the controllers of the jsps are not getting invoked.
web.xml:
applicationContext.xml:Code:<servlet> <servlet-name>Faces Servlet</servlet-name> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class> <load-on-startup>1</load-on-startup> </servlet> <servlet-mapping> <servlet-name>Faces Servlet</servlet-name> <url-pattern>/faces/*</url-pattern> </servlet-mapping> <context-param> <param-name>javax.faces.DEFAULT_SUFFIX</param-name> <param-value>.jsp</param-value> </context-param> <context-param> <param-name>javax.faces.FACELETS_VIEW_MAPPINGS</param-name> <param-value>*.xhtml</param-value> </context-param>
and my jsps are under: webapp/pages/jspsCode:<mvc:annotation-driven /> <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/pages/jsps/"/> <property name="suffix" value=".jsp"/> </bean>
MyController:
ISSUE:Code:@Controller @RequestMapping("/senddata") public class SendDataController { @RequestMapping(method = RequestMethod.GET) public String get(HttpServletRequest request, HttpServletResponse response) throws Exception { log.debug("SendDataController"); return "senddata"; } }
i can only access the jsps via following link:
and the controllers are not getting invoked, please advise how to make the controller gets invoked.Code:http://localhost:8080/MyApp/faces/pages/jsps/senddata.jsp
and second question is how to make the url looks pretty as:
i am using PrettyFaces for pretty urls for jsf, should i use tuckey url rewrite for the jsps ?Code:http://localhost:8080/MyApp/senddata
when turning on the debug, i can see that the mapping is correct:
Code:2012-07-09/12:52:48.348 [Thread-2] INFO Mapped URL path [/senddata] onto handler 'sendDataController' 2012-07-09/12:52:48.348 [Thread-2] INFO Mapped URL path [/senddata] onto handler 'sendDataController' 2012-07-09/12:52:48.348 [Thread-2] INFO Mapped URL path [/senddata.*] onto handler 'sendDataController' 2012-07-09/12:52:48.348 [Thread-2] INFO Mapped URL path [/senddata.*] onto handler 'sendDataController' 2012-07-09/12:52:48.348 [Thread-2] INFO Mapped URL path [/senddata/] onto handler 'sendDataController' 2012-07-09/12:52:48.348 [Thread-2] INFO Mapped URL path [/senddata/] onto handler 'sendDataController'


Reply With Quote
