wood burning stoves 2.0*
The moose likes JSF and the fly likes Commandlink or OutputText ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Commandlink or OutputText ?" Watch "Commandlink or OutputText ?" New topic
Author

Commandlink or OutputText ?

Francisco Llaryora
Greenhorn

Joined: Dec 30, 2011
Posts: 14
Hi , to all.

I dont know what is the component that put Commandlink or OutputText (for example ) if a integer property is 1 or 2 (true or false).

<componentUnknow value="#{bean.conditional}">
</h:Commandlink value="Is open!" action="go to the next page">
<h:OutputText >sorry...Is close</h:OutputText >
</componentUnknow>

thanks for readme.!
Francisco Llaryora
Greenhorn

Joined: Dec 30, 2011
Posts: 14
http://www.coderanch.com/t/213739/JSF/java/JSTL-if-tag-not-working

OK, thanks Ketan Jambhekar !
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15956
    
  19



This assumes that you have a boolean property named "closed" on "bean". An actual 1 or 2 isn't a good set of values to use for binary values. And, while in a lot of languages, it's common to use 0 or 1, that doesn't work in Java, which doesn't treat booleans like they are numbers.

If an internal 1-or-2 value is required, define the following method:


I do not recommend simply using EL to test the numeric value directly.


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

Joined: Dec 30, 2011
Posts: 14
Hi Tim Holloway, thanks for reply!

I'm newbie in JSF programming but old Java programmer.

Thanks for the example.
Ok : it is a sin if i put logic in JSF instead of the business layer.

i will write again if i have a new doubt .
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15956
    
  19

Well, it's not a "sin". That implies the sort of pompous dogma that form the edicts of mediocre managers. In this particular case, I'm putting aside my innate pompousness in favour of being devious and evil. For you see, there's a method to this madness:

1. Debugging Java code is easy. Debugging EL is . Hence, my admonition to avoid complex EL code.

2. If you keep the code in the Model and the display definition in the View then you always know which file to find something in without having to go on a "treasure hunt". And, even more importantly, you only have to look at one file listing when doing maintenance instead of bouncing back and forth between 2 of them (the Model and the View). In JSF you don't write much (if any) Controller code, although of course, when you do, it should be placed in the "Controller" place.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Commandlink or OutputText ?
 
Similar Threads
windows.open()
issue with h:outputText
Popupwindow using commandlink
how to write a h:commandLink tag inside h:outputText tag
Display background color