• 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

Page does not show form

 
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
HI I have this xhtml page in a tutorial i am following that should show a form with an input and submit button, but the browser shows a blank page, here the xml and the bean java class, thanks
( my frustration arise from the fact I cannot understand if I do typo's, I mean if instead of <h:form> I write <h:formabc> Eclipse does not find any mistake as far the tag is closed />



bean

 
Sheriff
Posts: 3063
12
Mac IntelliJ IDE Python VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That's interesting. I don't have an environment to test on right now, but it seems to me Eclipse does warn you when you use a tag not in the tag library. Maybe you need to include the taglib directive explicitly? That is ...


Just to clarify, the code you show here does display the form, right? You are just frustrated by the lack of feedback when you make typos or other errors?
 
Saloon Keeper
Posts: 27762
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
Ignore what Greg said. JSF 2 does not use tag libraries. Tag libraries are for JSPs and in JSF version 2, you don't use JSPs, you use View Template Language (xhtml) files.

Your number 1 problem is that you're referring to the JSF-instantiated instance of "NameWrapper" on your View Definition as literally "NameWrapper".

The convention in JSF when auto-instantiating an object is that the name of that object will be its simple classname (without package name) and with the first character of the classname folded down to lower-case.

In other words, code like this:


This corresponds to the JavaBean convention that class names begin upper-case but instance names begin lower-case.

There's probably more that's wrong as well, since a mis-defined property will generally either be ignored by JSF or will throw an Exception (usually a NullPointerException). I recommend stripping the page down to a bare minimum and building it up bit by bit until you find what element causes it to fail to render. Unfortunately, JSF, like certain other webapp frameworks, doesn't always log why it fails to render a page.

One other thing: In JSF 2.0 and later, it's recommended to use the h:head and h:body JSF tags instead of the raw HTML head and body tags. The JSF version 2 rendering functions use those tags as anchor points for the CSS and javascript that gets generated. These tags didn't exist in JSF version 1.
 
Giovanni Montano
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
EDIT:(below the previous post)
it is working!

the problem was a typo in the line
hhtp://java.sun.com/jsf/html
that had trivially been written
as http!
an h instead of a t.

the XHTML file works now really well both with <body> <head>than <h:body> and <h:head> procedure
thank you very much.






-----------------------------------


Tim Holloway wrote:Ignore what Greg said. JSF 2 does not use tag libraries. Tag libraries are for JSPs and in JSF version 2, you don't use JSPs, you use View Template Language (xhtml) files.

Your number 1 problem is that you're referring to the JSF-instantiated instance of "NameWrapper" on your View Definition as literally "NameWrapper".

The convention in JSF when auto-instantiating an object is that the name of that object will be its simple classname (without package name) and with the first character of the classname folded down to lower-case.

In other words, code like this:


This corresponds to the JavaBean convention that class names begin upper-case but instance names begin lower-case.

There's probably more that's wrong as well, since a mis-defined property will generally either be ignored by JSF or will throw an Exception (usually a NullPointerException). I recommend stripping the page down to a bare minimum and building it up bit by bit until you find what element causes it to fail to render. Unfortunately, JSF, like certain other webapp frameworks, doesn't always log why it fails to render a page.

One other thing: In JSF 2.0 and later, it's recommended to use the h:head and h:body JSF tags instead of the raw HTML head and body tags. The JSF version 2 rendering functions use those tags as anchor points for the CSS and javascript that gets generated. These tags didn't exist in JSF version 1.



HI Tim, thank you both of you, I replied later because I am really confused. As suggested I tried to write NameWrapper.name with nameWrapper.name but still the form does not appear. So as you said, I should find a more minimal way to use it and then increase ti see if is working. I have also changed <body and ><head with the ><h:body></h:body> and <h:head></h:head> prefix, but still
this url does not show any form, also if I throw away the line <h:commandButton> to make it more minimal http://localhost:8080/SampleApplication/faces/login.xhtml



also Eclipse says: Can't find facelet tag library for uri hhtp://java.sun.com/jsf/html showing a yellow warning with a black exclamation mark! I guess is for the tag libraries that you say are for JSP's and JSF version2 and not for xhtml, but on the other side if I take away the attribute inside <html xmlns:h="hhtp://java.sun.com/jsf/html, a lot of new warning are indicated by eclipse because does not recognize the other tags.

I am really confused."
 
Tim Holloway
Saloon Keeper
Posts: 27762
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
Eclipse's HTML/XML editor has never impressed me. I ignore most of its messages unless they're actually about malformed XML. To make it shut up requires a whole lot of twiddling with Eclipse's XML schema database and stuff like that and it just doesn't give back enough to make me want to make the effort.

Here's a sample header from one of my JSF webpages:



This was from an antique app using RichFaces3, which doesn't support the "h:head" tag, but it may help serve as an example.

Try a page like this one:


reply
    Bookmark Topic Watch Topic
  • New Topic