Using a bean as a parameter
I'm new to JSF and I have what is probably a real simple question. On my first page I ask for a name of a file. On the next page I can display that fine. But here's where I'm running into problems. I want to pass that filename as a value later in my page and I have no idea how to do it.
Code:
<f:view>
<f:verbatim><h2></f:verbatim>
<h:outputText value="You're file name is #{helloWorldBacking.name}."/>
<f:verbatim></h2></f:verbatim>
<h:form id="form2">
<h:commandLink id="link1" action="back">
<h:outputText id="linkText" value="GO HOME"/>
</h:commandLink>
</h:form>
</f:view>
<mystuff:viewer id="viewer" filename= ???????
></mystuff:viewer>
How do I pass the value of #{helloWorldBacking.name} to filename? I've tried
Code:
filename = #{helloWorldBacking.name}
Which I thought would work but I get an error saying it's expecting quotes.
Thanks!
Re: Using a bean as a parameter
You said that it's expecting quotes. Have you tried:
Code:
<mystuff:viewer id="viewer" filename="#{helloWorldBacking.name}"></mystuff:viewer>
Re: Using a bean as a parameter
I have but here that passes #{helloWorldBacking.name} as a string not the value of #{helloWorldBacking.name}
Re: Using a bean as a parameter
What is the type of this <mystuff:viewer>? When you are using the <h:outputText> does it print out the value of {helloWorldBacking.name}?
Re: Using a bean as a parameter
It's a string. <h:outputText value="#{helloWorldBacking.name}"/> is working fine. When I do <mystuff:viewer id="viewer" filename="#{helloWorldBacking.name}"/> then the value of filename is literally #{helloWorldBacking.name} not the value of it.