Enter bean value into hidden input in Struts (1.x) with different name than bean

13,199

Why not just this?

<html:hidden property="data.code.description" name="scoreform_bean"/>

Refer to the javadocs for more and Struts html:hidden Tag

Share:
13,199
Organiccat
Author by

Organiccat

I am a cat who programs.

Updated on June 05, 2022

Comments

  • Organiccat
    Organiccat almost 2 years

    So I have a generic form bean I am using that has a few values such as action, offer, code.

    I am developing a new form that uses this generic form (required) but I want to use the value of a bean that has a name different from the bean I get values from to populate the form page.

    On the first load of the page it displays some basic data:

    Action: (hidden input, name the same as the bean)
    <html:hidden property="action"/>
    
    Offer: (user input, name the same as the bean)
    <html:text property="offer"/>
    
    Code: (hidden input, name not the same as the bean)
    <html:hidden property="code"/>
    

    The bean I was to use is something like:

    <bean:write name="data" property="data.code.description"/>
    

    How do I get that value (data.code.desription) into the "hidden" code area so that when the form is submitted the generic form bean picks up the value?