[Stripes-users] View component inclusion

2011-01-02 Thread Jonathan
Hello.

I'm using Stripes for 3 years now and I never answered this question : "What is
the good way to include a view component (stripes action bean) into a jsp ?", in
other words : how to make a "layout-definition" with a action bean.

I often need it to reuse presentation logic that is too complex for a "simple"
jsp. I've coded a custom tag that can do that but it's not clean since I have to
isolate the action bean from the "parent" one (event name, parameters ...)
Something tells me that I'm doing something wrong, not in the Stripes mindset.

So what's the solution, or how do you do this kind of thing?

Thanks.

Jonathan.


--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] View component inclusion

2011-01-02 Thread Rick Grashel
Jonathan,

What is the logic that you are trying to include?  A lot of times, you can
just use "Helper" objects or what not and just use a plain-old
.  Especially if the logic provided is fairly static or
non-stateful.  What is the kind of view component?

We've talked about this a few times in IRC and I know there are a couple of
ways to solve it.  But it depends really on what exactly the component is...
i.e. the use case.

-- Rick


On Sun, Jan 2, 2011 at 6:11 PM, Jonathan  wrote:

> Hello.
>
> I'm using Stripes for 3 years now and I never answered this question :
> "What is
> the good way to include a view component (stripes action bean) into a jsp
> ?", in
> other words : how to make a "layout-definition" with a action bean.
>
> I often need it to reuse presentation logic that is too complex for a
> "simple"
> jsp. I've coded a custom tag that can do that but it's not clean since I
> have to
> isolate the action bean from the "parent" one (event name, parameters ...)
> Something tells me that I'm doing something wrong, not in the Stripes
> mindset.
>
> So what's the solution, or how do you do this kind of thing?
>
> Thanks.
>
> Jonathan.
>
>
>
> --
> Learn how Oracle Real Application Clusters (RAC) One Node allows customers
> to consolidate database storage, standardize their database environment,
> and,
> should the need arise, upgrade to a full multi-node Oracle RAC database
> without downtime or disruption
> http://p.sf.net/sfu/oracle-sfdevnl
> ___
> Stripes-users mailing list
> Stripes-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/stripes-users
>
--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users


Re: [Stripes-users] View component inclusion

2011-01-02 Thread farouk alhassan
I'm working on something similar but not using a jsp. Basically, I implement my 
own resolution in the action bean and return the actionbean class after the 
action has been executed. maybe u will find it useful.

public abstract class HSPage implements ActionBean, Resolution
{
    
    public void execute( HttpServletRequest request,
    HttpServletResponse response ) throws Exception
    {
  //Do your custome logic and but you must write the response back the like 
this
    byte[] buffer = new byte[ 512 ];
    try
    {
    ServletOutputStream out = response.getOutputStream();
    int length = 0;
    while ( ( length = is.read( buffer ) ) != -1 )
    {
    out.write( buffer, 0, length );
    }
    }
    }
}

Then use it like this

@UrlBinding("/hope.action")
public class DirectPage extends HSPage {

    private DemoPerson person;

    @DefaultHandler
    public Resolution hello()
    {
    this.person  = new DemoPerson();
    person.setForename("Farouk");
    person.setSurname("Alhassan");
    person.setEmail("osbert252...@yahoo.com");

    DemoBook book = new DemoBook();
    book.setAuthor("farouk A");
    book.setPublishingDate(new Date() );
    List books = new  ArrayList();
    books.add(book);
    person.setBooks(books);
    return this;
    }
    
    public DemoPerson getPerson() {
    return person;
    }

    public void setPerson(DemoPerson person) {
    this.person = person;
    }
}





--- On Mon, 3/1/11, Rick Grashel  wrote:

From: Rick Grashel 
Subject: Re: [Stripes-users] View component inclusion
To: "Stripes Users List" 
Date: Monday, 3 January, 2011, 1:02

Jonathan,

What is the logic that you are trying to include?  A lot of times, you can just 
use "Helper" objects or what not and just use a plain-old .  
Especially if the logic provided is fairly static or non-stateful.  What is the 
kind of view component?


We've talked about this a few times in IRC and I know there are a couple of 
ways to solve it.  But it depends really on what exactly the component is... 
i.e. the use case.

-- Rick



On Sun, Jan 2, 2011 at 6:11 PM, Jonathan  wrote:

Hello.



I'm using Stripes for 3 years now and I never answered this question : "What is

the good way to include a view component (stripes action bean) into a jsp ?", in

other words : how to make a "layout-definition" with a action bean.



I often need it to reuse presentation logic that is too complex for a "simple"

jsp. I've coded a custom tag that can do that but it's not clean since I have to

isolate the action bean from the "parent" one (event name, parameters ...)

Something tells me that I'm doing something wrong, not in the Stripes mindset.



So what's the solution, or how do you do this kind of thing?



Thanks.



Jonathan.





--

Learn how Oracle Real Application Clusters (RAC) One Node allows customers

to consolidate database storage, standardize their database environment, and,

should the need arise, upgrade to a full multi-node Oracle RAC database

without downtime or disruption

http://p.sf.net/sfu/oracle-sfdevnl

___

Stripes-users mailing list

Stripes-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/stripes-users




-Inline Attachment Follows-

--
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
-Inline Attachment Follows-

___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users



  --
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl___
Stripes-users mailing list
Stripes-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/stripes-users