0

I have index.xhtml page, from which I call admin.xhtml. When I put this part of code in index.xhtml page, everything works great, but when put the same code in admin, it doesn`t show input fields. Can someone explain me why is this happening? My pages have only this code in them for now. Do I have to change something elsewhere? Thank you for your patience.

    <h:form>
        <h3>Username:</h3>
        <h:inputText value="#{controler1.user}"/> 
        <h3>Password:</h3>
        <h:inputSecret value="#{controler1.pass}"/> <br/>
        <h:commandButton value="Log in" action="#{controler1.LogIn()}"/>
    </h:form>

edit: I am sorry for not being precise enough. I checked to see what happens when clicked View Source, and it shows jsf unparsed code, the same as typed in project. I looked around the internet, and there were some answers about FacesServlet not being invoked. That is probably what is wrong here. The problem is, that I do not know what exactly should I change. Here is my web.xml:

    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <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>
    <session-config>
    <session-timeout>
        30
    </session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>faces/index.xhtml</welcome-file>
    </welcome-file-list>

I would appreciate your help. Thank you.

mimi
  • 50
  • 10
  • Why must you repeat code? Shouldn't be in two pages. That's a bad smell. – duffymo Jun 03 '16 at 01:07
  • @duffymo I didn not put it at the same time. I tried this code in index.xhtml to see if it could work there, and it does, but when I try it in admin.xhtml, it does not work properly. – mimi Jun 03 '16 at 01:11
  • 1
    Instead of unhelpfully saying "doesn't work" as if you were the ignorant enduser, tell what exactly happens instead as if you were the web developer itself. To start, rightclick page in webbrowser and do *View Source*. What exactly do you see there? Do you see the JSF-generated HTML output? Or do you still see the unparsed JSF source code there? – BalusC Jun 03 '16 at 07:14
  • @BalusC I edited the question. Thank you for your trying to help. – mimi Jun 03 '16 at 18:30
  • As I guessed. See the duplicate for the answer. – BalusC Jun 03 '16 at 18:52
  • @BalusC Thank you so much! It works! But I must ask, how come my past projects worked and didn`t make this kind of problems? Also, should I delete this question, since it is practically the same as the one you posted? – mimi Jun 03 '16 at 19:43
  • Because you apparently used the right URL and/or mapping. You don't need to delete the question. Duplicates feed search engines with new keywords. – BalusC Jun 03 '16 at 20:45

0 Answers0