formatKey negative numbers

2007-05-17 Thread chamal desilva
Hi,

I am using bean:write tag to display properties
(return type Double) of my form bean.

I am also using formatKey attribute to format the
output. 

This is the format key I have mentioned in
ApplicationResources.properties file.

display.currency=#,## 0.00

Formatting works fine. But negative numbers are NOT
displayed with minus character. How can I format
negative numbers to be displayed with minus character.

My other question is can I format negative numbers
within brackets.

Thanking You,
Chamal.







   
Yahoo!
 oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Creating an instance of an action a class

2007-01-25 Thread chamal desilva
Hi,


Is it safe to create an instance of a action class in
another action class and use.

For example ..

public NewAction extends Action
{
   public ActionForward execute ()
   {

 OtherAction oact = new OtherAction();
 oact.execute();
   }

}




Thanking you,
Chamal.


 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Accessing Application Resources file

2006-12-21 Thread chamal desilva
Hi,

I want to retireve a message from application
resources file.

This is my code..

resources
=(MessageResources)pageContext.getRequest().getAttribute(
Action.MESSAGES_KEY );

format  = (String)
resources.getMessage("display.currency" );

This works fine. But only issue is that
Action.MESSAGES_KEY is deprecated.

Is there a much standard way to do this.

Thanking you,
Chamal.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Formatting numbers in text field

2006-12-07 Thread chamal desilva
Thanks Richard

But if do it uing getter methods I will have to write
a lot of getters since I have many properties.

Is n't there an another way. Can't we control the
formatting through a common place in Struts.

Best Regards,
Chamal.


--- "Gundersen, Richard"
<[EMAIL PROTECTED]> wrote:

> If you are using an ActionForm, you could modify
> your getter to do the
> formatting. Or, have an additional getter method
> e.g. 
> 
> Double amount;
> 
> Double getAmount() {
>   // bog standard method
> }
> String getFormattedAmount() {
>   // do some formatting
> }
> 
> Then, in the form, do something like  property="formattedAmount"/>
> 
> You can manipulate the setters in a similar way to
> accept the formatted
> text submitted by the form.
> 
> There are probably other ways for dealing with the
> same problem in
> DynaActionForms that I don't know of.
> 
> Hope this helps
> 
> Richard
> 
> -Original Message-
> From: chamal desilva [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, December 05, 2006 8:52 AM
> To: user@struts.apache.org
> Subject: Formatting numbers in text field
> 
> Hi,
> 
> Is there a way display numbers in a text field in a
> formatted way.
> 
> For example I want to display 100 as 1,000 in a text
> field.
> 
> My form field attribute type is Double.
> 
> 
> Thanking You,
> Chamal.
> 
> 
>  
>

> 
> Do you Yahoo!?
> Everyone is raving about the all-new Yahoo! Mail
> beta.
> http://new.mail.yahoo.com
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 
>
__
> This email has been scanned by the MessageLabs Email
> Security System.
> For more information please visit
> http://www.messagelabs.com/email 
>
__
> 
> *** Disclaimer *** 
> 
> This electronic communication is confidential and
> for the exclusive use of the addressee. It may
> contain private and confidential information. The
> information, attachments and opinions contained in
> this E-mail are those of its author only and do not
> necessarily represent those of London Scottish Bank
> PLC or any other members of the London Scottish
> Group. 
> 
> If you are not the intended addressee, you are
> prohibited from any disclosure, distribution or
> further copying or use of this communication or the
> information in it or taking any action in reliance
> on it. If you have received this communication in
> error please notify the Information Security Manager
> at [EMAIL PROTECTED] as soon as possible and
> delete the message from all places in your computer
> where it is stored. 
> 
> We utilise virus scanning software but we cannot
> guarantee the security of electronic communications
> and you are advised to check any attachments for
> viruses. We do not accept liability for any loss
> resulting from any corruption or alteration of data
> or importation of any virus as a result of receiving
> this electronic communication. 
> 
> Replies to this E-mail may be monitored for
> operational or business reasons. London Scottish
> Bank PLC is regulated by the Financial Services
> Authority.
>
__
> This email has been scanned by the MessageLabs Email
> Security System.
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



 

Cheap talk?
Check out Yahoo! Messenger's low PC-to-Phone call rates.
http://voice.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Comparing dates

2006-12-06 Thread chamal desilva
Hi,

Is it possible to compare dates with logic equals tag.

My form bean has a property called addedDate.

I need to compare it with date 2006-12-24

how should I write the equals tag



Thanking You,
Chamal.  


 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Formatting numbers in text field

2006-12-05 Thread chamal desilva
Hi,

Is there a way display numbers in a text field in a
formatted way.

For example I want to display 100 as 1,000 in a text
field.

My form field attribute type is Double.


Thanking You,
Chamal.


 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: help?

2006-11-21 Thread chamal desilva
Hi,

U can do like this,







Division is a form bean.
allTeams is the vector which contains the objects.
Vector contains team objects which has teamRef and
teamName properties.

division form bean also contains a property for
teamRef.
""

So when this teamRef is equal to teamRef of one of the
team objects in vector it will be selected.

Chamal.




--- Mallik <[EMAIL PROTECTED]> wrote:

> 
> Hi friends 
> this is a modifying details page.
> i have a select box,that will populate with
> databases values. i used
>  labelProperty=""/>. till now
> everything ok.
> but one of these options should select automatically
> when the page displayed
> that value is in formBean. 
> how can i do this help pease
> 
> ur's
> Mallik
> -- 
> View this message in context:
>
http://www.nabble.com/%3Chtml%3Aoptions--%3E-help--tf2667275.html#a7438109
> Sent from the Struts - User mailing list archive at
> Nabble.com.
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 



 

Sponsored Link

Mortgage rates near 39yr lows. 
$510k for $1,698/mo. Calculate new payment! 
www.LowerMyBills.com/lre

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



setInput method of ActionMapping

2006-11-13 Thread chamal desilva
Hi,


I want to call

mapping .setInput() method inside my validate method
of a form bean.

But it throws an Exception.


java.lang.IllegalStateException: Configuration is
frozen at 
org.apache.struts.config.ActionConfig.setInput(ActionC


Please help me to correct this issue.

Thanking You,
Chamal.


 

Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Validating a form bean

2006-11-02 Thread chamal desilva
Hi,

I have a form bean  as this one

public class CustomerForm extends ActionForm
{
private AccountForm accForm = null;
// other attributes and methods
 
}


My JSP looks like this. It has a form which contains
details of CustomerForm as well as AccountForm inside
CustomerForm.

 
   Customer Name 
   Customer Age  

   account num   
   account num   


But when I submit the page only the contents of
CustomerForm is validated. AccountForm's validate
method does not get called.

Best Regards,
Chamal.


 

Cheap Talk? Check out Yahoo! Messenger's low PC-to-Phone call rates 
(http://voice.yahoo.com)


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Forwarding to a url

2006-10-05 Thread chamal desilva
Thanks Antonio Petrelli,

But I can't define a forward, since the forward url
and id are not static. URL can be any page and id can
be any number. Is there a way to do it without
forwards.

Chamal.

--- Antonio Petrelli <[EMAIL PROTECTED]> wrote:

> chamal desilva ha scritto:
> > Hi,
> >
> > Is it possible to forward to a url rather than
> > forwaring to a forward in struts.config file from
> a
> > action class.
> >
> > For example we can do like this from servlets.
> >
> >
>
req.getRequestDispatcher("page.jsp?id=10").forward(req,resp);
> >
> > Can we do the same with struts.
> >   
> 
> Sure, you can:
> * define a forward inside your action mapping that
> points to an URL:
> 
> * return a newly created ActionForward at the end of
> the "execute" method:
> return new ActionForward("page.jsp?id=10");
> 
> Anyway, I think that your problem depends on the
> presence of the 
> parameter. Why do you want to process that parameter
> in the JSP page? 
> Isn't it better to process it into the action and
> putting something in 
> request scope?
> 
> Ciao
> Antonio
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Forwarding to a url

2006-10-03 Thread chamal desilva
Hi,

Is it possible to forward to a url rather than
forwaring to a forward in struts.config file from a
action class.

For example we can do like this from servlets.

req.getRequestDispatcher("page.jsp?id=10").forward(req,resp);

Can we do the same with struts.

Thanking You,
Chamal.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Print value of a map

2006-09-30 Thread chamal desilva
Hi,

Is there a Struts tag to search and print a value of a
map

for example a tag like this



where mapname is the name of map in session or request
and key is the key in map to be found.

Thanking You,
Chamal. 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Submit Button Tag passing an expression to onclik attribute

2006-09-19 Thread chamal desilva
Hi,

Can we pass an expression to onclick handler of struts
html:submit tag.



We tried this. But the HTML is generated as

onclick="hilightButton2('<%=myval%>');" 

The value of myval variable is not printed in html.

Plz help us to solve this problem.

Best Regards,
Chamal.



__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



html:options Hashtable

2006-09-03 Thread chamal desilva
Hi,

Can we display the values of a hashtable in a html
drop down menu using struts tags.



Thanking You,
Chamal.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



BeanUtils copyProperties - copying vector

2006-08-03 Thread chamal desilva
Hi,

I have four classes.

public class AccountForm
{
  private String accNum;
}

public class Account
{
  private String accNum;
}

public class CustomerForm
{
 private String custRef = "";
 private Vector accounts= null;//Contains objects
of AccountForms classes

 //Get, set methods
}

public class Customer
{
 private String custRef = "";
 private Vector accounts = null; //Contains
objects of Account classes

 //Get, set methods
}

Now I need to copy properties from CustomerForm object
to Customer object.

My customers classes accounts vector contains Account
objects. CustomerForm classes accounts vector contains
AccountForms.

So when BeanUtils copy accounts vector from
CustomerForm to Customer class, will it also convert
AccountForms to Accounts. If not is there a way that I
can do that.

Thanking You,
Chamal.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Grouping common actions

2006-07-17 Thread chamal desilva
Hi,

I need to group actions to a common action class.

We dont have EventActionDispatcher since we have
struts version 1.1.

DispatchAction class needs button names to have the
save name as method names. And is there a way that we
can add common functionality to all methods in
DIspatchAction class?


Are there any other way in struts 1.1 to group actions
into one action class.

Thanking You,
Chamal

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Using properties files other than ApplicationProperties

2006-07-07 Thread chamal desilva
Hi,

I want store all messages in a properties file called
MessageProperties.

I added this line to struts config file.


How can I retireve values in properties file from my
action classes in order to display them using
 tag.

Thanking You,
Chamal.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Struts and AJAX

2006-07-02 Thread chamal desilva
Hi,

Can I use struts with AJAX. Does struts has classes
and tags for AJAX or do I have write my own code.

Thanking You,
Chamal.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Checkling Security

2006-06-18 Thread chamal desilva
Hi,

How should we test wether a user has permission for an
action. Can we do it in action class or do we have to
do it in EJB tier.

Thanking You,
Chamal.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



ActionForm and EJB

2006-06-08 Thread chamal desilva
Hi,

I read few articles on struts. They recommend not to
send action form class to EJBs as data holders. They
recommend we should use general classes for holding
data to decople web tier with EJBs.

What they say must be correct but I still have few
doubts (Maybe b'cause I am not experienced).

Don't we have to modify two classes, if we use both
ActionForms and normal java classes to store data.For
example we will have modify two classes to add a new
attribute, remove attribute etc.

Please help me to understand this more clearly.

Thanking You,
Chamal.


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Organizing action classes

2006-06-07 Thread chamal desilva
Hi,

I have few action mapings.

/get_admin_tasks
/add_task
/ass_user
   etc.

/get_add_data
  /save_customer_data
  /save_account_data
  etc.

Is it necessary to write Action classes for each of
these actions or can we group several actions in to
one Action class.

What is the best way to organize actions in to action
classes.

Thanking You,
Chamal.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Controlling Reset method

2006-06-04 Thread chamal desilva
Hi Scott,

Thanks a lot for your reply. It was very useful.

Thanking You,
Chamal.

--- Scott Van Wart <[EMAIL PROTECTED]> wrote:

> chamal desilva wrote:
> > Dear Scott ,
> >
> > Thanks for your reply. 
> >
> > "If you're viewing the second account, why would
> you
> > need data for the 
> > first account?  If it's a problem of losing the
> > customer ID for the 
> > "
> >
> > I need the first account data because it is in the
> > Vector of Customer bean. So the first
> item(Account) of
> > vector will be reset when struts reset the data.
> >
> > Thanking You,
> > Chamal. 
> >   
> Can you simply load it into the bean again? 
> Typically when I set 
> something up like this (parent child relationship,
> where selecting a 
> parent lists the children, and you can click on each
> child), I'll have 
> actions like ShowAccountsAction and
> ShowAccountAction.  I use a 
> ShowCustomerForm, which takes a customer ID, and
> this form is passed to 
> the ShowAccountsAction, which populates the array so
> the subsequent page 
> can list the accounts.  When you click on an
> account, the 
> ShowAccountAction gets called, and is passed in a
> ShowAccountForm (which 
> has an account ID).  The ShowAccountAction populates
> the bean with a 
> single account.
> 
> When the account is shown, because of the
> parent-child relationship, I 
> can provide a "Back" button which will re-populate
> the ShowCustomerForm 
> with the customer ID (looked up through the account
> ID), and the account 
> list will be displayed again.  By separating
> everything, you don't have 
> to worry about what you keep in memory.  Struts
> calls the reset() method 
> on your form bean because it wants to use the form
> for something else.  
> So separate everything out and you won't have to
> worry about keeping the 
> whole list of accounts in a bean across page
> requests.
> 
> - Scott
> 
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Controlling Reset method

2006-06-04 Thread chamal desilva
Dear Scott ,

Thanks for your reply. 

"If you're viewing the second account, why would you
need data for the 
first account?  If it's a problem of losing the
customer ID for the 
"

I need the first account data because it is in the
Vector of Customer bean. So the first item(Account) of
vector will be reset when struts reset the data.

Thanking You,
Chamal. 



--- Scott Van Wart <[EMAIL PROTECTED]> wrote:

> chamal desilva wrote:
> > For examle let's think there are four Accounts in
> > accounts vector. The first action displays this
> list
> > on a JSP. User clicks on first account and views
> > details. Then user goes back and clicks on second
> > account. Then the data of first account object is
> > reset and gets lost. This is my problem/
> If you're viewing the second account, why would you
> need data for the 
> first account?  If it's a problem of losing the
> customer ID for the 
> account, just make sure you populate the customer ID
> in the action that 
> handles the "back" action associated with viewing
> the account.
> 
> - Scott
> 
>
-
> To unsubscribe, e-mail:
> [EMAIL PROTECTED]
> For additional commands, e-mail:
> [EMAIL PROTECTED]
> 
> 


__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Controlling Reset method

2006-06-03 Thread chamal desilva
Hi,

As I know the reset method of a form bean is called
automatically when a action tries to add the form bean
to session or retrieve it.

Is there a way that we can stop the reset method being
called.



This is what I am trying to do.

I have two form beans for Customer and Account and two
actions to "view account list of customer" and "view
account details". First action is linked with Customer
bean and it display the list of accounts owned by the
customer. The second action is linked with Account
bean and it shows the details of account selected by
user.

public void Customer extends ActionForm
{
Vector accounts = new Vector(); //Elements of this
vector contains Account beans

//other attributes and methods


}


public void Account extends ActionForm
{
//attributes and methods

}




For examle let's think there are four Accounts in
accounts vector. The first action displays this list
on a JSP. User clicks on first account and views
details. Then user goes back and clicks on second
account. Then the data of first account object is
reset and gets lost. This is my problem/


=

Thanking You,
Chamal.

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]