• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Problem when typing the url http://localhost:8080/PrimeFaceDemo/login.xhtml

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi ,
Any one could help me to understand the bellow code in web.xml file.

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

because i'm facing one problem with my login .xhtml file i'm created one project and configured for prime face. Initially i'm done with the login.xhtml file bellow i'm copying the code bellow..

<?xml version="1.0" encoding="UTF-8"?>

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<ui:define name="content">
<h:panelGroup layout="block">
<form id="login-form" method="post">
<h:outputText value="My Prime Face First Page" style="color:red" />
</form>
</h:panelGroup>
</ui:define>
</ui:composition>

if i'm typing the url : http://localhost:8080/PrimeFaceDemo/login.xhtml gives me blank page no out put.

i created one jsp page in the same login.xhtml place..and tried the url

http://localhost:8080/PrimeFaceDemo/test.jsp ..then this url is working fine ..
but im wondering why login.xhtml is not working..

Anyone could give me some help in this topic ...




Thanks in Advance...
Sijesh
 
Ranch Hand
Posts: 426
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure but can you try http://localhost:8080/PrimeFaceDemo/login.jsf

You're mapping *.jsf on your faces servlet.
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. You can make your code and XML samples a lot easier to read if you use the "Code" button on the message editor.

2. The technical term for a J2EE webapp that implements its own login code is "hacked" or "pwned".

3. Do not mistake URL paths for resource paths. a/b/c.xhtml is a resource path. It is the location of a resource "file" in a WAR file (or exploded WAR directory). The corresponding URL would be "http[s]://myserver:8080/mywebapp/a/b/c.jsf". A URL does not actually indicate the location of a resource, but simply serves are an identifying string that the webapp can use to access a resource or resources.

In a Facelets/JSF webapp set up with the commonly-used URL mapping options, ".jsf" URLs are broken down by the FacesServlet to get the URL fragment "a/b/c.jsf", which is then remapped to create the resource path "a/b/c.xhtml". This resource is then read and processed by the FacesServlet and the Facelets support code in order to generate the returned HTML.
 
Sijesh Alayaril
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mark,

thanks for your response :-) .may i know one more thing .if i want to save the file like .xhtml (eg: login.xhtml).How do i need to map.


Cheers,
Sijesh
 
Sijesh Alayaril
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

In My case if i written the code like this ,eg: login.xhtml its not working.


<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:panelGroup >
<h:form id="login-form" >
<h:outputText value="My Prime Face First Page" style="color:red" />
</h:form>
</h:panelGroup>
</ui:composition>



but if the written the code ed: login.xhtml like bellow its working..


<?xml version="1.0" encoding="UTF-8"?>
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui">
<h:panelGroup >
<h:form id="login-form" >
<h:outputText >My Prime Face First Page</h:outputText>
</h:form>
</h:panelGroup>
</ui:composition>


it means that the imported components(bellow mentioned ) are not getting reflected.. Im i Right?

xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.prime.com.tr/ui"


Tim i have one more query ,if it is possible to do technical -java online chating.If possible could you please guide me .

also is it possible to chat in skype .if possible my id is sijeshavs2


beveling the best from you ..

Thanks,
Sijesh
 
Sijesh Alayaril
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Thanks For all.my issuse got resolved .In web.xml file i added ,

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

both then its works fine in mozilla.but in chrome still i'm facing problem.Any one help me to fix the problem in chrome..
 
Tim Holloway
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are making the common mistake of confusing a resource path (/PrimeFaceDemo/login.xhtml) with a URL (http://localhost:8080/PrimeFaceDemo/login.jsf).

Web clients cannot access resource directory. Web clients submit URL requests. If the URL matches a URL pattern for a servlet (such as the FacesServlet), the webapp container will route that request to that servlet. In the case of JSF/Facelets, that would be the FacesServlet, which parses the URL and deconstructs it to create a corresponding View Resource path. The FacesServlet will then open that resource and compile it into an internal View component tree (note that this is different than JSPs, which are directly compiled to create servlets).
 
Sijesh Alayaril
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Tim,

in my case http://localhost:8080/PrimeFaceDemo/login.jsf is not working in google chrome ,its working only in mozilla firefox .Some browser compatibility issue i think so.


Thanks & Regards,
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic