aspose file tools*
The moose likes JSF and the fly likes Issues with Rendering of custom attributes in Renderer Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Issues with Rendering of custom attributes in Renderer" Watch "Issues with Rendering of custom attributes in Renderer" New topic
Author

Issues with Rendering of custom attributes in Renderer

shivam verma
Greenhorn

Joined: Sep 04, 2013
Posts: 7
Hi,

I am facing issues with rendering of custom attributes changed in the encode begin phase

For eg: I have my custom renderer for Input TextBox
In encode Begin

I am using script:

objWriter.startElement("input", pComponent);
objWriter.writeAttribute("type", "text", null);
objWriter.writeAttribute("oncopy", "return false;", null);

On debugging,control goes to last statement but after rendering I am not finding "oncopy" attribute updated in HTML of Text control.

Thanks in advance for help.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

I'm afraid I can't give an actual answer, but I will make some observations, for what they're worth.

1. I have always discouraged developing custom tags at the binary level. The present versions of JSF are too complex and insufficiently stable, which means that such constructs are going to be expensive not only to develop, but to maintain.

2. I certainly hope you are attempting to subclass the HtmlInputText control rather than alter its behaviour directly. That can get you in a lot of trouble.

3. To reduce the pain, suffering, and costs of items 1 and 2, my recommendation is to create custom JSF tags using the XML tag facility where possible and not the binary approach. Sometimes you have no choice, such as when you are generating unusual content (HTML5 generation, Google Maps support tags and the like). But if you have a choice, you'll enjoy life more and get things done faster using XML.


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

Joined: Sep 04, 2013
Posts: 7
Thanks for your reply
Yes you are right I am attempting to subclass the HtmlInputText control.
I don't have option to use XML in my application
Can I extend basic UIInput class and implement all the neccesary methods in my class as HTMLInputText Class also inheriting UIInput and doing the same.
Will It work?
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

When I hear "Don't have the option", my instinctive response is "Update your CV". Lack of options usually means that some idiot manager thinks he knows more than he does. Especially when an absurdly complex solution is the only alternative allowed. You will be better off in the long run working in a shop where competence is permitted than being ruined by one where arbitrary - and often defective - rules apply. And you won't acquire bad habits.

As I said before, if you must construct a binary solution and you can't find a new job fast enough, you should not attempt to mutilate HtmlInputText. Subclass it, instead.

If you can see smoke coming out of my ears it's because someone cost me 2 months pay once because they altered the fundamental behavior of JavaScript and broke the proper behaviour of a popular AJAX support package I was attempting to use. Leave core components alone.
 
Consider Paul's rocket mass heater.
 
subject: Issues with Rendering of custom attributes in Renderer