[PR]上記の広告は3ヶ月以上新規記事投稿のないブログに表示されています。新しい記事を書く事で広告が消えます。
~ラベルで表示している文字をフォームに入れて次に渡したい時~
<bean:write name="userRegisterForm" property="userId"/>
userRegisterForm というフォームから getUserId して取得できた値を bean:writeで表示している。
この状態だと、画面に表示はできているが、次のアクションに渡すフォームは空のままになっている。
(フォームに値をつめる、という作業をしていないから。)
そんな時はこれ↓
<html:hidden name="userRegisterForm" property="userId"/>
画面の裏で、こっそり hidden でフォームに値を持たせておく。
name="データを詰めたいフォームの名前" property="フォームの持つフィールドの名前"/
<bean:write name="userRegisterForm" property="userId"/>
で画面に表示させておいて
<html:hidden name="userRegisterForm" property="userId"/>
でこっそりフォームに値をもたせておくのだ。
----------------------------------------------------------------------------------------
<input type="hidden" name="userId" value="<bean:write name="userRegisterForm" property="userId"/>">
<html:hidden name="userRegisterForm" property="userId"/>
の違う書き方。
これでも良い。