AK <ama-l...@...> writes:
> I seem to be headed in the right direction, but am stuck figuring out how 
> to make a persistance call given a param being passed from the JSP. 
> Here's what I have:
> 
> item_list.jsp
> -------------
> <s:link beanclass="org.stripesbook.quickstart.action.ItemDetailsActionBean">
>       <s:param name="id" value="${item.id}"/>${item.name}
> </s:link>
> 
> In my action bean, I need to figure out how to take the item.id and use it 
> as a param to my query in my DefaultHandler.  Right now, I have something 
> hard-coded:
> 
> ItemDetailsActionBean.java
> --------------------------
>       @DefaultHandler
>       public Resolution view() {
>       item = (Item)Stripersist.getEntityManager()
>               .createQuery("from Item where id = 1").getSingleResult();
> 
>               // forward to item_detail.jsp
>           return new ForwardResolution(VIEW);
>       }

Here's a follow-up to how I got away from doing the hard-coding and got the 
param passed in:

ItemDetailsActionBean.java
--------------------------
    ... 
    private Item item;
    private int id;

    @DefaultHandler
    public Resolution view() {
        item = (Item)Stripersist.getEntityManager()
                        .createQuery("from Item where id = " + 
id).getSingleResult();
    }

The id parameter is passed into the action and I just use it to construct my 
query.


------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users

Reply via email to