Hi,

If you only want to change the appearance, you should definitely take a look
at Trinidad's skinning
features<http://myfaces.apache.org/trinidad/devguide/skinning.html>.
You can change the appearance of every Trinidad component this way, while
keeping the functionality. Is that what you're looking for?

As for you other question: what type of parameters does SWF expect? POST or
GET?

Best regards,
Bart

On Wed, Nov 18, 2009 at 09:35, Arnold Preg <ap...@mailbox.hu> wrote:

> Hi,
>
> I have to use Trinidad components, and minimalize the use of manual  HTML
> or js codes. I do not like to use trh: components, but the tr:table
> appearance has not been being suitable and  I did not want to write own
> component because I thought the tr:table and iterate will do the work  and
> I never wrote an own component before yet, so this was left. Although, as I
> see the own component could be the best solution to reach the proper
> appearance. But one question is still here: How to send parameters with
> tr:commandButton to SWF correctly and easy? Thank you for your patience.
>
>
> On 2009.11.18. 8:54, Bart Kummel wrote:
>
>> Hi,
>>
>> I'm afraid I still don't understand exactly what you need. However, I
>> still
>> think you shouldn't use the approach with the<trh:tableLayout>, etc.
>> (Should you need *some* HTML for layout of your page, with Facelets you
>> can
>> use HTML in your Facelet, so you don't need any<trh:...>  tag for that
>> anymore.)
>>
>> If you want to use JSF, you should use JSF components that do the hard
>> work
>> for you. You can search the Trinidad, Tomahawk and Tobago libraries or
>> other
>> component libraries for a component that suits your needs. If nothing can
>> be
>> found, you can create your own JSF component. If you prefer to be super
>> flexible in the HTML output, you should perhaps consider a framework that
>> isn't component based, like JSF.
>>
>> Best regards,
>> Bart
>>
>> On Tue, Nov 17, 2009 at 20:28, Arnold Preg<ap...@mailbox.hu>  wrote:
>>
>>
>>
>>> On 2009.11.17. 13:50, Bart Kummel wrote:
>>>
>>>
>>>
>>>> Hi,
>>>>
>>>> I don't have any experience with Spring WebFlow, so I can't help you on
>>>> that
>>>> part. But when it comes to your other question, as I understand you
>>>> right,
>>>> you want to spread your list of books over multiple pages if the number
>>>> of
>>>> books exceeds a certain value, right?
>>>>
>>>> This is simple to achieve, but you shouldn't use<trh:tableLayout>. You
>>>> should use<tr:table>   instead.<tr:table>   will do all hard work for
>>>> you,
>>>> including the pagination of your data. Please read the documentation of
>>>> <tr:table><
>>>> http://myfaces.apache.org/trinidad/trinidad-api/tagdoc/tr_table.html
>>>>
>>>>
>>>>> first.
>>>>>
>>>>>
>>>>
>>>> And regarding your<tr:subform>: you are right that you don't use it
>>>> properly. In this case, it can be left out, you don't need it here.
>>>>
>>>> One last remark: as I look at your code, I get the impression that you
>>>> don't
>>>> get the idea of JavaServer Faces. The idea is to use components that
>>>> render
>>>> a user interface for you. Those components perform all the hard work for
>>>> you. Generally speaking, you shouldn't be fiddling with repetition in
>>>> any
>>>> JSF page definition. In this example, if you use a<tr:table>, the only
>>>> thing you have to do is tell the table where the collection is that you
>>>> want
>>>> to show. The table component will do all the hard work, including the
>>>> repetition and pagination. I hope this helps. Good luck!
>>>>
>>>> Best regards,
>>>> Bart Kummel
>>>>
>>>> On Tue, Nov 17, 2009 at 10:01, Arnold Preg<ap...@mailbox.hu>   wrote:
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>> Hi,
>>>>>
>>>>> I'm newbie, so sorry for stupid questions. I'm trying to use Facelets
>>>>> 1.1.14. SWF 2.0.8. Spring 2.5.6. Apache Trinidad 1.2.12.  JBoss EL
>>>>> 2.0.1.
>>>>> and Hibernate JPA imp. but I think it's not relevant now. My English
>>>>> not
>>>>> too
>>>>> good let the code snippets speak because of this rather.
>>>>>
>>>>> borderLayout.xhtml
>>>>>
>>>>> <tr:document xmlns:ui="http://java.sun.com/jsf/facelets";
>>>>>    xmlns:h="http://java.sun.com/jsf/html";
>>>>>    xmlns:f="http://java.sun.com/jsf/core";
>>>>>    xmlns:trh="http://myfaces.apache.org/trinidad/html";
>>>>>    xmlns:tr="http://myfaces.apache.org/trinidad"; title="#{pageTitle}">
>>>>> <tr:form id="mainForm">
>>>>> <tr:panelBorderLayout>
>>>>> <f:facet name="top">
>>>>> <ui:include src="searchbar.xhtml" />
>>>>> </f:facet>
>>>>> <ui:insert name="pageContent" />
>>>>> </tr:panelBorderLayout>
>>>>> </tr:form>
>>>>> <ui:debug />
>>>>> </tr:document>
>>>>>
>>>>> page.xhtml
>>>>>
>>>>> <ui:composition xmlns="http://www.w3.org/1999/xhtml";
>>>>>    xmlns:h="http://java.sun.com/jsf/html";
>>>>>    xmlns:f="http://java.sun.com/jsf/core";
>>>>>    xmlns:ui="http://java.sun.com/jsf/facelets";
>>>>>    xmlns:tr="http://myfaces.apache.org/trinidad";
>>>>>    xmlns:trh="http://myfaces.apache.org/trinidad/html";
>>>>>    xmlns:test="http://www.my.net/some/arbitrary/namespace";
>>>>>    template="/WEB-INF/layouts/borderLayout.xhtml">
>>>>>
>>>>> <ui:param name="pageTitle" value="Home" />
>>>>> <ui:define name="pageContent">
>>>>> <trh:tableLayout width="75%" borderWidth="0" cellSpacing="10"
>>>>> halign="center">
>>>>> <trh:rowLayout>
>>>>> <ui:repeat var="book" value="#{bestsellers}" offset="0" size="3">
>>>>> <!--<tr:iterator var="book" first="0" rows="4" value="#{bestsellers}">
>>>>>  -->
>>>>> <trh:cellFormat valign="bottom">
>>>>> <tr:commandLink action="selectBook2SeeDetails"
>>>>>                            text="#{book.title}">
>>>>> <f:param name="selectedBookId" value="#{book.bookId}" />
>>>>> </tr:commandLink>
>>>>>
>>>>> <!-- Probably I don't use the subform properly -->
>>>>> *<tr:subform>
>>>>> <tr:commandButton text="Add to cart" action="add2Cart"/>
>>>>> <input type="hidden" name="selectedBookId" value="#{book.bookId}" />
>>>>> </tr:subform>*
>>>>>
>>>>> </trh:cellFormat>
>>>>> </ui:repeat>
>>>>> <!--</tr:iterator>   -->
>>>>> </trh:rowLayout>
>>>>> </trh:tableLayout>
>>>>> </ui:define>
>>>>> </ui:composition>
>>>>>
>>>>> flow.xml
>>>>>
>>>>> <?xml version="1.0" encoding="UTF-8"?>
>>>>> <flow xmlns="http://www.springframework.org/schema/webflow";
>>>>>    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
>>>>>    xsi:schemaLocation="http://www.springframework.org/schema/webflow
>>>>> http://www.springframework.org/schema/webflow/spring-webflow-2.0.xsd";>
>>>>>
>>>>> <persistence-context />
>>>>> <var name="cart" class="bookstore.domain.Cart" />
>>>>> <view-state id="home">
>>>>> <on-render>
>>>>> <evaluate expression="catalogService.getAllBooks()"
>>>>> result="viewScope.bestsellers"></evaluate>
>>>>> </on-render>
>>>>> <transition on="selectBook2SeeDetails" to="reviewBookDetails">
>>>>> <set name="flowScope.selectedBook"
>>>>>
>>>>>  value="catalogService.getBookById(requestParameters.selectedBookId)"
>>>>> />
>>>>> </transition>
>>>>> </view-state>
>>>>>
>>>>> <global-transitions>
>>>>> <transition on="add2Cart">
>>>>> <evaluate
>>>>> <!-- Maybe it would be better to use the bestsellers list of Book
>>>>> entities
>>>>> but then I guess the place of code that should iterate over the list to
>>>>> find
>>>>> the Book with the appropriate id would be good in a custom Action
>>>>> "bean"
>>>>> (correct me if I'm wrong) and I don't want to complicate this sample
>>>>> with
>>>>> that too.
>>>>>
>>>>>
>>>>>
>>>>>  
>>>>> expression="cart.addItem(catalogService.getBookById(requestParameters.selectedBookId))">
>>>>> </evaluate>
>>>>> </transition>
>>>>> </global-transitions>
>>>>> </flow>
>>>>>
>>>>> When I click on the "Add to cart" button the post request will be
>>>>> something
>>>>> like this:
>>>>>
>>>>> _noJavaScript    false
>>>>> j_id5
>>>>> j_id17:rangeStart    0
>>>>> javax.faces.ViewState    H4sIAAAAAAAAA......
>>>>> org.apache.myfaces.trinidad.faces.FORM    mainForm
>>>>> *selectedBookId    1
>>>>> selectedBookId    2
>>>>> selectedBookId    3
>>>>> selectedBookId    4 *
>>>>> source    j_id31:0:j_id37:j_id38
>>>>> state
>>>>> value
>>>>>
>>>>> As it seems it's send a "String array" of selectedBookId . I'd like to
>>>>> send
>>>>> just the appropriate id of course. How could I reach that? On top of
>>>>> this
>>>>> I'd like to make more rows dynamically. You know 4 books in the first
>>>>> row
>>>>> than another 4 one etc, but I don't know how to write the repeat code
>>>>> to
>>>>> make this. Although, the main problem is the first one.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>> Thank you for your reply. I'm afraid you have misunderstood me. I'd like
>>> to
>>> create something you can see on amazon. There are book's pictures 3 in a
>>> row, you can click on them to see details. I'd like to make a category
>>> panel
>>> and cart  panel you can see on that portal, but it's maybe an other
>>> topic.
>>> If I can reach that look easily with tr:table I'll use that for this, but
>>> I
>>> think the problem will come out again in an other scenario. Namely how to
>>> send parameters with tr:commandButton. I think a hidden input filed would
>>> be
>>> great for this, but in a separate form or something. Of course with an
>>> action listener in a backing bean all of my problems would fly away, but
>>> what is the purpose of SWF than?
>>>
>>>
>>>
>>
>>
>

Reply via email to