I'm new to both JSF and Spring Framework and I figure out how to work them together I'm trying to My current problem is that this application outputs its JSF files without my lecture. Here are some pieces of code in my code which I believe might be compatible:
Dispatcher-servlet.xml
& lt ; Beam id = "urlmapping" category = "org.springframework.web.servlet.handler.SimpleUrlHandlerMapping" & gt; & Lt; Property Name = "Mapping" & gt; & Lt; Theater Content & gt; & Lt; Prop key = "login.htm" & gt; Login controller & lt; / Prop & gt; & Lt; / Theater & gt; & Lt; / Property & gt; & Lt; / Bean & gt; & Lt; Beam id = "viewResolver" class = "org.springframework.web.servlet.view.InternalResourceViewResolver" P: prefix = "/ web-INF / pages /" p: suffix = ".xhtml" /> & Lt; Been Name = "Login Controller" Category = "Controller. Login Controller" /> Public Class LoginController extends MultiActionController {Public ModelAndView login (HttpServletRequest request, HttpServletResponse response) throws exception {system.} LoginController Out.println ("Login"); Return a new model and view ("Login"); }
Web-INF / pages / login.xhtml
& lt ;? XML version = '1.0' encoding = 'UTF-8'? & Gt; & Lt ;; DOCTYPE HTML PUBLIC "- // W3C // DTT XHTML 1.0 Transcription // N" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> & Lt; Html xmlns = "http://www.w3.org/1999/xhtml" xmlns: h = "http://java.sun.com/jsf/html" & gt; & Lt; H: top & gt; & Lt; Title & gt; # {Message.log} & lt; / Title & gt; & Lt; / H: top & gt; & Lt; A: Body & gt; & Lt; H: form & gt; & Lt; H: Output Label Value = "# {message.username}" for = "userName" & gt; & Lt; H: inputText id = "userName" value = "# {user.name}" /> & Lt; / H: outputLabel & gt; & Lt; H: command button value = "# {message.loggin}" verb = "# {user.login}" /> & lt; / H: form & gt; & Lt; / H: Body & gt; & Lt; / Html & gt;
Any ideas where the problem might be? Does this code really make sense? I know very well that maybe it is totally useless and I will be happy here because it is useless and how can make it better Thanks :)
EDIT: I am a piece of code that The problem seems to be the root of the problem and I did not include (the course) the original question that was added:
web.xml
& Lt; Servlet & gt; & Lt; Servlet-name & gt; Despatcher & lt; / Servlet-name & gt; & Lt; Servlet category & gt; Org.springframework.web.servlet.DispatcherServlet & lt; / Servlet category & gt; & Lt; Load-On-Startup & gt; 2 & lt; / Load-on-startup & gt; & Lt; / Servlet & gt; & Lt; Servlet & gt; & Lt; Servlet-name & gt; Faces servlet & lt; / Servlet-name & gt; & Lt; Servlet category & gt; Javax.faces.webapp.FacesServlet & lt; / Servlet category & gt; & Lt; Load-On-Startup & gt; 1 & lt; / Load-on-startup & gt; & Lt; / Servlet & gt; & Lt; Servlet-mapping & gt; & Lt; Servlet-name & gt; Despatcher & lt; / Servlet-name & gt; & Lt; URL pattern & gt; * Htm & Lt; / Url pattern & gt; & Lt; / Servlet-mapping & gt; & Lt; Servlet-mapping & gt; & Lt; Servlet-name & gt; Faces servlet & lt; / Servlet-name & gt; & Lt; URL pattern & gt; / Face / * & lt; / URL pattern & gt; & Lt; / Servlet-mapping & gt;
The URL-pattern of the Faces Servlet was to be converted to * .xhtml to work properly.
If JSF tags have not been parsed, this means the request URL Url-pattern
to FacesServlet
code> as specified in web.xml
. It is responsible for all JSF incidents. You must verify that the request matches the URL url-pattern
to FacesServlet
. If this example is *. Jsf is for
, you need to apply it by http://example.com/context/page.jsf
and thus Http: // example. Com / context / page.xhtml
.
I'm not sure that the spring fits in the picture, because I do not use it, but for the JSF to work, you actually need to first request it through FacesServlet
Must have to pass, not through some spring controller. Spring should do its job after it .
Comments
Post a Comment