Topic: struts如何在一个formbean中获得另一个formbean

  Print this page

1.struts如何在一个formbean中获得另一个formbean Copy to clipboard
Posted by: Johnny
Posted on: 2003-06-26 19:10

已经把formbean设成session scope的了,怎么才能在另一个formbean或action中得到它呢?

2.Re:struts如何在一个formbean中获得另一个formbean [Re: Johnny] Copy to clipboard
Posted by: TopCool
Posted on: 2003-06-26 19:37

开始你是怎么学struts得,教教小弟,咔咔~

偶还一点不懂哪~

3.Re:struts如何在一个formbean中获得另一个formbean [Re: Johnny] Copy to clipboard
Posted by: Johnny
Posted on: 2003-06-26 23:51

我也刚开始学啊,要不然不会问这样弱的问题的,呵呵,看看struts in action吧,真的很不错哦

4.Re:struts如何在一个formbean中获得另一个formbean [Re: Johnny] Copy to clipboard
Posted by: supermy
Posted on: 2003-06-28 16:50

Struts自带的例程中有.

formbeanclass fm=(formbeanclase)form
|
这是一个自带的参数public ActionForward execute(ActionMapping mapping,
ActionForm form, HttpServletRequest request, HttpServletResponse response)

fm.get...
fm.set...

5.Re:struts如何在一个formbean中获得另一个formbean [Re: Johnny] Copy to clipboard
Posted by: fhk1999
Posted on: 2003-06-30 09:36

In Struts form bean is stored in session or request with attribute defined in struts-config.xml.

Suppose following line define a form bean in struts-config.xml:
<form-bean name="logonForm" type="LogonForm"/>
to get it from session, simply use code like this:
LogonForm form = (LogonForm)session.getAttribute("loginForm");

I am not sure when the form bean is available if its scope is set to session since I never put form bean in session. My educated guess is only when the action which use the form bean is invoked.

6.Re:struts如何在一个formbean中获得另一个formbean [Re: Johnny] Copy to clipboard
Posted by: Johnny
Posted on: 2003-06-30 10:15

yes, thank fhk1999, i will try it


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923