You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Renato Aganippe <ra...@cardiweb.com> on 2002/12/11 09:48:12 UTC

How to Format default input text value according to user request?

Hello everybody,

Please help, I can't get through this problem and it drives me crazy!

I need to initialize the default field value from a <html:text> tag with a timestamp field from a Bean according to the user's request Locale.

I am looking for an equivalent of formatKey attribute from <bean:write>

Thanks a lot,

Renato

Re: How to Format default input text value according to user request?

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 11. 09:48 dátummal Renato Aganippe ezt írtad:
> Hello everybody,
>
> Please help, I can't get through this problem and it drives me crazy!
>
> I need to initialize the default field value from a <html:text> tag with a
> timestamp field from a Bean according to the user's request Locale.

You might want to read this thread:

http://nagoya.apache.org/eyebrowse/BrowseList?listName=struts-user@jakarta.apache.org&by=thread&from=281706

Hth,

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: How to Format default input text value according to user request?

Posted by Renato Aganippe <ra...@cardiweb.com>.
Miguel,

Thanks for your answer but I don't have any problem with <bean:write> tag
but with <html:text> tag.

Regards,

Renato

----- Original Message -----
From: "Míguel Ángel Mulero Martínez" <mi...@mad.tecsidel.es>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, December 11, 2002 10:13 AM
Subject: RE: How to Format default input text value according to user
request?


> The Locale object exists in the Actions. Use an Action before the JSP that
> creates this bean. In this way you can format the text before call the
> <bean:write>
>
> Regards,
> Miguel
>
> -----Mensaje original-----
> De: Renato Aganippe [mailto:raganippe@cardiweb.com]
> Enviado el: miércoles, 11 de diciembre de 2002 9:48
> Para: Struts Users Mailing List
> Asunto: How to Format default input text value according to user request?
>
> Hello everybody,
>
> Please help, I can't get through this problem and it drives me crazy!
>
> I need to initialize the default field value from a <html:text> tag with
> a timestamp field from a Bean according to the user's request Locale.
>
> I am looking for an equivalent of formatKey attribute from <bean:write>
>
> Thanks a lot,
>
> Renato
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DynaActionForm in session scope

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 12. 02:29 dátummal Charles ezt írtad:

> Tried searching the message list at nagoya but the search function doesn't
> seem to be working.

http://www.google.com/search?q=struts-user+session+reset+DynaActionForm+site%3Awww.mail-archive.com


Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: logic:iterate, length, offset

Posted by Dan Tran <da...@hotmail.com>.
Please look up key word "paging" in this mail archive.
There are plenty of discussions about what you'd like to do.

-D
----- Original Message -----
From: "Cathy Osekizoglu" <hi...@yahoo.ca>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, December 13, 2002 12:09 PM
Subject: logic:iterate, length, offset


>
>  Hi:
> I have 12 items in a collection. I want to display the first 10 items on
the first page, and the rest 2 items in the next page. How can I control it
using logic:iterate tag. I used length="10" and offset="<%= pagerOffset%>"
as the attribute of logic:iterate. But it only show the first page(first 10
items)---I mean it only iterate over the first 10 items. After that, it
stops iterate. What's wrong? Could you help me out? Thank you for your help.
> Regards,
> Cathy
>
>
>
> ---------------------------------
> Post your free ad now! Yahoo! Canada Personals
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


logic:iterate, length, offset

Posted by Cathy Osekizoglu <hi...@yahoo.ca>.
 Hi: 
I have 12 items in a collection. I want to display the first 10 items on the first page, and the rest 2 items in the next page. How can I control it using logic:iterate tag. I used length="10" and offset="<%= pagerOffset%>" as the attribute of logic:iterate. But it only show the first page(first 10 items)---I mean it only iterate over the first 10 items. After that, it stops iterate. What's wrong? Could you help me out? Thank you for your help. 
Regards, 
Cathy



---------------------------------
Post your free ad now! Yahoo! Canada Personals

Re: logic:iterate

Posted by Rick Reumann <ma...@reumann.net>.
On Sat, 14 Dec 2002 16:32:07 -0500
"Cathy" <hi...@yahoo.ca> wrote:
  
> I am using pager tag library from
> http://jsptags.com/tags/navigation/pager/ 

I use the display tag here 
http://edhill.its.uiowa.edu/display-0.8/
and it works great. Very easy to use also.


-- 
Rick

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: logic:iterate

Posted by Cathy <hi...@yahoo.ca>.
Thank you for all your reply.

I am using pager tag library from http://jsptags.com/tags/navigation/pager/
with logic:iterate tag. I retrieved 23 rows from Database, and I saved the
data in session. I want to display the data on 10 rows/page basis with page
navigation ability.So on the first page, there is "next" link, On the second
page, there is "previous" and "next" link. On the third page, there is
"previous" link. I use logic:iterate to iterate through the data, and use
page tag library from the above link to implement the page navigation
ability.The following is my jsp snippest:

<%@ taglib uri="/WEB-INF/pager-taglib.tld" prefix="pg" %>
    ......

<pg:pager maxPageItems="10" isOffset = "true">
   <logic:iterate id="aResult" name="results" scope="session"
type="com.test.Result">
        <pg:item>
           <tr>
                 <td>
                      <bean:write name="aResult" property="note"/>
                 </td>

             <logic:notEqual name="aResult" property="amount" value="0">
                 <td>
                     <bean:message key="amount.value"/></font></div>
                 </td>
             </logic:equal>
           </tr>
        </pg:item>
   </logic:iterate>

    <-- page navigation area-->
</pg:pager>

Page navigation works fine(I mean when I click "next" or "previous", it goes
to next or previous page. So I omitted the page navigation snippest. The
problem is: when the first page is displayed, I viewed the source of the
first page, there are 10 blank rows before the line " <-- page navigation
area-->" -- I mean there is a big spaces which is equal to 10 rows, between
the last row and the line " <-- page navigation area-->". After I click
"next" link and opened the second page, I viewed the source, I found between
the last row on the page and  the line "<-- page navigation area-->", there
are 3 blank rows(because the next page has 3 rows). When I opened the third
page(last page), and viewed source, there is no blank row(because there is
no next page).

In order to solve the problem, I searched the archive and the web. I found
lot of disussion about paging. But there seems no discussion about the blank
rows problem. Could you help me out here. I spend a lot of time trying to
fix it, but no clue. I really appreciate your help.

Thank you very much.

Cathy





----- Original Message -----
From: "Affan Qureshi" <qu...@etilize.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Saturday, December 14, 2002 12:37 AM
Subject: Re: logic:iterate


> You can do it manually by keeping the collection and state variables in
the
> session which indicate the page nos and the current status of the
> collection. However there are some Tag Libraries available taht do just
> that. Check out Struts-Layout and Ed Hill's TagLibs on the Struts
resources
> page.
>
> Affan
>
> ----- Original Message -----
> From: "Cathy Osekizoglu" <hi...@yahoo.ca>
> To: "Struts Users Mailing List" <st...@jakarta.apache.org>
> Sent: Friday, December 13, 2002 11:59 PM
> Subject: logic:iterate
>
>
> >
> > Hi:
> > I have 12 items in a collection. I want to display the first 10 items on
> the first page, and the rest 2 items in the next page. How can I control
it
> using logic:iterate tag. Thank you for your help.
> > Regards,
> > Cathy
> >
> >
> >
> > ---------------------------------
> > Post your free ad now! Yahoo! Canada Personals
> >
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>

______________________________________________________________________ 
Post your free ad now! http://personals.yahoo.ca

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: logic:iterate

Posted by Affan Qureshi <qu...@etilize.com>.
You can do it manually by keeping the collection and state variables in the
session which indicate the page nos and the current status of the
collection. However there are some Tag Libraries available taht do just
that. Check out Struts-Layout and Ed Hill's TagLibs on the Struts resources
page.

Affan

----- Original Message -----
From: "Cathy Osekizoglu" <hi...@yahoo.ca>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, December 13, 2002 11:59 PM
Subject: logic:iterate


>
> Hi:
> I have 12 items in a collection. I want to display the first 10 items on
the first page, and the rest 2 items in the next page. How can I control it
using logic:iterate tag. Thank you for your help.
> Regards,
> Cathy
>
>
>
> ---------------------------------
> Post your free ad now! Yahoo! Canada Personals
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


logic:iterate

Posted by Cathy Osekizoglu <hi...@yahoo.ca>.
Hi:
I have 12 items in a collection. I want to display the first 10 items on the first page, and the rest 2 items in the next page. How can I control it using logic:iterate tag. Thank you for your help.
Regards,
Cathy



---------------------------------
Post your free ad now! Yahoo! Canada Personals

Re: DynaActionForm in session scope

Posted by Charles <ch...@radworkz.com>.
Hi Tibor,
Good examples and explanations. I have a clearer picture of how it works
now. Thanks!


----- Original Message -----
From: "Gemes Tibor" <ge...@regens.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Friday, December 13, 2002 12:15 AM
Subject: Re: DynaActionForm in session scope


2002. december 13. 20:00 dátummal Charles ezt írtad:
> Thanks for your help. But I'm still a little confused. How do you extend a
> DynaActionForm? I thought it was created on the fly.

Only the properties are created on the fly, the class itself is
org.apache.struts.action.DynaActionForm.

So here is the rough overview of what I have done.

public class CondResetDynaActionForm extends DynaActionForm {
    /** Reset the property to its initial value conditionally.
     **/
    public void reset(ActionMapping mapping, HttpServletRequest request) {
        String name = mapping.getName();
        if (name == null) {
            return;
        }
        FormBeanConfig config =
            mapping.getApplicationConfig().findFormBeanConfig(name);
        if (config == null) {
            return;
        }
        FormPropertyConfig props[] = config.findFormPropertyConfigs();
        for (int i = 0; i < props.length; i++) {
            // reset only if not CondResetFPC or getReset() returns true
    if (!(props[i] instanceof CondResetFormPropertyConfig) ||
(((CondResetFormPropertyConfig)form).getReset())
                set(props[i].getName(), props[i].initial());
        }
    }
}

Extend the FormPropertyConfig with a reset property. (homework :)

> Also you mentioned about using the set-property tags. Please forgive my
> ignorance, but could you provide me with a working example of how this
> set-property tags can be used to present the reset() being called?

If you want to leave the reset() as it was originally, you declare your
form-bean as DynaActionForm. If you want your own reset to be executed,
declare it as CondResetDynaActionForm.
The set-property could be used to determine per form-property whether you
want
to reset it or not. But in this case you have to specify, that this is your
FPC class, not the original one as the original FPC does not have "reset"
property.
<form-bean name="myForm"
                   type="com.yourcompany.struts.CondResetDynaActionForm">
<form-property name="myProp1" type="java.lang.String"
className="com.yourcompany.struts.CondResetFormPropertyConfig">
<set-property name="reset" value="false" />
</form-property>



Hth,

Tib

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DynaActionForm in session scope

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 13. 20:00 dátummal Charles ezt írtad:
> Thanks for your help. But I'm still a little confused. How do you extend a
> DynaActionForm? I thought it was created on the fly.

Only the properties are created on the fly, the class itself is 
org.apache.struts.action.DynaActionForm.

So here is the rough overview of what I have done.

public class CondResetDynaActionForm extends DynaActionForm {
    /** Reset the property to its initial value conditionally. 
     **/
    public void reset(ActionMapping mapping, HttpServletRequest request) {
        String name = mapping.getName();
        if (name == null) {
            return;
        }
        FormBeanConfig config =
            mapping.getApplicationConfig().findFormBeanConfig(name);
        if (config == null) {
            return;
        }
        FormPropertyConfig props[] = config.findFormPropertyConfigs();
        for (int i = 0; i < props.length; i++) {
            // reset only if not CondResetFPC or getReset() returns true
	    if (!(props[i] instanceof CondResetFormPropertyConfig) || 
(((CondResetFormPropertyConfig)form).getReset())
                set(props[i].getName(), props[i].initial());
        }
    }
}

Extend the FormPropertyConfig with a reset property. (homework :)

> Also you mentioned about using the set-property tags. Please forgive my
> ignorance, but could you provide me with a working example of how this
> set-property tags can be used to present the reset() being called?

If you want to leave the reset() as it was originally, you declare your 
form-bean as DynaActionForm. If you want your own reset to be executed, 
declare it as CondResetDynaActionForm.
The set-property could be used to determine per form-property whether you want 
to reset it or not. But in this case you have to specify, that this is your 
FPC class, not the original one as the original FPC does not have "reset" 
property. 
<form-bean name="myForm"
                   type="com.yourcompany.struts.CondResetDynaActionForm">
	<form-property name="myProp1" type="java.lang.String"
		className="com.yourcompany.struts.CondResetFormPropertyConfig">
		<set-property name="reset" value="false" />
	 </form-property>



Hth,

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DynaActionForm in session scope

Posted by Charles <ch...@radworkz.com>.
Hi Tibor,

Thanks for your help. But I'm still a little confused. How do you extend a
DynaActionForm? I thought it was created on the fly.
Also you mentioned about using the set-property tags. Please forgive my
ignorance, but could you provide me with a working example of how this
set-property tags can be used to present the reset() being called?

Thanks again
Charles

----- Original Message -----
From: "Gemes Tibor" <ge...@regens.hu>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Wednesday, December 11, 2002 1:31 AM
Subject: Re: DynaActionForm in session scope


2002. december 12. 02:29 dátummal Charles ezt írtad:
> Hi all,
>
> Can a DynaValidatorForm be in session scope? Whenever I submit a page that
> uses a DynaValidatorForm, which is in session scope, it resets itself and
> all the previously stored data are lost. I did not call the form reset
> function at all. I thought by adding the scope="session" attribute in the
> tag, the form would save previously entered data in the session. However
it
> seems to behave as though its in request scope.  Is this normal with using
> dynamic form beans?
>
> Tried searching the message list at nagoya but the search function doesn't
> seem to be working.

It is sad, because this was answered multiple times. You might want to
extend
DynActionForm and override the reset(). Maybe depending on an extra property
of the form-property wheter or not do you want to reset it. The extra
property can be set in the struts-config.xml via <set-property> tags.

Hth,

Tib

--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>






--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: DynaActionForm in session scope

Posted by Gemes Tibor <ge...@regens.hu>.
2002. december 12. 02:29 dátummal Charles ezt írtad:
> Hi all,
>
> Can a DynaValidatorForm be in session scope? Whenever I submit a page that
> uses a DynaValidatorForm, which is in session scope, it resets itself and
> all the previously stored data are lost. I did not call the form reset
> function at all. I thought by adding the scope="session" attribute in the
> tag, the form would save previously entered data in the session. However it
> seems to behave as though its in request scope.  Is this normal with using
> dynamic form beans?
>
> Tried searching the message list at nagoya but the search function doesn't
> seem to be working.

It is sad, because this was answered multiple times. You might want to extend 
DynActionForm and override the reset(). Maybe depending on an extra property 
of the form-property wheter or not do you want to reset it. The extra 
property can be set in the struts-config.xml via <set-property> tags. 

Hth,

Tib

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


DynaActionForm in session scope

Posted by Charles <ch...@radworkz.com>.
Hi all,

Can a DynaValidatorForm be in session scope? Whenever I submit a page that
uses a DynaValidatorForm, which is in session scope, it resets itself and
all the previously stored data are lost. I did not call the form reset
function at all. I thought by adding the scope="session" attribute in the
tag, the form would save previously entered data in the session. However it
seems to behave as though its in request scope.  Is this normal with using
dynamic form beans?

Tried searching the message list at nagoya but the search function doesn't
seem to be working.

TIA
Charles



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: How to Format default input text value according to user request?

Posted by Míguel Ángel Mulero Martínez <mi...@mad.tecsidel.es>.
The Locale object exists in the Actions. Use an Action before the JSP that
creates this bean. In this way you can format the text before call the
<bean:write>

Regards,
Miguel

-----Mensaje original-----
De: Renato Aganippe [mailto:raganippe@cardiweb.com]
Enviado el: miércoles, 11 de diciembre de 2002 9:48
Para: Struts Users Mailing List
Asunto: How to Format default input text value according to user request?

Hello everybody,

Please help, I can't get through this problem and it drives me crazy!

I need to initialize the default field value from a <html:text> tag with
a timestamp field from a Bean according to the user's request Locale.

I am looking for an equivalent of formatKey attribute from <bean:write>

Thanks a lot,

Renato


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>