[OT] ConvertUtils Mess

2005-08-16 Thread Nitish Kumar
I am using my custom converters to convert from String to Date, we are using
Quartz as well, which also does the same with its own DateConverters.
Unfortunately my date formats and quartz date formats are different. 
 
Initially my idea was to register the converters as a part of plugin, which
has already been discussed over in this forum. 
 
Now with quartz changing the converters in the middle of running
application, I have to re-register the converters every time I want to use
them, the problem however is that I still can not say with surety which
converters would be used where. 
 
Has any one ever came across such a scenario and if yes, what is the
solution?
 

Thanks and Regards, 
Nitish Kumar 


 


Custom Tag release() method not being called

2005-07-23 Thread Nitish Kumar

Hey all,
I am trying to write a custom tag, I have a requirement to display
different form element (i.e. text box, label or textarea depending on the
flags set by user), This tag is nested inside nested:iterate  
In this tag, I am also maintaining a counter which gets incremented
each time the tag is called and I am resetting the counter in the release()
method, however the release method is not being called and if I hit refresh
on the page, the counter takes the last value of previous iteration.

I expected that when the parent tag's doEndTag is called, it should call
release on all the child tags, is it not so? 

In any case, is there a workaround to achieve this?
 

Thanks and Regards, 
Nitish Kumar 


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



RE: [OT] Hibernate vs. iBatis vs. POJO

2005-07-21 Thread Nitish Kumar


just adding my 2 cents.

I do agree there is no technology which fits all the requirement, I have
used Hibernate 2.X and it really is a big help for normal persistance,
however on some situations it was a nightmare, I hope they fixed up that in
Hibernate3.x. 

Never worked with IBatis, so can not comment. 

I think I would still like to have the freedom of writing normal SQL queries
while having the flexibility of using a mapping tool. I guess Hibernate does
provide that kind of flexibility.  

However if some one want to go and write their own DAO from scratch, I would
suggest them to have a look at Spring's DAO support classes, it can really
help at times.

I am not an architect by the way. -:) So, I guess I do have freedom to fool
around with the technologies. 

Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Friday, July 22, 2005 7:55 AM
To: Struts Users Mailing List
Subject: Re: [OT] Hibernate vs. iBatis vs. POJO


I'd have to agree... It has not been unusual to estimate three months 
for something, and that's fairly realistic to do it right, and the 
business says nope, 1.5 months is when we need it.  Well, what the 
heck did you ask me for an estimate for in the first place then?!?

I'm a lead architect by the way, very much in a position to influence 
deadlines, but at the end of the day IT is there to service the 
business, not the other way around (unless you happen to work for an IT 
company of course!), so, as Martin says, what's unreasonable?

Frank

Martin Gainty wrote:
 What qualifies as unreasonable? ..give the project lead 2 weeks and 
 he/she cuts it to 2 days?
 BTW: Thats 99% of the companies Ive worked for..
 Where specifically do they NOT follow that behaviour?
 M-
 - Original Message - From: Derek Broughton [EMAIL PROTECTED]
 To: user@struts.apache.org
 Sent: Thursday, July 21, 2005 5:25 PM
 Subject: Re: [OT] Hibernate vs. iBatis vs. POJO
 
 
 Frank W. Zammetti wrote:

 In such cases, the application IS important enough to code
 trials, but the business won't allow you to but they STILL want you to
 sweat the decisions!  This is a typical way of doing things, going by my
 experience.


 It depends what _your_ job is.  If you're a consultant, you're 
 expected to
 _know_ the technology, and the customer isn't paying for you to 
 experiment.
 If you're an employee, I've never worked in a situation where you 
 don't get
 the time to evaluate the right techniques.


 Even if its the largest initiative of the year for the company, the most
 important project, there is still a deadline, usually and unreasonable
 one, and taking the time to properly evaluate options isn't always 
 given.


 Then go find a new job.  There's lots of them for capable people - don't
 work at places that put unreasonable demands on you.
 -- 
 derek


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


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

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com


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

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



RE: Hi-New to this group

2005-07-20 Thread Nitish Kumar


Personally, I am not a big follower of EJB and I echo the sentiments that
EJBs are a performance killers. My own experience with Entity Beans has not
been pretty good. 

So until you have some very strong reasons to go for EJB, dont! 

In my limited knowledge , Spring with Hibernate or Ibatis, is a good
substitute for EJB, if you want EJB features, without paying for the expense
of remote look up, or you can use EJB with local interfaces (I believe that
using local instead of remote removes a big performance overhead). 



Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Michael Rasmussen [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 21, 2005 2:50 AM
To: Maya menon; Struts Users Mailing List
Subject: Re: Hi-New to this group


Maya,
  See inline

On 7/20/05, Maya menon [EMAIL PROTECTED] wrote:
 Michael, 
   
 Yes: in our web app, in the jsp, there will be a button/checkbox which the
 users can click to let the system know about the status of their work.
Now,
 when they click it, it can directly update the database. [rather than
that,
 i dont know..] 
   
 I was not thinking about using entity beans at all. I was thinking about
 using session beans as facade and all database activities being performed
 inside DAOs [select,update etc] 

That is probably wise.  Hibernate (http://hibernate.org) which was
mentioned earlier is a good mix of POJO and persistence framework, but
for 500 users you are probably small enough that DAO/JDBC will be
fine.  Especially if you don't need any transactional support.

   
 You talked about command pattern. where will a command patterm come when
 used with struts ? sorry, i dont know hence i asked. 
   

For an explanation of the command pattern see the GOF Command Pattern or
here
http://www.dofactory.com/Patterns/PatternCommand.aspx, (first result in
Google)

Basically your action would delegate to the command and pass it a
context (Populated by your form data).  All the commands implement the
command interface (with the execute(Context) method).  The command
could then delegate to other worker commands that do database work or
send emails or other generic tasks.  Then the action works like all
actions do and takes what is in the context and puts it in the right
scope and forwards on to the JSP.  The commands can be broken up
(similar to session beans) to do small units of work.  If you use a
factory to get your commands the factory can be configured to return
different instances of the command based on user roles and so on.



 Struts action classes - ? - ? - DAO. 
   
Struts action classes - command - command - DAO. 

Michael


 Thanks
 
 Michael Rasmussen [EMAIL PROTECTED] wrote: 
 Maya,
 You mentioned that you are providing access to things in the users
 database. Are you giving them write access? If not there is little
 reason to use Entity Beans (read None) in your application. If you
 don't need your application to be distributed, and I didn't see it in
 your requirements, then session beans may be overkill too. I would
 look to what others have said here and evaluate hibernate or naked
 JDBC before choosing entity beans as your backend and session beans as
 your business facade. (though I wouldn't write off session beans
 entirely). Using something like a command pattern could work nicely
 as a business facade. I am working right now with an application that
 uses a command pattern for the business layer and I am quite fond of
 it. You could also have a look at the Commons-Chain project for a
 nice implementation of a pattern that is quickly becoming one of my
 favorites.
 http://jakarta.apache.org/commons/chain And beginning with
 struts 1.3
 it will be a first class citizen of Struts.
 
 Michael


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

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



RE: hi

2005-07-15 Thread Nitish Kumar


You can use MappingDispatchAction or LookupDispatchAction, but I think what
you want can be better achieved by MappingDispatchAction.


PS: Please use a better subject than Hi, it doesnt give much clue about what
your problem is..




Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Bayarsaikhan VOLODYA [mailto:[EMAIL PROTECTED]
Sent: Friday, July 15, 2005 8:03 PM
To: user@struts.apache.org
Subject: hi


hi all,

currently, i set action parameter manually. i mean
/user.do?action=edit

i dont want this one. i want to set it up like this. Telling no Parameter.
/userEdit.do
/userDelete.do
...
with no parameter but one action class that extends DispathAction.
how can i handle it?

-- 
Bayarsaikhan VOLODYA

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



RE: Validation framework

2005-07-14 Thread Nitish Kumar


With no intentions to create yet another thread of I dont like Validator
Framework. I just wanted to know if there was any way of using validation
framework to validate collections element, without writing
bean.collection[0].property for the property, as it might not be possible to
know the size of collection (else why would I use collection? )

To make it easier, a lot of times i have a collection of textboxes to be
populated with numbers, Is there any way of validating?

overriding validate() method of ActionForm, is not an option, as I am using
BeanValidatorForm. 


Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Borislav Sabev [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 14, 2005 3:34 PM
To: Struts Users Mailing List
Subject: Re: Validation framework


Rafael Taboada wrote:

Hi folks I'm using validation framework in order to validate my fields in a

form.
 I have three fields in a search form:
 strUsername
strFromDate
strToDate
 But we have the rule that the user can fill strUsername or use dates
range. 
I mean he can search by username or he can search by dates range...
 When I use validation, it validates all the fields My question is how 
can I set my search rule??? the user can search by username or by dates 
range... If he choose username so validation only has to validate username 
field... But if he choose dates range, so validation has to validate only 
FromDate and ToDate...
 Any help would be appreciated...
 Thanks in advance.

  

You have at least 3 choices:
1. client side validation i.e. to use javascript onSubmit to check such 
logic
2. write your own validator - see commons-validator for more info
3. validate it in the form.validate() metod
all 3 have +/- I recomend you the 3th method.

Regards
Borislav

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

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



RE: Handling VOs

2005-07-12 Thread Nitish Kumar


well one of the reasons I can think of is that I have to change all my
html:.../ tags to nested:../ tags, or use bean.prop as you suggested.
(considering I am not using a view only JSP)

Another one could be, I still need to keep the properties as String in
ActionForm. VOs just acts as a nested formBean. (Read Craig's earlier mail) 

As for the type conversion, the default converter just changes the values to
default preset values in case of exception, (read Rick Reumann's earlier
mail) 




Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Larry Meadors [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 12, 2005 10:39 PM
To: Struts Users Mailing List
Subject: Re: Handling VOs


I still do not see why putting your VO on your action form is a bad thing.

1) It gives you a super-easy way to map strings (bean.propName)
2) It gives you an easy way to perform string-type conversions
3) It does not couple your VO to your form 
4) While it does couple your form to your VO, who cares?
5) When your Action gets the form, it also has the VO, with strongly
typed and named values ready to go to the business tier.

So, what is the down side?

Larry


On 7/12/05, Frank W. Zammetti [EMAIL PROTECTED] wrote:
 I would say no, it's no more acceptable (acceptable being a relative term
 of course!).
 
 An EmployeeVO, presuming that is an object passed form the control layer
 to the model layer, still needs to know about something in the view layer,
 the ActionForm.  Hence, it's not really any better.
 
 In reply to Rick's original post, I echo the thoughts of others that
 passing an ActionForm out of an Action to a delegate is generally a bad
 idea, and certainly is not in keeping with the original intent of an
 ActionForm, nor in what are generally seen as the best practices of the
 time.
 
 Passing the request is kind of a separate question, but just as
 undesirable in my opinion because it ties your model to the presentation
 mechanism.  What if someone comes along and wants to take your web-based
 application and create a Swing front-end for it?
 
 Another good reason to not pass request around is that your business
 delegates become harder to unit test because now you have to deal with
 mock request objects, or maybe even a whole mock servlet setup (I've seen
 session passed to business delegates too).
 
 I believe Rick knows when he is breaking the rules and consciously
 chooses to do so :)  That's acceptable because he understands the
 consequences and can intelligently make the decision.  It's important
 though that new developers understand not only what things are frowned
 upon, but also WHY they are frowned upon.  I can speak from experience
 when I say I haven't always followed best practices, sometimes because the
 situation warranted, but also sometimes because I didn't understand the
 reasoning behind the practices and hence wasn't convinced to follow them.
 Best practices are best practices because people tend to agree they have
 more benefit than other approaches in most cases, and that is the case
 here.
 
 --
 Frank W. Zammetti
 Founder and Chief Software Architect
 Omnytex Technologies
 http://www.omnytex.com
 
 On Tue, July 12, 2005 12:37 pm, Brady Hegberg said:
  Rick sent the example code below to an user earlier and I was just
  wondering.  Would it be acceptable to generate the EmployeeVO using a
  constructor like:
 
  EmployeeVO emp = new EmployeeVO( eForm );
 
  Would that be considered tying the view to the business layer?  It seems
  like it would work nicely especially since you could use polymorphism if
  you needed to generate VOs from other Forms (ie
  AnotherEmployeeActionForm).
 
  Thanks,
  Brady
 
  //In Action method:
  execute(...) //or dispatchMethod update(..) {
 //cast to your ActionForm of String properties
 EmployeeActionForm eForm = (EmployeeActionForm)form;
 
 //business POJO with correct Data types
 EmployeeVO emp = new EmployeeVO();
 
 //easy to take the stuff from ActionForm to VO
 BeanUtils.copyProperties( emp, eForm );
 
 //Do the update
 yourEmployeeDAO.updateEmployee( emp );
  }
 
 
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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

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



RE: Using struts forms as Value Objects: your opinion?

2005-07-11 Thread Nitish Kumar

I think raghavendra is right.
Rivka, your code is working because you are using primitive type int and not
the wrapper type Integer.
In case of primitive type in case of any exception, it gives you a default
value.


Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Rivka Shisman [mailto:[EMAIL PROTECTED]
Sent: Monday, July 11, 2005 5:13 PM
To: Struts Users Mailing List
Subject: RE: Using struts forms as Value Objects: your opinion?


Hi Borislav

I did the test and it works fine - 

In my form I have:

private int question_no;

public void setQuestion_no(int i) {
 this.question_no = i;
}

public int getQuestion_no() {
return question_no;
}

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {

ActionErrors errors = new ActionErrors();

  if (action.equals(create)){  

   if (question_no = 0) {
errors.add(question_no, new
ActionMessage(error.field.positive_num,מספר שאלה));
}
}
}

I don’t have anything regarding this field in struts-config (should i?)

When I insert abc in the html:text field that is related to that integer
property - I get the error message I expected to get -  the value in
question_no field must be positive

 
-Original Message-
From: Borislav Sabev [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 11, 2005 11:27 AM
To: Struts Users Mailing List
Subject: Re: Using struts forms as Value Objects: your opinion?

Rivka Shisman wrote:

Hi again

When you say that validation doesn't work when inserting ABC in an
integer field - do you mean when using struts Validator?
I'm not using the Validator - I just add if myInteger  1  in method
validate().

If I define myInteger as String - how do I check that it's a valid
number in the validate() method (without using Validator)?

  

Doesn't matter if you use validation or not, if you define a form 
property as Integer for example (in the form class and in struts-config) 
and then if you write abc in this field, you will get a 
ConversionException because the first step that Struts makes in the 
RequestProcesor is to populate the form bean i.e. to match the 
parameters that are comming with the request and transform them to the 
form proiperties.
After that the validation works, but even if you don't validate the 
forms with the Validator, the populations you can't avoid or change. 
Thus you are forced to define your form properties as String (because in 
the http request anyway they ARE strings, just Struts during the 
population tries to convert them to the types defined in struts-config).
Just make a little test and you will udnerstand the problem ...
Borislav

**
The contents of this email and any attachments are confidential.
They are intended for the named recipient(s) only.
If you have received this email in error please notify the system manager or
the 
sender immediately and do not disclose the contents to anyone or make
copies.

** eSafe scanned this email for viruses, vandals and malicious content. **

**

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

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



Re: Using struts forms as Value Objects: your opinion? BeanUtil C onverter

2005-07-11 Thread Nitish Kumar

This is a HUGE problem with BeanUtils and why I end up having to 
register custom converters:(

good point, but where do I register my custom converters? I dont want to do
it in my action classes, and writing a plugin just to register my converters
would be a big overhead.

Why cant we have declative registration through struts-config.xml, just like
other components and struts should take care of registering my converters
with ConvertUtil? (If its not already done yet!) 

This would actually give me flexibility to have my custom types as well in
the form bean.

Lets say, for some application I want all java.util.Long types to be
appended with $ symbol, it becomes much easier with a converter.

what do you say?

Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED]
Sent: Monday, July 11, 2005 11:17 PM
To: Struts Users Mailing List
Subject: Re: Using struts forms as Value Objects: your opinion?


Borislav Sabev wrote the following on 7/11/2005 1:37 PM:

 In case of the Integer there is pre-load default value and EVEN if 
 conversion fails during the population phase, it just use is the dafault 
 value (and you think it's parsed correctly). In the previous example its 
 a coincidence that Rivka have 0 as default value (it's just the same 
 value as init value of IntegerConverter).

Bingo:) Sorry saw this thread late and could have helped out much 
sooner. This is a HUGE problem with BeanUtils and why I end up having to 
register custom converters:(

BeanUtils (at least it always has done this, maybe in a recent version 
it's hopefully changed?), will end up converting null values to 0!! 
Stupid, stupid if you ask me (null means null not 0!) Goes the same for 
the other numeric wrappers as well. (I think their argument was for 
backwards compatibility with apps that expect that behavior).

In regard to you point...

 The strange point is that I didn't find how can I set a default date
 value ... if someone knows it, please share this knowledge here.

You shouldn't want a default at all provided by BeanUtils for cases 
where it can be null! You are using the anomoly of the way Integer is 
working and wanting to propogate that poor solution. null should be 
null.. it shouldn't be 0 or some default Date if null is provided.

If you want a default Date or some other default than provide that 
before going to your form...or if after it submits and you see a null, 
then provide the default. You could of course register your own 
converter to provide a default for when a Date is null- but I would NOT 
do this.

Actually, in regards to a Date, in case you didn't already realize, 
you'll have to provide your own converter anyway if you plan to use 
java.util.Date since BeanUtils doesn't provide that by default.. it only 
provides conversion for java.sql.Date. If you need help with the 
converters I can post some code or search the struts archives for 
java.util.Date converter

-- 
Rick

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

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



RE: Struts vs .NET???

2005-07-02 Thread Nitish Kumar

With all due respect to every one (including microsoft).. the advantage of
.NET is nothing but a IDE which is idiot proof. 
Any dumb can do a few clicks followed by intelligent editor to prompt and
spoon feed whats to be written, and then the IDE creates a code, which makes
any dumb with or without any intelligence, a programmer. 

Unfortunately in java, we still have a long way to go before we promote
idiots to the coder level.. We are progressing in that direction, but I
guess we still have some time before that..till then I hope to retire.. :)


Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: John Henry Xu [mailto:[EMAIL PROTECTED]
Sent: Saturday, July 02, 2005 4:14 PM
To: Struts Users Mailing List
Subject: Re: Struts vs .NET???


 Dakota Jack wrote: Good lord, if you want a GUI tool, just make one.

D.J., I think a person doesn't need do all things by himself, especially
there are lots of decent GUI tools in market for you to pick. Is writting
lots of getters and setters manually the most productive way in real
projects?

Jack H. Xu
Technology columnist and editor

http://www.usanalyst.com

http://www.getusjobs.com (The largest free job portal in North America)  

  - Original Message -
  From: Dakota Jack
  To: Struts Users Mailing List
  Subject: Re: Struts vs .NET???
  Date: Fri, 1 Jul 2005 23:44:26 -0700

  
   Good lord, if you want a GUI tool, just make one. This is not a
   response to Reumann who absolutely rocks but to those people who
  like
   other people to code for them, i.e. the VB lovers and the like,
  like
   JSF, .NET, etc.
  
   On 7/1/05, Rick Reumann wrote:
John Henry Xu wrote the following on 6/30/2005 11:49 PM:
   
 struts can fit into J2EE structure and it is only part of it.
  And in
 my opinion, you better use some GUI tools to develop struts
 application, otherwise you spend lots of time on getters and
  setters.
   
Well even many of the most basic editors will make get/set
  methods, so I
wouldn't say you need a GUI Tool at all for coding Struts apps. I
  happen
to use IDEA and jEdit, mostly because I'm used to using them.
  (Yea I
know Eclipse is good also..bla bla.. everyone just use what you
  like..
emacs, vim, pico, chalkboard, whatever:) It's just very
  misleading to
state that you need GUI tools to create Struts apps.
   
--
Rick
   
   
  -
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
   
   
  
  
   --
   You can lead a horse to water but you cannot make it float on its
  back.
   ~Dakota Jack~
  
  
  -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]






Jack H. Xu
Technology columnist and editor

http://www.usanalyst.com

http://www.getusjobs.com (The largest free job portal in North America)

-- 
___
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


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



RE: javascript html:fprm and getElementById

2005-06-27 Thread Nitish Kumar

Sorry for getting mixed up with terms, I didnt mean casting as in terms of
Java, :)

document.getElementById always returns object and then if we start treating
it as frames or forms. It some times doesnt work..


Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Monday, June 27, 2005 10:40 AM
To: user@struts.apache.org
Subject: RE: javascript html:fprm and getElementById


Remember that getElementById is the standards-compliant method, the others
are not, IIRC.  They of course work too, but when manipulating DOM objects,
getElementById is supposed to be used, according to the current standards.

Is there such a thing as casting in JS?  I'm not sure.  I don't think there
is as far as object references go anyway, but I could be wrong.

Frank

-Original Message-
From: Nitish Kumar[EMAIL PROTECTED]
Sent: 6/27/05 12:37:42 AM
To: 'Struts Users Mailing List'user@struts.apache.org
Subject: RE: javascript html:fprm and getElementById


I geuss, some thing working or not working in JavaScript is a lot
dependent
on what version of what browser, are you using.

Well, Any ways, from my previous experience with JavaScript, usually

document.getElementById gives you an object, and casting it to form
doesnt
work all the time..

it is always better to use document.forms[i].action .


Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Monday, June 27, 2005 3:05 AM
To: Struts Users Mailing List
Subject: Re: javascript html:fprm and getElementById


Why do you believe this does not work?  I just tried in IE and it worked

fine, as I would expect since I do this sort of thing all the time.

I would suggest throwing an alert before and after the code setting the 
action, display what the action of the form is.  I did this and it does 
indeed change.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

Arash Bijanzadeh wrote:
 Hi,
 I need to change the action of my form on the fly. I use the following

 javascript:
 function setParam(mode)
 {
 document.getElementById(myform).action =%=(String)
 request.getAttribute(origin)%
 + mode+ .do;
 document.forms[0].submit();
 
 }
 and my form is :
 html:form action=%=(String) request.getAttribute(origin)% 
 styleId=myform 
 
 It works perfect under mozilla but not IE. I think the problem is that
IE 
 looks for Id in the name field of form and he couln't find it.
 Could anyone help me?
 Regards
 ARash
 







[Message truncated. Tap Edit-Mark for Download to get remaining portion.]


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

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



RE: javascript html:fprm and getElementById

2005-06-26 Thread Nitish Kumar

I geuss, some thing working or not working in JavaScript is a lot dependent
on what version of what browser, are you using.

Well, Any ways, from my previous experience with JavaScript, usually

document.getElementById gives you an object, and casting it to form doesnt
work all the time..

it is always better to use document.forms[i].action .


Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED]
Sent: Monday, June 27, 2005 3:05 AM
To: Struts Users Mailing List
Subject: Re: javascript html:fprm and getElementById


Why do you believe this does not work?  I just tried in IE and it worked 
fine, as I would expect since I do this sort of thing all the time.

I would suggest throwing an alert before and after the code setting the 
action, display what the action of the form is.  I did this and it does 
indeed change.

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com

Arash Bijanzadeh wrote:
 Hi,
 I need to change the action of my form on the fly. I use the following 
 javascript:
 function setParam(mode)
 {
 document.getElementById(myform).action =%=(String)
 request.getAttribute(origin)%
 + mode+ .do;
 document.forms[0].submit();
 
 }
 and my form is :
 html:form action=%=(String) request.getAttribute(origin)% 
 styleId=myform 
 
 It works perfect under mozilla but not IE. I think the problem is that IE 
 looks for Id in the name field of form and he couln't find it.
 Could anyone help me?
 Regards
 ARash
 




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

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



varying targets

2005-06-24 Thread Nitish Kumar
I have a application which extensively uses iframes. On some of the submit
buttons I have to change the parent frame, while on some actions, I have to
just update the current frame. I use 
 
target = _parent or target = _self for this purpose. 
 
Till this point every thing works fine. The problem starts when some of the
validation for the action where parent frame is to be updated fails. I get
errors on the parent frame because I have specified target=_parent , 
 
Is there any way, by which I can change the target through action class or
from the server?
 
 



Thanks and Regards, 
Nitish Kumar 


 


RE: ApplicationResources.properties vs Validator framework

2005-06-23 Thread Nitish Kumar

To me it seems, due to a different locale, your application is looking for 
ApplicationResources_fr_CA.properties


you can try renaming your properties file to
ApplicationResources_fr_CA.properties and then deploying the application.


Thanks and Regards,
Nitish Kumar
Tavant Technologies Ltd
Bangalore


-Original Message-
From: Gilbert, Antoine [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 6:09 PM
To: Struts Users Mailing List
Subject: ApplicationResources.properties vs Validator framework


Hi

 

I have a strange problem.

 

I have an application using validator on server side and client side
(javascript), I have an ApplicationResources.properties with all my
messages for erreor messages from validations. All is working ok.

 

But, I made a war file and deployed the application on another server,
and all validations error messages are now empty.
ApplicationResources.properties is there, and I have this line in my
struts-config.xml :

 

message-resources parameter=ApplicationResources/

 

I activated logs via log4j, and I'm not getting any significant
information except maybe this (I don't see him load
ApplicationResources.properties) :

 

 

DEBUG [org.apache.struts.action.RequestProcessor][23-06-2005 08:29:42]:
processForwardConfig(ForwardConfig[name=default,path=/console/Contenu.js
p?contenu=/console/sections/EditMenuLocale.jsp,redirect=false,contextRel
ative=false,module=null])

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: getMessage(fr_CA,errors.required)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr_CA)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]:   Loading resource 'resources/application_fr_CA.properties'

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]:   Loading resource completed

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]:   Loading resource 'resources/application_fr.properties'

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]:   Loading resource completed

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale()

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]:   Loading resource 'resources/application.properties'

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]:   Loading resource completed

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: getMessage(fr_CA,errors.maxlength)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr_CA)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale()

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: getMessage(fr_CA,errors.maxlength)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr_CA)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale()

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: getMessage(fr_CA,errors.maxlength)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr_CA)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale()

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: getMessage(fr_CA,errors.maxlength)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr_CA)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale(fr)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:29:43]: loadLocale()

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:30:21]: getMessage(fr_CA,finalizing)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:30:21]: loadLocale(fr_CA)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:30:21]:   Loading resource
'org/apache/struts/action/ActionResources_fr_CA.properties'

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:30:21]:   Loading resource completed

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:30:21]: loadLocale(fr)

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:30:21]:   Loading resource
'org/apache/struts/action/ActionResources_fr.properties'

 DEBUG [org.apache.struts.util.PropertyMessageResources][23-06-2005
08:30:21]:   Loading resource

RE: ApplicationResources.properties vs Validator framework

2005-06-23 Thread Nitish Kumar

From the log, it seems that struts is finding application.resources from
your config file. 

Just check if you have a . in the config..

Thanks and Regards,
Nitish Kumar


-Original Message-
From: Gilbert, Antoine [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 7:28 PM
To: Struts Users Mailing List
Subject: RE: ApplicationResources.properties vs Validator framework


yes

-Original Message-
From: klute [mailto:[EMAIL PROTECTED] 
Sent: June 23, 2005 9:55 AM
To: Struts Users Mailing List
Subject: Re: ApplicationResources.properties vs Validator framework

Does your web.xml contain the following as part of the
action servlet config?

init-param
  param-nameapplication/param-name
  param-valueApplicationResources/param-value
/init-param


--- Gilbert, Antoine [EMAIL PROTECTED] wrote:

 Hi
 
  
 
 I have a strange problem.
 
  
 
 I have an application using validator on server side
 and client side
 (javascript), I have an
 ApplicationResources.properties with all my
 messages for erreor messages from validations. All
 is working ok.
 
  
 
 But, I made a war file and deployed the application
 on another server,
 and all validations error messages are now empty.
 ApplicationResources.properties is there, and I have
 this line in my
 struts-config.xml :
 
  
 
 message-resources
 parameter=ApplicationResources/
 
  
 
 I activated logs via log4j, and I'm not getting any
 significant
 information except maybe this (I don't see him load
 ApplicationResources.properties) :
 
  
 
  
 
 DEBUG

[org.apache.struts.action.RequestProcessor][23-06-2005
 08:29:42]:

processForwardConfig(ForwardConfig[name=default,path=/console/Contenu.js

p?contenu=/console/sections/EditMenuLocale.jsp,redirect=false,contextRel
 ative=false,module=null])
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: getMessage(fr_CA,errors.required)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr_CA)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]:   Loading resource
 'resources/application_fr_CA.properties'
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]:   Loading resource completed
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]:   Loading resource
 'resources/application_fr.properties'
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]:   Loading resource completed
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale()
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]:   Loading resource
 'resources/application.properties'
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]:   Loading resource completed
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: getMessage(fr_CA,errors.maxlength)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr_CA)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale()
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: getMessage(fr_CA,errors.maxlength)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr_CA)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale()
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: getMessage(fr_CA,errors.maxlength)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr_CA)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale()
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: getMessage(fr_CA,errors.maxlength)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr_CA)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale(fr)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:29:43]: loadLocale()
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:30:21]: getMessage(fr_CA,finalizing)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:30:21]: loadLocale(fr_CA)
 
  DEBUG

[org.apache.struts.util.PropertyMessageResources][23-06-2005
 08:30:21]:   Loading resource

'org/apache/struts/action

RE: [OT] Find missing property file keys?

2005-06-23 Thread Nitish Kumar
Following code would give you the missing keys..


InputStream is = null;
Properties props1 = new Properties();
Properties props2 = new Properties();

ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
if (classLoader == null) {
classLoader = this.getClass().getClassLoader();
}

is = classLoader.getResourceAsStream(file1);

if (is != null) {
try {
props1.load(is);

}
catch (IOException e) {

}
finally {
try {
is.close();
}
catch (IOException e) {
}
}
}
is = classLoader.getResourceAsStream(file2);

if (is != null) {
try {
props2.load(is);

}
catch (IOException e) {

}
finally {
try {
is.close();
}
catch (IOException e) {
}
}
}

java.util.Enumeration enum =  props1.keys();
while(enum.hasMoreElements())
{
String key = (String) enum.nextElement();
if(!props1.containsKey(key))
{
System.out.println(key);
}
}


Thanks and Regards,
Nitish Kumar
Tavant Technologies Ltd
Bangalore


-Original Message-
From: Emmanouil Batsis [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 7:44 PM
To: Struts Users Mailing List
Subject: [OT] Find missing property file keys?


Hi all,

Is there any tool to compare property files based on their keys only ? I 
have some really huge ones for different locales but the number of keys 
is different and i need to find the missing ones...

Thanks,

Manos

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

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



RE: Validation while using LookupDispatchAction

2005-06-23 Thread Nitish Kumar


I would probably use ValidWhen 


field property=freeText depends=validwhen
arg0 key=myForm.freeText.name/
var
var-nametest/var-name
var-value( (method!= validateMe)
or (*this* != null) )/var-value
/var
/field

Thanks and Regards, 
Nitish Kumar 




-Original Message-
From: Vicky [mailto:[EMAIL PROTECTED]
Sent: Thursday, June 23, 2005 7:55 PM
To: Struts Users Mailing List
Subject: Validation while using LookupDispatchAction


My action class extends LookupDispatchAction, which
has different methods in it. In struts-config.xml i
have parameter method as we all know. My problem is;
in my validation.xml i do have to perform different
validations for different methods, how do I
distinguish or find out which method is called to
perform validation for that method only?

struts-config.xml
form-bean name=myForm
type=org.apache.struts.validator.DynaValidatorActionForm
   form-property name=freeText
type=java.lang.String/


/form-bean

action path=/myAction type=com.action.MyAction
name=myForm validate=true parameter=method
forward..
/action

validation.xml

form-validation
formset
form name=/myaction.do
field property=freeText
depends=required
   arg0 key=myForm.freeText.name/
/field
/form
 /formset
/form-validation

in above code in validaton.xml i need to pass method
name for which i want this validation to take place
not for all methods. Something like form
name=/myAction.do?method=methodName

how do I do this? or any other way. I would appreciate
prompt response with examples.

Thanks in advance,





__ 
Yahoo! Mail Mobile 
Take Yahoo! Mail with you! Check email on your mobile phone. 
http://mobile.yahoo.com/learn/mail 

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

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



[OT] Hidden Fields V/S session scope

2005-06-20 Thread Nitish Kumar
I am again stuck on to the age old debate of Session v/s Request scope form
beans.
 
I have a fairly large amount of data in my form bean, Since I have my own
pagination logic, I need to keep a large amount of data on jsp, I am using
hidden fields to move the data back and forth between server and client.
 
I just wanted to know, how much of impact would be in terms of performance,
if I put the data in session compared to passing the data in hidden fields.
 



Thanks and Regards, 
Nitish Kumar 


 


RE: html:option

2005-06-14 Thread Nitish Kumar

use html:options tag along with the html:select

or

print option XXX 
using logic:iterate

logic:iterate ...
logic:equals ...
option selected=true bean:write ...
/logic:equals
logic:notEquals ...
option  bean:write ...
/logic:notEquals
/logic:iterate


Thanks and Regards,
Nitish Kumar
Tavant Technologies Ltd
Bangalore


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 14, 2005 11:53 AM
To: user@struts.apache.org
Subject: html:option



I want 
html:option selected=true xxx /html:option

Is there a way out to select a default value at design time?  (I hate 
javascript!!... lol. )


Amitava Basak
ASE
Tata Consultancy Services Limited
Mailto: [EMAIL PROTECTED]
Website: http://www.tcs.com

Notice: The information contained in this e-mail message and/or attachments
to it may contain confidential or privileged information.   If you are not
the intended recipient, any dissemination, use, review, distribution,
printing or copying of the information contained in this e-mail message
and/or attachments to it are strictly prohibited.   If you have received
this communication in error, please notify us by reply e-mail or telephone
and immediately and permanently delete the message and any attachments.
Thank you

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



RE: How to run an action automatically like thread ?

2005-05-26 Thread Nitish Kumar

Cant you put an auto refresh of 10 min on a jsp which calls the action
class.. 


Thanks and Regards,
Nitish Kumar
Tavant Technologies Ltd
Bangalore


-Original Message-
From: Paul McCulloch [mailto:[EMAIL PROTECTED]
Sent: Thursday, May 26, 2005 2:23 PM
To: 'Struts Users Mailing List'
Subject: RE: How to run an action automatically like thread ?


Quartz (http://www.opensymphony.com/quartz/) is a job scheduling system
which sounds like it could help you out.

I'd reconsider whether your code should really be in a Struts action. What
are you gaining by using Struts for a non-web bit of processing?

Paul

 -Original Message-
 From: minhnguyet [mailto:[EMAIL PROTECTED]
 Sent: 2005/26/05 07:21
 To: Struts FAQ
 Subject: How to run an action automatically like thread ?
 
 
 Hi all ,
 I have an action in struts  that I want it will   read 
 database and process some another actions base on that 
 database every 10 minutes . But I don't how to make it 
 automatically run like thread in application ! Any recomments ? 
 
 Thanks in advance  for help .
 

Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this message (or responsible for delivery
of the message to such person), you may not copy or deliver this message to
anyone. In such case, you should destroy this message, and notify us
immediately. If you or your employer does not consent to Internet email
messages of this kind, please advise us immediately. Opinions, conclusions
and other information expressed in this message are not given or endorsed by
my Company or employer unless otherwise indicated by an authorised
representative independent of this message.

WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being
transmitted via electronic mail attachments we cannot guarantee that
attachments do not contain computer virus code.  You are therefore strongly
advised to undertake anti virus checks prior to accessing the attachment to
this electronic mail.  Axios Systems Ltd grants no warranties regarding
performance use or quality of any attachment and undertakes no liability for
loss or damage howsoever caused.


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

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



RE: Populating growing List

2005-05-23 Thread Nitish Kumar

dont think its a great idea, If I start putting beans in session , every
time I have a collection in form bean, I am not sure how long my application
is going to run.



Thanks and Regards,
Nitish Kumar


-Original Message-
From: Nils Liebelt [mailto:[EMAIL PROTECTED]
Sent: Monday, May 23, 2005 5:39 PM
To: 'Struts Users Mailing List'
Subject: RE: Populating growing List


What a bummer. I got the wrong scope!?! If I put the Form in session scope
it works fine. Gonna borrow a tie from my boss so I can hang myself... 


Cheers,

Nils

-Original Message-
From: Nils Liebelt [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 23, 2005 1:50 PM
To: 'Struts Users Mailing List'
Cc: [EMAIL PROTECTED]
Subject: Populating growing List

Hi all,

I know that common issue with indexed properties as mentioned in the wiki
http://wiki.apache.org/struts/StrutsCatalogLazyList.

So I wrote a little handcranked lazy list but I still get an
indexoutofbounce exception. I really don't know whats going on here: 

private ArrayList deleteSelection = new ArrayList();

public void setDeleteSelection(int i, String toDelete) {
this.deleteSelection.set(i, toDelete);
}

public String getDeleteSelection(int i) {
while(i=this.deleteSelection.size()) {
this.deleteSelection.add(new String());
}
return (String) this.deleteSelection.get(i);

}

The nested exception looks like this:

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:508)
at java.util.ArrayList.set(ArrayList.java:336)
at
com.candor.hummingbird.forms.AccountForm.setDeleteSelection(AccountForm.java
:74)



Regards,

Nils


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


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

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



RE: Populating growing List

2005-05-23 Thread Nitish Kumar

Even I had to do the same in quite a few of my application, personally I
would have loved to have a standard solution for this problem from apache
group in future releases of struts. 


Thanks and Regards,
Nitish Kumar

-Original Message-
From: Sachin Bhutada [mailto:[EMAIL PROTECTED]
Sent: Monday, May 23, 2005 5:45 PM
To: 'Struts Users Mailing List'
Subject: RE: Populating growing List



If your form bean is being used in multiple page, you can put the form in
session and clear the collection in reset method if required. That will
serve the purpose. In my application we are using the same apporach and our
application has not yet crashed at least bcoz of form bean :) 

sachin



-Original Message-
From: Nitish Kumar [mailto:[EMAIL PROTECTED]
Sent: Monday, May 23, 2005 5:44 PM
To: 'Struts Users Mailing List'
Subject: RE: Populating growing List



dont think its a great idea, If I start putting beans in session , every
time I have a collection in form bean, I am not sure how long my application
is going to run.



Thanks and Regards,
Nitish Kumar


-Original Message-
From: Nils Liebelt [mailto:[EMAIL PROTECTED]
Sent: Monday, May 23, 2005 5:39 PM
To: 'Struts Users Mailing List'
Subject: RE: Populating growing List


What a bummer. I got the wrong scope!?! If I put the Form in session scope
it works fine. Gonna borrow a tie from my boss so I can hang myself... 


Cheers,

Nils

-Original Message-
From: Nils Liebelt [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 23, 2005 1:50 PM
To: 'Struts Users Mailing List'
Cc: [EMAIL PROTECTED]
Subject: Populating growing List

Hi all,

I know that common issue with indexed properties as mentioned in the wiki
http://wiki.apache.org/struts/StrutsCatalogLazyList.

So I wrote a little handcranked lazy list but I still get an
indexoutofbounce exception. I really don't know whats going on here: 

private ArrayList deleteSelection = new ArrayList();

public void setDeleteSelection(int i, String toDelete) {
this.deleteSelection.set(i, toDelete);
}

public String getDeleteSelection(int i) {
while(i=this.deleteSelection.size()) {
this.deleteSelection.add(new String());
}
return (String) this.deleteSelection.get(i);

}

The nested exception looks like this:

Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.RangeCheck(ArrayList.java:508)
at java.util.ArrayList.set(ArrayList.java:336)
at
com.candor.hummingbird.forms.AccountForm.setDeleteSelection(AccountForm.java
:74)



Regards,

Nils


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


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

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

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



RE: Populating growing List

2005-05-23 Thread Nitish Kumar

The solution, we later adopted was have a class extending ArrayList, some
thing like this.. 


class MyList extends ArrayList{
  public Object set(int index, Object element)
{
if(index  size())
  {
add(new Object());  // Add objects of appropriate type
to avoid ClassCast exception
  }
return super.set(index, element);
}

   public Object get(int index)
{
if(index  size())
  {
add(new Object());  // Add objects of appropriate type
to avoid ClassCast exception
  }
return super.get(index);
}
}

obviously this is simplified form of that class.

Thanks and Regards,
Nitish Kumar



-Original Message-
From: Niall Pemberton [mailto:[EMAIL PROTECTED]
Sent: Monday, May 23, 2005 7:27 PM
To: Struts Users Mailing List
Subject: Re: Populating growing List


The reason this isn't working lies in how Commons BeanUtils works. What you
read in the wiki works for setting the properties of nested indexed beans-
not straight forward indexed properties. In this circumstance it will just
call the indexed setter so for it to work you need your lazy code there,
rather than the indexed getter.

Niall

- Original Message - 
Sent: Monday, May 23, 2005 12:50 PM
Subject: Populating growing List


 Hi all,

 I know that common issue with indexed properties as mentioned in the wiki
 http://wiki.apache.org/struts/StrutsCatalogLazyList.

 So I wrote a little handcranked lazy list but I still get an
 indexoutofbounce exception. I really don't know whats going on here:

 private ArrayList deleteSelection = new ArrayList();

 public void setDeleteSelection(int i, String toDelete) {
 this.deleteSelection.set(i, toDelete);
 }

 public String getDeleteSelection(int i) {
 while(i=this.deleteSelection.size()) {
 this.deleteSelection.add(new String());
 }
 return (String) this.deleteSelection.get(i);

 }

 The nested exception looks like this:

 Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
 at java.util.ArrayList.RangeCheck(ArrayList.java:508)
 at java.util.ArrayList.set(ArrayList.java:336)
 at

com.candor.hummingbird.forms.AccountForm.setDeleteSelection(AccountForm.java
 :74)



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

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