You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bahadır Yağan <ba...@mht.com.tr> on 2005/11/25 10:21:48 UTC

page context

Hi!

Is there a way to register a bean from inside an Action, only for the 
next response. I have data to display on a JSP page. But it will only be 
needed for that page, so registering it to session seems an overhead to me.



-- 
Bahadir Yagan




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: page context

Posted by Gareth Evans <ga...@msoft.co.uk>.
Are you doing any kind of redirect?

Try printing the value of ${clist}, does this collection/list definatly contain data? because if 
logic:iterate can't find the bean then it throws a JspException

Bahadır Yağan wrote:

> I tried it but couldn't get it working. Here is my code:
> 
> Action:
> request.setAttribute("clist", clist);
> 
> JSP:
>    <logic:iterate id="category" name="clist">
>    <tr>
>        <td><a 
> href="sunum.jsp?cid=${category.cid}">${category.name}</a></td>
>    </tr>
>    </logic:iterate>
> 
> 
> ps: no it is not a form bean.
> 
> Gareth Evans wrote:
> 
>> request.setAttribute() ?
>>
>> Bahadır Yağan wrote:
>>
>>> Hi!
>>>
>>> Is there a way to register a bean from inside an Action, only for the 
>>> next response. I have data to display on a JSP page. But it will only 
>>> be needed for that page, so registering it to session seems an 
>>> overhead to me.
>>>
>>>
>>>
>>
> 
> 

-- 
Gareth Evans

MSoft eSolutions Limited
Technology Centre
Inward Way
Rossmore Business Park
Ellesmere Port
Cheshire
CH65 3EN

-- 
Tel:    +44 (0)870 0100 704
Fax:    +44 (0)870 9010 705
E-Mail: gareth@msoft.co.uk
Web:    www.msoft.co.uk

----------------------------------------------
Terms:
Please note that any prices quoted within this e-mail are subject to VAT.
All program details and code described in this e-mail are subject to
copyright © of MSoft eSolutions Limited and remain the intellectual
property of MSoft eSolutions Limited.
Any proposal or pricing information contained within this e-mail are
subject to MSoft eSolutions' Terms and Conditions
----------------------------------------------
Disclaimer:
This message is intended only for use of the addressee. If this message
was sent to you in error, please notify the sender and delete this
message. MSoft eSolutions Limited cannot accept responsibility for viruses,
so please scan attachments. Views expressed in this message do not
necessarily reflect those of MSoft eSolutions Limited who will not
necessarily be bound by its contents.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: page context

Posted by Michael Jouravlev <jm...@gmail.com>.
On 11/25/05, Bahadır Yağan <ba...@mht.com.tr> wrote:
> Sorry, my forward was defined as redirect="true". Now it works, thanks.
>
> So one other question. Is is normal to write an Action for every page,
> to register these variables.(no forms in page so far.) Or there is a
> simpler solution?

Simpler solution is to write an Action for every resource; the
resource can have several views (usually JSP pages). This pattern is
easy with session-scoped form beans, so if you prefer to use
request-scoped form beans only, this solution is probably not for you.

For example, this New User Signup Wizard (this is just a demo, so you
can try to sign in) is controlled by one Action only. The intermediate
data is stored in session.

Michael.

--
Struts Dialogs: code-behind for Struts
http://struts.sourceforge.net/strutsdialogs

Re: page context

Posted by Laurie Harper <la...@holoweb.net>.
Bahadır Yağan wrote:
> So one other question. Is is normal to write an Action for every page, 
> to register these variables.(no forms in page so far.) Or there is a 
> simpler solution?

The normal pattern in Struts is to have a 'setup action' which loads any 
data the page needs to display and then forwards to the JSP view, yes.

L


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: page context

Posted by Bahadır Yağan <ba...@mht.com.tr>.
Sorry, my forward was defined as redirect="true". Now it works, thanks.

So one other question. Is is normal to write an Action for every page, 
to register these variables.(no forms in page so far.) Or there is a 
simpler solution?



Bahadır Yağan wrote:
> I tried it but couldn't get it working. Here is my code:
>
> Action:
> request.setAttribute("clist", clist);
>
> JSP:
>    <logic:iterate id="category" name="clist">
>    <tr>
>        <td><a 
> href="sunum.jsp?cid=${category.cid}">${category.name}</a></td>
>    </tr>
>    </logic:iterate>
>
>
> ps: no it is not a form bean.
>
> Gareth Evans wrote:
>> request.setAttribute() ?
>>
>> Bahadır Yağan wrote:
>>> Hi!
>>>
>>> Is there a way to register a bean from inside an Action, only for 
>>> the next response. I have data to display on a JSP page. But it will 
>>> only be needed for that page, so registering it to session seems an 
>>> overhead to me.
>>>
>>>
>>>
>>
>
>


-- 
Bahadir Yagan
MHT Elektronik
+90 312 265 02 10



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: page context

Posted by Bahadır Yağan <ba...@mht.com.tr>.
I tried it but couldn't get it working. Here is my code:

Action:
request.setAttribute("clist", clist);

JSP:
    <logic:iterate id="category" name="clist">
    <tr>
        <td><a 
href="sunum.jsp?cid=${category.cid}">${category.name}</a></td>
    </tr>
    </logic:iterate>


ps: no it is not a form bean.

Gareth Evans wrote:
> request.setAttribute() ?
>
> Bahadır Yağan wrote:
>> Hi!
>>
>> Is there a way to register a bean from inside an Action, only for the 
>> next response. I have data to display on a JSP page. But it will only 
>> be needed for that page, so registering it to session seems an 
>> overhead to me.
>>
>>
>>
>


-- 
Bahadir Yagan
MHT Elektronik
+90 312 265 02 10



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: page context

Posted by Gareth Evans <ga...@msoft.co.uk>.
request.setAttribute() ?

Bahadır Yağan wrote:
> Hi!
> 
> Is there a way to register a bean from inside an Action, only for the 
> next response. I have data to display on a JSP page. But it will only be 
> needed for that page, so registering it to session seems an overhead to me.
> 
> 
> 

-- 
Gareth Evans

MSoft eSolutions Limited
Technology Centre
Inward Way
Rossmore Business Park
Ellesmere Port
Cheshire
CH65 3EN

-- 
Tel:    +44 (0)870 0100 704
Fax:    +44 (0)870 9010 705
E-Mail: gareth@msoft.co.uk
Web:    www.msoft.co.uk

----------------------------------------------
Terms:
Please note that any prices quoted within this e-mail are subject to VAT.
All program details and code described in this e-mail are subject to
copyright © of MSoft eSolutions Limited and remain the intellectual
property of MSoft eSolutions Limited.
Any proposal or pricing information contained within this e-mail are
subject to MSoft eSolutions' Terms and Conditions
----------------------------------------------
Disclaimer:
This message is intended only for use of the addressee. If this message
was sent to you in error, please notify the sender and delete this
message. MSoft eSolutions Limited cannot accept responsibility for viruses,
so please scan attachments. Views expressed in this message do not
necessarily reflect those of MSoft eSolutions Limited who will not
necessarily be bound by its contents.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org