Results 1 to 5 of 5
  1. #1
    kr651129 is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Default 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.

    Java 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

    Java Code:
    filename = #{helloWorldBacking.name}
    Which I thought would work but I get an error saying it's expecting quotes.

    Thanks!

  2. #2
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    757
    Rep Power
    7

    Default 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>

  3. #3
    kr651129 is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Default Re: Using a bean as a parameter

    I have but here that passes #{helloWorldBacking.name} as a string not the value of #{helloWorldBacking.name}

  4. #4
    wsaryada is offline Senior Member
    Join Date
    Jun 2007
    Location
    Bali, Indonesia
    Posts
    757
    Rep Power
    7

    Default 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}?

  5. #5
    kr651129 is offline Member
    Join Date
    Nov 2012
    Posts
    3
    Rep Power
    0

    Default 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.

Similar Threads

  1. Replies: 1
    Last Post: 03-23-2011, 07:55 AM
  2. any way to communicate one bean to another bean not using session in jsf
    By MayaKannan in forum JavaServer Faces (JSF)
    Replies: 1
    Last Post: 01-14-2011, 01:45 PM
  3. UREGENT-accessing session bean ok but entity bean
    By parimal in forum Enterprise JavaBeans (EJB)
    Replies: 1
    Last Post: 08-28-2008, 01:34 PM
  4. Replies: 0
    Last Post: 03-30-2008, 10:03 AM
  5. Replies: 0
    Last Post: 09-26-2007, 08:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •