wood burning stoves*
The moose likes JSF and the fly likes Html generated by JSF TAG <h:inputText/> Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "Html generated by JSF TAG <h:inputText/>" Watch "Html generated by JSF TAG <h:inputText/>" New topic
Author

Html generated by JSF TAG <h:inputText/>

Daniel Cabral
Greenhorn

Joined: Aug 18, 2011
Posts: 13

Hello Everybody,
I have a problem.
When I use


OR



The HTML generated is:



Is there a way to get the HTML generated using Type Number?


Has anyone gone through this problem?

Thanks!


Sun Certified Java Programmer SE 5.0
suresh dasari
Ranch Hand

Joined: Oct 05, 2009
Posts: 121

Hi Daniel Cabral,

Is there any requirement to you for the HTML to be generated with type="number"?
because if you use f:converter tag, even though it doesnt render as you expected it will look for the number from the editable feild. During the validation phase of JSF lifecycle, it travese the tree component and decides that there is a child component for this input text component and look look for the type of the text you entered.

but if you explicitly need the HTML to be rendered like the way as you said, you can write your own input text renderer.

Thanks,
Suresh.


Sun Certified Java Programmer with 93 percent
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16141
    
  21

No, there is not a way using JSF to generate an inputfield with "type=number".

That's because type="number" isn't legal HTML. Probably the only reason that you can make HTML work with "type=number" at all is that HTML silently ignores garbage HTML and defaults to interpreting it as "type=input".

HTML itself was never intended to be very clever, which is why the JSF input elements were designed to support validators and converters.


Customer surveys are for companies who didn't pay proper attention to begin with.
Daniel Cabral
Greenhorn

Joined: Aug 18, 2011
Posts: 13

Hello suresh dasari , Tim Holloway!


I wanted to use input type = "number" because I'm using HTML 5.
The reason is the numeric keypad on the IPAD, when the field receives focus when type = "text" it opens the Alpha Numeric, if the type = "number" it opens the numeric only.

I Can customize an inputText generating "type = number" in JSF?
Where can I find a tutorial for custom components?

Thanks very much.


Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16141
    
  21

Oh, and by the way, welcome to the JavaRanch, Daniel!

It's probably not a good idea to attempt HTML5 in JSF at the moment. Just aside from everything else, I don't guarantee that JSF won't generate a conflicting xhtml schema reference at the head of the displayed view, since the stock renderer produces xhtml, not generic HTML. What you'd really need is a set of HTML5 renderers. Presumably, as HTML5 support perks up, a future JSF release will support it.

If you are interesting in getting ahead of the curve, however, you might want to pull down the source code for one of the open-source extension tagsets, such as RichFaces. Also, for that matter, check to see if anyone's working on projects like that. And if, not, why not start one?
Daniel Cabral
Greenhorn

Joined: Aug 18, 2011
Posts: 13

Hello again!
I wrote custom component with type="number" and now it's all right!
I will continue with tests and post after here.
Thanks everybody for help me!
Raul Sanchez
Greenhorn

Joined: Jan 20, 2012
Posts: 1
Hey Daniel,
do you have any source code of what you did to render the type=number using the jsf tag?

Thanks
Raul Sanchez
 
Don't get me started about those stupid light bulbs.
 
subject: Html generated by JSF TAG <h:inputText/>