Results 1 to 5 of 5
Thread: Using a bean as a parameter
- 11-29-2012, 06:05 PM #1
Member
- Join Date
- Nov 2012
- Posts
- 3
- Rep Power
- 0
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.
How do I pass the value of #{helloWorldBacking.name} to filename? I've triedJava 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>
Which I thought would work but I get an error saying it's expecting quotes.Java Code:filename = #{helloWorldBacking.name}
Thanks!
- 11-30-2012, 12:55 AM #2
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 698
- Rep Power
- 6
Re: Using a bean as a parameter
You said that it's expecting quotes. Have you tried:
Java Code:<mystuff:viewer id="viewer" filename="#{helloWorldBacking.name}"></mystuff:viewer>Website: Learn Java by Examples
- 11-30-2012, 03:38 AM #3
Member
- Join Date
- Nov 2012
- Posts
- 3
- Rep Power
- 0
Re: Using a bean as a parameter
I have but here that passes #{helloWorldBacking.name} as a string not the value of #{helloWorldBacking.name}
- 11-30-2012, 03:47 AM #4
Senior Member
- Join Date
- Jun 2007
- Location
- Bali, Indonesia
- Posts
- 698
- Rep Power
- 6
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}?
Website: Learn Java by Examples
- 11-30-2012, 03:19 PM #5
Member
- Join Date
- Nov 2012
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
javax.servlet.jsp.JspException: Cannot find bean org.apache.struts.taglib.html.BEAN i
By gurpreet.singh in forum Advanced JavaReplies: 1Last Post: 03-23-2011, 07:55 AM -
any way to communicate one bean to another bean not using session in jsf
By MayaKannan in forum JavaServer Faces (JSF)Replies: 1Last Post: 01-14-2011, 01:45 PM -
UREGENT-accessing session bean ok but entity bean
By parimal in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 08-28-2008, 01:34 PM -
How to use Inner bean definitions via nested bean elements
By Java Tip in forum Java TipReplies: 0Last Post: 03-30-2008, 10:03 AM -
How to use Inner bean definitions via nested bean elements
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:36 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks