[英]Enter bean value into hidden input in Struts (1.x) with different name than bean
因此,我有一個通用的Form Bean,它具有一些值,例如action,offer和code。
我正在開發使用此通用表單(必填)的新表單,但我想使用名稱與從中獲取值的bean不同的bean的值來填充表單頁面。
在頁面的第一次加載中,它顯示一些基本數據:
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"/>
我要使用的bean是這樣的:
<bean:write name="data" property="data.code.description"/>
我如何將值(data.code.desription)放入“隱藏”代碼區域,以便在提交表單時,通用表單bean可以獲取該值?
為什么不只是這個呢?
<html:hidden property="data.code.description" name="scoreform_bean"/>
您可以這樣嘗試:
<input type="hidden" name="code" value="<bean:write name="data" property="data.code.description"/>" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.