Re: iterate arraylist question

2005-10-31 Thread Murray Collingwood
Hi

Checkout the documentation, it even includes an example...

http://struts.apache.org/struts-taglib/tagreference-struts-logic.html#iterate

Kind regards
mc

On 31 Oct 2005 at 19:35, sma3har wrote:

> Hi,
> 
> I want to iterate through my arraylist of objects and
> display the values using bean:write and submit them
> with form.
> 
> My strut config has :
> 
>  type="org.apache.struts.validator.DynaValidatorForm">
>type="java.lang.String"/>
>type="java.lang.String"/>
>type="java.lang.String"/>
>type="java.util.ArrayList"/>
>  
> 
> feild4 is an arraylist of javabean class mybean.
> class mybean{
> String new1;
> String new2;
> String new3;
> public String getNew1() {
>   return new1;
>   }
> 
>   public void setNew1(String new1) {
>   this.new1 = new1;
>   }
> 
>   public String getNew2() {
>   return new2;
>   }
> 
>   public void setNew2(String new2) {
>   this.new2 = new2;
>   }
> 
>   public String getNew3() {
>   return new3;
>   }
> 
>   public void setNew3(String new3) {
>   this.new3 = new3;
>   }
> 
> }
> 
> so how do i iterate through the arraylist of bean
> objects. I have to print the values of new1,new2, new3
> and submit to form using html:hidden.
> Please give me an example.
> 
> 
> 
> Thanks
> Suchi
> 
> 
>   
>   
> __ 
> Yahoo! Mail - PC Magazine Editors' Choice 2005 
> http://mail.yahoo.com
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.12.6/152 - Release Date: 31/10/2005
> 



FOCUS Computing - web design
Mob: 0415 24 26 24
[EMAIL PROTECTED]
http://www.focus-computing.com.au




-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.6/152 - Release Date: 31/10/2005


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



iterate arraylist question

2005-10-31 Thread sma3har
Hi,

I want to iterate through my arraylist of objects and
display the values using bean:write and submit them
with form.

My strut config has :


  
  
  
  
 

feild4 is an arraylist of javabean class mybean.
class mybean{
String new1;
String new2;
String new3;
public String getNew1() {
return new1;
}

public void setNew1(String new1) {
this.new1 = new1;
}

public String getNew2() {
return new2;
}

public void setNew2(String new2) {
this.new2 = new2;
}

public String getNew3() {
return new3;
}

public void setNew3(String new3) {
this.new3 = new3;
}

}

so how do i iterate through the arraylist of bean
objects. I have to print the values of new1,new2, new3
and submit to form using html:hidden.
Please give me an example.



Thanks
Suchi




__ 
Yahoo! Mail - PC Magazine Editors' Choice 2005 
http://mail.yahoo.com

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



Re: Clay isEL and replaceMnemoic

2005-10-31 Thread Ryan Wynn
Actually, the more I think about this, I think it may be easier to use the
attribute set to accomplish this instead of changing the dtd. Maybe there
could be a new bindingType value (Symbol) to identify this type of
attribute. Or maybe an existing bindingType could be used somehow? Either
way these values would be added to the symbol map, and evaluated like
bindingType="Early"
 So my example would be something like
  
 
 
 
 
  
 
 
  
 


 On 10/31/05, Ryan Wynn <[EMAIL PROTECTED]> wrote:
>
>  Gary, one more thing that would be nice would be if the parser allowed
> symbols and there values to be specified on the component and element xml
> elements.
>  Would this be a difficult fix?
>  For example,
> 
>  
>  
> 
>  I noticed that the Builder adds symbols to target ComponentBeans based on
> whether or not the token is a known attribute.
>  Could the component/element parser do the same; if not jsfid, extends,
> id, allowBody, facetName, etc then add token as symbol?
>  Right now the dtd stops you. But I think it might be nice to be able to
> push the symbol definitions back to the component/element level in some
> instances.
>  For example, the above definition overrides the symbol anotherSymbol
> inside myComp with 2 different values. I couldn't do this at the html level
> because I would have to commit to 1 value for anotherSymbol. E.g.  jsfid="foo" mySymbol="bar" anotherSymbol="myBean"/>.
>  I promise to chill out on the symbols after this!
>  Thanks, Ryan
>
>
>  On 10/31/05, Gary VanMatre <[EMAIL PROTECTED]> wrote:
>
> > Ryan Wynn Wrote:
> >
> > >Currently, this is supported but only if value = [EMAIL PROTECTED] and
> > valueExpr=" myBean.property", because
> > >the mnemonic replacement is done after the determination of whether or
> > not the value isEL and isVB.
> > >
> > >So to allow for mnemonics to be replaced by #{foo.bar},
> > PropertyValueCommand would need to change to do
> > >the mnemonic replacement before determining isEL and isVB and isEarly.
> > >
> > >Any thoughts? I think this may be a better solution than the prior
> > discussed solution for overriding horizontally.
> > >
> >
> > That's a good idea and a simple fix. I'll add the symbol replacement on
> > the string before checking for el. Also make the symbol replacement
> > available to the early binding.
> >
> > I agree. This seems to be a very slick way to customize a subtree
> > without creating a new hierarchy. Great ideas Ryan!
> >
> > Gary
> >
> >
> >
> >
> >
> >
> >
> >
> > -- Forwarded message --
> > From: Ryan Wynn <[EMAIL PROTECTED]>
> > To: Struts User < user@struts.apache.org>
> > Date: Mon, 31 Oct 2005 15:00:39 +
> > Subject: Re:  Clay isEL and replaceMnemoic
> > Sorry, had a mistake in my post. In the example the 2nd component would
> > look
> > like this.
> > 
> > 
> > 
> > 
> > 
> > or another approach would be
> > 
> >
> > On 10/31/05, Ryan Wynn <[EMAIL PROTECTED] > wrote:
> > >
> > > It seems beneficial to allow a mnemonic to be replaced by an EL
> > > expression. This could be another approach to the 'horizontal
> > override' of
> > > component subtree and reduce the need to replicate the structure of
> > the
> > > subtree in children.
> > > For example,
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > 
> > > would allow a component to extend from parent an override the nested
> > > value of child without duplicating the structure of parent just to
> > override
> > > a single attribute.
> > > 
> >
> > > Currently, this is supported but only if value =
> > [EMAIL PROTECTED]<[EMAIL PROTECTED]>and valueExpr="
> > > myBean.property", because the mnemonic replacement is done after the
> > > determination of whether or not the value isEL and isVB.
> > > So to allow for mnemonics to be replaced by #{foo.bar},
> > > PropertyValueCommand would need to change to do the mnemonic
> > replacement
> > > before determining isEL and isVB and isEarly.
> > > Any thoughts? I think this may be a better solution than the prior
> > > discussed solution for overriding horizontally.
> > > Ryan
> > >
> >
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
>


RE: missing application web.xml

2005-10-31 Thread Mark Rehbein


The same problem occurs when I deploy the struts-examples.war, make a
change to a JSP page, repack the war and redeploy.

 

-Original Message-
From: Mark Rehbein [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, 1 November 2005 10:56 AM
To: user@struts.apache.org
Subject: missing application web.xml

Hi,
 
I'm sure I've done something silly
 
I have a very simple war file that includes struts and I can deploy it
only once. If I make a change to a JSP and repack the war and copy it to
the webapps directory I get a "missing application web.xml" error as
below:
 
1/11/2005 10:26:50 org.apache.catalina.startup.Catalina start
INFO: Server startup in 9424 ms
1/11/2005 10:26:59 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive daves-workspace.war
1/11/2005 10:27:30 org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/daves-workspace]
1/11/2005 10:27:31 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive daves-workspace.war
1/11/2005 10:27:31 org.apache.catalina.startup.ContextConfig
applicationWebConfig
INFO: Missing application web.xml, using defaults only
StandardEngine[Catalina].StandardHost[localhost].StandardContext[/daves-
workspace]
 
 
If I remove the struts servlet declaration from the web.xml file, I can
make changes and redeploy over and over with no trouble.
 
I am using tomcat 5.5.12 and struts 1.2.7 and java 1.5
 
Any help appreciated.
 
Cheers
 
Mark
 



 The information contained in this communication is  for the use of the
individual  or  entity  to  whom  it  is  addressed, and  may  contain
information which is the  subject of legal privilege and/or copyright. 
 If you have received this  communication in  error, please  notify the
sender by return E-Mail and delete the transmission, together with any
attachments, from your system. Thank you.

-




 The information contained in this communication is  for the use of the 
 individual  or  entity  to  whom  it  is  addressed, and  may  contain 
 information which is the  subject of legal privilege and/or copyright. 
 If you have received this  communication in  error, please  notify the 
 sender by return E-Mail and delete the transmission, together with any 
 attachments, from your system. Thank you.
-


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

missing application web.xml

2005-10-31 Thread Mark Rehbein
Hi,
 
I'm sure I've done something silly
 
I have a very simple war file that includes struts and I can deploy it
only once. If I make a change to a JSP and repack the war and copy it to
the webapps directory I get a "missing application web.xml" error as
below:
 
1/11/2005 10:26:50 org.apache.catalina.startup.Catalina start
INFO: Server startup in 9424 ms
1/11/2005 10:26:59 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive daves-workspace.war
1/11/2005 10:27:30 org.apache.catalina.startup.HostConfig checkResources
INFO: Undeploying context [/daves-workspace]
1/11/2005 10:27:31 org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive daves-workspace.war
1/11/2005 10:27:31 org.apache.catalina.startup.ContextConfig
applicationWebConfig
INFO: Missing application web.xml, using defaults only
StandardEngine[Catalina].StandardHost[localhost].StandardContext[/daves-
workspace]
 
 
If I remove the struts servlet declaration from the web.xml file, I can
make changes and redeploy over and over with no trouble.
 
I am using tomcat 5.5.12 and struts 1.2.7 and java 1.5
 
Any help appreciated.
 
Cheers
 
Mark
 



 The information contained in this communication is  for the use of the 
 individual  or  entity  to  whom  it  is  addressed, and  may  contain 
 information which is the  subject of legal privilege and/or copyright. 
 If you have received this  communication in  error, please  notify the 
 sender by return E-Mail and delete the transmission, together with any 
 attachments, from your system. Thank you.
-



Re: Expression in an expression?

2005-10-31 Thread Rahul Akolkar
Otmar - Please see reply below.

On 10/31/05, Michael Rasmussen <[EMAIL PROTECTED]> wrote:
> You could try putting all of your collections into a collection and
> accessing them by the index that way, or you could use a:
>
>  style approach combined with your current tag and use index
> in a series of 
> 
> 
> 
>
> Unfortunately expressions within expressions will not work and
> wouldn't be really clean if you actually did find a way to do it.
>
> On 10/31/05, Otmar Manuela <[EMAIL PROTECTED]> wrote:
> > Hi,
> >
> > Can someone help me with the following?  I have the following code in my
> > jsp file:
> >
> > 
> >
> > The problem is that I have a number of collections and I want to be able
> > to dynamically tell the bean which collection to use.  The code below
> > does not work, but it will give you an idea of what I'm trying to
> > accomplish:
> >
> > 
> >
> > Is there a way to accomplish this?


You cannot gensym in JSP or EL.

Michael has one solution above, I'd move that bit to a delegating bean
that accesses the appropriate collection so the view stays fairly
clean.

-Rahul


> >
> > Thanks,
> >
> > Otmar Manuela
> >

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



Re: Clay isEL and replaceMnemoic

2005-10-31 Thread Ryan Wynn
Gary, one more thing that would be nice would be if the parser allowed
symbols and there values to be specified on the component and element xml
elements.
 Would this be a difficult fix?
 For example,

 
 

 I noticed that the Builder adds symbols to target ComponentBeans based on
whether or not the token is a known attribute.
 Could the component/element parser do the same; if not jsfid, extends, id,
allowBody, facetName, etc then add token as symbol?
 Right now the dtd stops you. But I think it might be nice to be able to
push the symbol definitions back to the component/element level in some
instances.
 For example, the above definition overrides the symbol anotherSymbol inside
myComp with 2 different values. I couldn't do this at the html level because
I would have to commit to 1 value for anotherSymbol. E.g. .
 I promise to chill out on the symbols after this!
 Thanks, Ryan


 On 10/31/05, Gary VanMatre <[EMAIL PROTECTED]> wrote:
>
> Ryan Wynn Wrote:
>
> >Currently, this is supported but only if value = [EMAIL PROTECTED] and
> valueExpr="myBean.property", because
> >the mnemonic replacement is done after the determination of whether or
> not the value isEL and isVB.
> >
> >So to allow for mnemonics to be replaced by #{foo.bar},
> PropertyValueCommand would need to change to do
> >the mnemonic replacement before determining isEL and isVB and isEarly.
> >
> >Any thoughts? I think this may be a better solution than the prior
> discussed solution for overriding horizontally.
> >
>
> That's a good idea and a simple fix. I'll add the symbol replacement on
> the string before checking for el. Also make the symbol replacement
> available to the early binding.
>
> I agree. This seems to be a very slick way to customize a subtree without
> creating a new hierarchy. Great ideas Ryan!
>
> Gary
>
>
>
>
>
>
>
>
> -- Forwarded message --
> From: Ryan Wynn <[EMAIL PROTECTED]>
> To: Struts User 
> Date: Mon, 31 Oct 2005 15:00:39 +
> Subject: Re:  Clay isEL and replaceMnemoic
> Sorry, had a mistake in my post. In the example the 2nd component would
> look
> like this.
> 
> 
> 
> 
> 
> or another approach would be
> 
>
> On 10/31/05, Ryan Wynn <[EMAIL PROTECTED]> wrote:
> >
> > It seems beneficial to allow a mnemonic to be replaced by an EL
> > expression. This could be another approach to the 'horizontal override'
> of
> > component subtree and reduce the need to replicate the structure of the
> > subtree in children.
> > For example,
> > 
> > 
> > 
> > 
> > 
> > 
> > 
> > would allow a component to extend from parent an override the nested
> > value of child without duplicating the structure of parent just to
> override
> > a single attribute.
> > 
> > Currently, this is supported but only if value =
> [EMAIL PROTECTED]<[EMAIL PROTECTED]>and valueExpr="
> > myBean.property", because the mnemonic replacement is done after the
> > determination of whether or not the value isEL and isVB.
> > So to allow for mnemonics to be replaced by #{foo.bar},
> > PropertyValueCommand would need to change to do the mnemonic replacement
> > before determining isEL and isVB and isEarly.
> > Any thoughts? I think this may be a better solution than the prior
> > discussed solution for overriding horizontally.
> > Ryan
> >
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>


Re: Expression in an expression?

2005-10-31 Thread Murray Collingwood
Hi Otmar

I'm not certain but stuff inside the ${...} is already assumed to be variable 
names.  What 
is the type of 'myCollection', is actually a collection?  I would assume it is 
some sort of 
array and then you can use:



Else you should be iterating through the collection to identify individual 
objects.  Give 
us a bit more detail on the JSP and we might be able to help.

If you variables are called 'myCollection1' and 'myCollection2' and you are 
trying to 
reference them in a loop I'm not sure you will have much success.  You would 
need 
some type of eval() function to be able to interpret strings as variable names. 
 I don't 
know if this can be done - however it's probably not the best practice.  Better 
to 
structure the data into a collection of objects.

Cheers
mc


On 31 Oct 2005 at 17:39, Otmar Manuela wrote:

> Hi,
> 
> Can someone help me with the following?  I have the following code in my 
> jsp file:
> 
> 
> 
> The problem is that I have a number of collections and I want to be able 
> to dynamically tell the bean which collection to use.  The code below 
> does not work, but it will give you an idea of what I'm trying to 
> accomplish:
> 
> 
> 
> Is there a way to accomplish this? 
> 
> Thanks,
> 
> Otmar Manuela
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 
> 
> -- 
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.1.362 / Virus Database: 267.12.6/151 - Release Date: 28/10/2005
> 



FOCUS Computing - web design
Mob: 0415 24 26 24
[EMAIL PROTECTED]
http://www.focus-computing.com.au




-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.362 / Virus Database: 267.12.6/151 - Release Date: 28/10/2005


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



Re: Need to write a custom validator for the validator framework

2005-10-31 Thread Niall Pemberton
On 10/31/05, Jim Reynolds <[EMAIL PROTECTED]> wrote:
> Hello,
>  I have an odd page, which requires some non-normal validation. I would like
> to be able to write my own validator, to handle this. I am having trouble
> finding examples, references on how to do this.
>  Does anyone have any links, on how, to, or configure a custom validator for
> my project?

Take a look at the Struts FieldChecks class - thats where all the
"standard" validations are:

   http://tinyurl.com/do4wo

Niall

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



Re: new website look

2005-10-31 Thread Adam Hardy

Hi David,

I know that extension although I hadn't installed it. It's getting 
better and better.


Thanks for the tip.

Adam


David G. Friedman on 31/10/05 21:30, wrote:

Adam,

I have a CSS editor in FireFox that seems to allow live editing and work
with the @imports URLs on the new Maven-ized Struts homepage:

https://addons.mozilla.org/extensions/moreinfo.php?id=60
Or directly at:
http://chrispederick.com/work/webdeveloper/

Short-cut: Control-Shift-E
Long-way: right click, "Web Developer", "CSS", "Edit CSS"

Regards,
David

-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED]
Sent: Monday, October 31, 2005 2:18 PM
To: Struts Users Mailing List
Subject: Re: new website look


Wendy Smoak on 30/10/05 16:50, wrote:


From: "Ted Husted" <[EMAIL PROTECTED]>


If someone has an itch to patch the stylesheets, that's great.


I added a 'theme' section to the website conversion Wiki Page:
http://wiki.apache.org/struts/StrutsWebsiteConversion
(at the bottom.)

There are links to the two relevant plugins, plus Michael's list of
suggestions.  Feel free to add to it, or create a new page if you want.
Then open a bug ticket as an enhancement, and attach your new stylesheet
so we can take a look. :)



Sorry but I didn't manage to get as far as I wanted with this over the
weekend. I spent a while downloading and installing Firefox since I
could then use the extension 'editcss' which allows you edit the CSS in
the sidebar and see the effects as you type.

Unfortunately I not only had problems with Firefox but also the maven
'@import(url:/asdfasdf)' statements for the stylesheet link didn't work
with editcss.

Perhaps that was just as well since my graphic design skills are limited!

Does anyone know why one would use the @import(url:/)
rather than the normal  syntax? I guess it works, but I
just wanted to know why it's needed.


Adam

-
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: how do know if the validtor function is called or not

2005-10-31 Thread Niall Pemberton
On 10/31/05, Ashish Kulkarni <[EMAIL PROTECTED]> wrote:
> Hi
> I want to validate 1 field from jsp, if other field
> value is '3'.
> so i added the following validation in validation.xml
> 
>  
>  
>
> ttype
> 2
>
>  
> 
> but it seems it is not working,

The "validwhen" validator requires a "test"  which specifies the
condition. Try something like the following

 
  test
  ((ttype != 3) or (*this* != null))
 

Take a look at the Validator User Guide:

   
http://struts.apache.org/struts-doc-1.2.7/userGuide/dev_validator.html#validwhen

Also Struts 1.2.7 includes a page of examples of the "validwhen"
validator in the "struts-examples" webapp which is shipped with the
binary distribution - follow the "Validator Examples" link and you
should see a link to the "validwhen Example Form".

Niall

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



Re: Need to write a custom validator for the validator framework

2005-10-31 Thread Dave Newton

Jim Reynolds wrote:


Does anyone have any links, on how, to, or configure a custom validator

http://struts.apache.org/struts-doc-1.2.x/userGuide/dev_validator.html 
did not help?


Dave



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



Need to write a custom validator for the validator framework

2005-10-31 Thread Jim Reynolds
Hello,
 I have an odd page, which requires some non-normal validation. I would like
to be able to write my own validator, to handle this. I am having trouble
finding examples, references on how to do this.
 Does anyone have any links, on how, to, or configure a custom validator for
my project?
 Thanks,


Re: Expression in an expression?

2005-10-31 Thread Michael Rasmussen
You could try putting all of your collections into a collection and
accessing them by the index that way, or you could use a:

 style approach combined with your current tag and use index
in a series of 




Unfortunately expressions within expressions will not work and
wouldn't be really clean if you actually did find a way to do it.

On 10/31/05, Otmar Manuela <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Can someone help me with the following?  I have the following code in my
> jsp file:
>
> 
>
> The problem is that I have a number of collections and I want to be able
> to dynamically tell the bean which collection to use.  The code below
> does not work, but it will give you an idea of what I'm trying to
> accomplish:
>
> 
>
> Is there a way to accomplish this?
>
> Thanks,
>
> Otmar Manuela
>
>
> -
> 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]



Expression in an expression?

2005-10-31 Thread Otmar Manuela

Hi,

Can someone help me with the following?  I have the following code in my 
jsp file:




The problem is that I have a number of collections and I want to be able 
to dynamically tell the bean which collection to use.  The code below 
does not work, but it will give you an idea of what I'm trying to 
accomplish:




Is there a way to accomplish this? 


Thanks,

Otmar Manuela


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



Re: [FRONDAY] [OT] Just venting.

2005-10-31 Thread Leon Rosenberg
Funny :-)

I have some too...

btw, this is mine, about 8 years ago, and yes, I don't do things like
that anymore :-)

protected String encode(String src){
return 
StringUtils.replace(StringUtils.replace(StringUtils.replace(StringUtils.replace(StringUtils.replace(StringUtils.replace(src,'%',"%25"),'&',"%26"),'#',"%23"),'+',"%2B"),'
',"%20"),'=',"%3D");
}


following code is not mine (thank g-d) but also ugly:

Random ran;
dbIFC is an instance of a businesslogic unit. Goal is to find a new id
for import of a new company.
while( dbIFC.companyExist(id = (ran == null ? (ran = new
Random(System.currentTimeMillis())).nextInt():ran.nextInt())) );

and that's my favorite comment:
/**
 * @author xxx - 13.08.2001
 * Transform key figuere value into the value  without exponents
like millon or thousend
 * @param provider provider id that supplies this key figure
 * @param key figure id
 * @prama valau stringrepresantation of key figure value
 * return trafsformated key figure value
 * */

hope you feel better now, as not the only one to deal with boneheaded :-)

Want some more? :-)

here, one junior developer decided that equals isn't cool enough :-)

if(req.getParameter("nMode")!=null){
   try{
if(req.getParameter("nMode").compareTo("edit")==0){

same guy, same class:
if(myNote.length()>0){
 addBeanToRequest(req,"dohook","true");
}else addBeanToRequest(req,"dohook","false");

...

how do you check if a String is equal to "true"? Equals is for worms!

return sDo.indexOf("true") >= 0;


next one is mine again... I want to clear the cache at 4 o'clock each morning...

private void receiveTimerInvalidateCacheEvent(){
  Date d = Date.currentDate();
  if (d.hour>=4 && d.hour<5){
//each morning between 4 and 5 am, we will
//completely clean the cache to enforce mailbox reload and trash cleaning
log.info("cleaning up the cache.");
cache.clearCache(); 
  }
}

if (d.hour==4) was far to easy :-)

...

regards
Leon


regards
Leon



On 10/31/05, Dave Newton <[EMAIL PROTECTED]> wrote:
> In my quest to make every else feel better about their development
> environments, here is my Beautiful Discovered Code Fragment of the Day.
> Actual code, actual live project, developers unnamed to protect the
> boneheaded.
>
>  From export_generator.jsp (JavaDocs are for the weak), I present the
> following:
>
> <%!
> public static class Escaper extends FilterWriter {
> public Escaper(Writer writer) {
> super(writer);
> }
> public void write(char[] cbuf, int off, int len) throws
> IOException {
> super.write(cbuf, off, len);
> }
> public void write(String str, int off, int len) throws IOException {
> for (int i = off, maxI = off + len; i < maxI; i++) {
> this.write(str.charAt(i));
> }
> }
> public void write(int c) throws IOException {
> if (c > 0x7F) {
> super.write(' ');
> } else if (c == '&') {
> super.write('&');
> super.write('a');
> super.write('m');
> super.write('p');
> super.write(';');
> } else {
> super.write(c);
> }
> }
> }
>
> public static final char DOUBLE_QUOTE = '"'; // "
> %>
>
> Thank you. (I left on the dandy DOUBLE_QUOTE definition, complete with
> Java comments (go ahead, I dare ANYBODY to tell me that THAT is a useful
> comment) for your extended plasure.
>
> Dave
>
>
>
> -
> 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: new website look

2005-10-31 Thread David G. Friedman
Adam,

I have a CSS editor in FireFox that seems to allow live editing and work
with the @imports URLs on the new Maven-ized Struts homepage:

https://addons.mozilla.org/extensions/moreinfo.php?id=60
Or directly at:
http://chrispederick.com/work/webdeveloper/

Short-cut: Control-Shift-E
Long-way: right click, "Web Developer", "CSS", "Edit CSS"

Regards,
David

-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED]
Sent: Monday, October 31, 2005 2:18 PM
To: Struts Users Mailing List
Subject: Re: new website look


Wendy Smoak on 30/10/05 16:50, wrote:
> From: "Ted Husted" <[EMAIL PROTECTED]>
>
>> If someone has an itch to patch the stylesheets, that's great.
>
> I added a 'theme' section to the website conversion Wiki Page:
> http://wiki.apache.org/struts/StrutsWebsiteConversion
> (at the bottom.)
>
> There are links to the two relevant plugins, plus Michael's list of
> suggestions.  Feel free to add to it, or create a new page if you want.
> Then open a bug ticket as an enhancement, and attach your new stylesheet
> so we can take a look. :)

Sorry but I didn't manage to get as far as I wanted with this over the
weekend. I spent a while downloading and installing Firefox since I
could then use the extension 'editcss' which allows you edit the CSS in
the sidebar and see the effects as you type.

Unfortunately I not only had problems with Firefox but also the maven
'@import(url:/asdfasdf)' statements for the stylesheet link didn't work
with editcss.

Perhaps that was just as well since my graphic design skills are limited!

Does anyone know why one would use the @import(url:/)
rather than the normal  syntax? I guess it works, but I
just wanted to know why it's needed.


Adam

-
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]



How do I get the Base URL from Struts?

2005-10-31 Thread Brian Demers
Hey everyone,

This is a common problem with all of the web apps I have been working
on.  I am looking for a clean way to solve this problem.  I am using
an API that requires the base URL: "http://something:8080/myApp/";

The problem is if I go through a proxy this will change where the
request came from.

How do I get the base URL from a struts action?

Thanks,
-Brian Demers

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



how do know if the validtor function is called or not

2005-10-31 Thread Ashish Kulkarni
Hi
I want to validate 1 field from jsp, if other field
value is '3'.
so i added the following validation in validation.xml

 
  

 ttype
 2

 

but it seems it is not working, here is what i have
defined in my struts-config.xml file






And this is how i have defined it in my jsp
function submitResubmit()
{
document.POApprovalForm.ttype.value="2";
document.POApprovalForm.submit();
}


How do i find out why it is not working, is is
possible to debug this issue

Ashish



__ 
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com

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



Re: Is there an abstract meta-model of Struts ?

2005-10-31 Thread Praveen Kumar Begur



Hi Christian ,

Thanks for the initiative in replying with your thoughts. Please see inline 
for my comments.


Let the thoughts flow.

regards,
Praveen



-Original Message-
From: Christian Bollmeyer [mailto:[EMAIL PROTECTED]
Sent: Monday, October 31, 2005 3:29 AM
To: Struts Users Mailing List
Subject: Re: Is there an abstract meta-model of Struts ?


Hi,

your thoughts are quite interesting, but unfortunately I don't know about an 
official MOF and kind of doubt from my own experiences Struts development 
can succesfully be formalized that way.


[Praveen]
===
I am only interested in meta-model, meta-definitions and formalization of 
the overall structure of Struts - and not formalization of code written by 
individual developers. The developer is free to implement code in the way he 
wants to as long as he adheres to ** a well known formal model ** that's 
defined with the relevant syntax and semantics.

===

For instance, many people still think quite differently about the 'M' part; 
there is no 'official' rule what 'Model' actually means; if Actions (or even 
Forms!) may be considered part of the Model an so on; I've seen quite a lot 
in this direction.


Struts is largely open to architectural decisions of this kind.

Struts provides a standard way for handling web input, based on the 
existence of a central 'request processor' servlet that delegates the 
information flow to Action implementations that do the actual work, 
determine the outcome and return it to the client somehow, plus the ability 
to manage the exact details declaratively via struts-config.xml and web.xml.


[Praveen]
===
You have defined the meta-model partially in the above sentences - although 
in prose. Getting the meta-model of your prose description would be a 
logical next step. MOF can be utilized in such an effort.

For ex:
Step-1: Define using MOF the 3 most important base modellable entities in 
Struts ie 'Model', 'View' and 'Controller' as a starting point.
	- This can be enriched and more details like validation, security etc may 
be added.

- Other important entities may be considered for Modeling later
Step-2: Defining the relationship between the Model and View, Model and 
Controller, View and Controller.
	- These relationships are expressed based on the nature of interaction / 
no-interaction between the modeled entities

Step-3: Publish this information to all as MOF constructs / artifacts

Benefits: As a result of such an exercise, anybody who follows the above MOF 
constructs / artifacts would be ** bound ** to the overall framework and 
deviations would not be allowed. The actual implementation of the 
java/c++/c# code/classes/interfaces for the 'Model', 'View', 'Controller' 
and other important Struts entities is decided by the end 
developer/architect.


- All developers would be forced to have code that identifies and realizes a 
'Model', 'View', 'Controller' etc. He may choose as per his discretion to 
write code where Forms and ActionClasses are the 'Model' for instance.
- All developers would be forced to have a structured/defined 
communication/relationship between the 'Model', 'View', and 'Controller' ( 
and other important entities like validation etc)
- Removes ambiguity from the developer's mind on where ** stuff ** needs to 
go into.
- Reduces the Struts learning curve and training efforts for newbie's since 
a formal referenceable model is present.
- Makes migration of application code from one version of Struts to a higher 
version much easier.
- Organisations can be allowed to extend and create their own specific 
Struts-like meta-models/frameworks incase they are interested in specfic 
parts of Struts.



My aim is make my Web Application development efforts as quick, simple, 
maintenable and standards compliant as possible.


Well, these are my thoughts. Your feedback is welcome.

===

But it does not enforce a formal coding or application design paradigm, and 
that's probably very wise, as Struts is a protocol-near, 'down-to-earth' 
framework by nature, originally aimed at providing a best-practice solution 
in a spot that had been left dark by the J2EE specs. In effect, Struts is a 
different kind of animal when compared to things like WebObjects, Tapestry 
or JSF which were driven by different design goals.


Perhaps Craig can shed some more light on this.

-- Chris.



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



[FRONDAY] [OT] Just venting.

2005-10-31 Thread Dave Newton
In my quest to make every else feel better about their development 
environments, here is my Beautiful Discovered Code Fragment of the Day. 
Actual code, actual live project, developers unnamed to protect the 
boneheaded.


From export_generator.jsp (JavaDocs are for the weak), I present the 
following:


<%!
   public static class Escaper extends FilterWriter {
   public Escaper(Writer writer) {
   super(writer);
   }
   public void write(char[] cbuf, int off, int len) throws 
IOException {

   super.write(cbuf, off, len);
   }
   public void write(String str, int off, int len) throws IOException {
   for (int i = off, maxI = off + len; i < maxI; i++) {
   this.write(str.charAt(i));
   }
   }
   public void write(int c) throws IOException {
   if (c > 0x7F) {
   super.write(' ');
   } else if (c == '&') {
   super.write('&');
   super.write('a');
   super.write('m');
   super.write('p');
   super.write(';');
   } else {
   super.write(c);
   }
   }
   }
  
   public static final char DOUBLE_QUOTE = '"'; // "

%>

Thank you. (I left on the dandy DOUBLE_QUOTE definition, complete with 
Java comments (go ahead, I dare ANYBODY to tell me that THAT is a useful 
comment) for your extended plasure.


Dave



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



Re: new website look

2005-10-31 Thread Adam Hardy

Wendy Smoak on 30/10/05 16:50, wrote:

From: "Ted Husted" <[EMAIL PROTECTED]>


If someone has an itch to patch the stylesheets, that's great.


I added a 'theme' section to the website conversion Wiki Page:
http://wiki.apache.org/struts/StrutsWebsiteConversion
(at the bottom.)

There are links to the two relevant plugins, plus Michael's list of 
suggestions.  Feel free to add to it, or create a new page if you want. 
Then open a bug ticket as an enhancement, and attach your new stylesheet 
so we can take a look. :)


Sorry but I didn't manage to get as far as I wanted with this over the 
weekend. I spent a while downloading and installing Firefox since I 
could then use the extension 'editcss' which allows you edit the CSS in 
the sidebar and see the effects as you type.


Unfortunately I not only had problems with Firefox but also the maven 
'@import(url:/asdfasdf)' statements for the stylesheet link didn't work 
with editcss.


Perhaps that was just as well since my graphic design skills are limited!

Does anyone know why one would use the @import(url:/) 
rather than the normal  syntax? I guess it works, but I 
just wanted to know why it's needed.



Adam

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



[announce] html2 Tag Library experiment

2005-10-31 Thread Hubert Rabago
I wanted to share the results of an experiment I was trying out.

http://www.rabago.net/struts/html2/

It's an alternate set of tags (which extends those provided by Struts)
and provides the developer with more control over handling of invalid
form fields.  At the very least, it allows you to show the validation
message beside (or near) the invalid form field.

It works with or without the Validator plugin.  For
Validator-supported forms, I use Niall's extension at
http://niallp.pwp.blueyonder.co.uk/validatorjs.html .

Try the demo.  rabago.net isn't on a Java server, though, so you'll
have to deploy the demo war on your own server.

For most forms, I'm thinking it'll work great.  For others (type=file,
multipart, indexed fields), maybe some testing would be nice.  :)

If there's enough interest (and volunteers), we can move this thing to
struts.sf.net, otherwise I'll just let this sit there for those brave
enough to use it.

Hubert

(Yes, Michael, it allows you to come close to
http://www.themaninblue.com/writing/perspective/2005/10/05/form/form4.htm
. I included a demo to show it, with its own valid/invalid graphic
indicator.)

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



How to use bean:write to print a bean with name gotten from a Java class?

2005-10-31 Thread Vu, Thai
Hi everybody,

I use digester in my application to access the constants in the whole
application. This is what I've done:

lvb_digester_rules.xml


  
  



  


struts-config.xml
__
  



  

server-constants.xml
___

  
  


This is the class used to read a value for a label in the
server-constants.xml
public class Constants {
public static String getConstant(ServletConfig servletConfig,
String key) {
ServletContext servletContext =
servletConfig.getServletContext();
ArrayList lvArray = 
(ArrayList)
servletContext.getAttribute("serverConstants");
// LabelValueBeans are equal if their values are both
null or equal.
Iterator iterator = lvArray.iterator();
LabelValueBean lvBean;
while (iterator.hasNext()) {
lvBean = (LabelValueBean) iterator.next();
if (lvBean.getLabel().equals(key)) {
return lvBean.getValue();
}
}
return null;
}
}

By doing this way, if I want to add more constants to my application, I
just need to put them in the server-constants.xml file (i.e. no change
in Java code).

Now, I put a String object in the session like this:

session.setAttribute(Constants.getConstant(servletConfig, "USER_KEY"),
myStringObj);

In Java code, I can get that String object with:

Object obj = session.getAttribute(Constants.getConstant(servletConfig,
"USER_KEY"));

How can I print out that object in jsp file with bean:write? I tried 

,
but it doesn't work. Do you know how to work around this problem? Or do
you know any other implementation of using constants in Struts
applications?

Sincerely,

Thai Dang Vu

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



[could be off-topic] lazlo + struts

2005-10-31 Thread Letícia Álvares Barbalho
Hello everyone,

I have a Struts application already working, and now I have to work harder
on the application's interface with the user. I searched and found out that
Lazlo may be a good way to do it and get good results, but I still haven't
got any experience or clue in what concerns integrating struts and lazlo.
It happens that I have my struts forms, which are populated by the data that
comes from the JSP... I haven't found a way to do it using lazlo. I'm a
newbie, though. So I wanna know if anybody here has done the struts + lazlo
combination, and if I can find a fine demo or tutorial anywhere.
I've searched the list and found the following material:

http://www.laszlosystems.com/~adam/blog/archives/28.html
http://www.laszlosystems.com/developers/community/forums/showthread.php?s=&threadid=1390&highlight=struts


But it hasn't been totally helpful. So, I'd like to know if any of you who
use struts here have used it... and if I could get any tips.

Thanks!



--
Letícia Álvares Barbalho
[EMAIL PROTECTED]


Re: Clay isEL and replaceMnemoic

2005-10-31 Thread Gary VanMatre
Ryan Wynn Wrote:

>Currently, this is supported but only if value = [EMAIL PROTECTED] and 
>valueExpr="myBean.property",  because 
>the mnemonic replacement is done after the determination of whether or not the 
>value isEL and isVB. 
> 
>So to allow for mnemonics to be replaced by #{foo.bar}, PropertyValueCommand 
>would need to change to do 
>the mnemonic replacement before determining isEL and isVB and isEarly.
> 
>Any thoughts?  I think this may be a better solution than the prior discussed 
>solution for overriding horizontally.
>

That's a good idea and a simple fix.  I'll add the symbol replacement on the 
string before checking for el.  Also make the symbol replacement available to 
the early binding.

I agree.  This seems to be a very slick way to customize a subtree without 
creating a new hierarchy.  Great ideas Ryan!

Gary
 




--- Begin Message ---
Sorry, had a mistake in my post. In the example the 2nd component would look
like this.
  
 
 
 

 or another approach would be
 

 On 10/31/05, Ryan Wynn <[EMAIL PROTECTED]> wrote:
>
>  It seems beneficial to allow a mnemonic to be replaced by an EL
> expression. This could be another approach to the 'horizontal override' of
> component subtree and reduce the need to replicate the structure of the
> subtree in children.
>  For example,
>  
>  
>  
>  
>  
>  
> 
>  would allow a component to extend from parent an override the nested
> value of child without duplicating the structure of parent just to override
> a single attribute.
>  
>  Currently, this is supported but only if value = [EMAIL PROTECTED]<[EMAIL 
> PROTECTED]>and valueExpr="
> myBean.property", because the mnemonic replacement is done after the
> determination of whether or not the value isEL and isVB.
>  So to allow for mnemonics to be replaced by #{foo.bar},
> PropertyValueCommand would need to change to do the mnemonic replacement
> before determining isEL and isVB and isEarly.
>  Any thoughts? I think this may be a better solution than the prior
> discussed solution for overriding horizontally.
>  Ryan
>
--- End Message ---
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Re: Clay isEL and replaceMnemoic

2005-10-31 Thread Ryan Wynn
Sorry, had a mistake in my post. In the example the 2nd component would look
like this.
  
 
 
 

 or another approach would be
 

 On 10/31/05, Ryan Wynn <[EMAIL PROTECTED]> wrote:
>
>  It seems beneficial to allow a mnemonic to be replaced by an EL
> expression. This could be another approach to the 'horizontal override' of
> component subtree and reduce the need to replicate the structure of the
> subtree in children.
>  For example,
>  
>  
>  
>  
>  
>  
> 
>  would allow a component to extend from parent an override the nested
> value of child without duplicating the structure of parent just to override
> a single attribute.
>  
>  Currently, this is supported but only if value = [EMAIL PROTECTED]<[EMAIL 
> PROTECTED]>and valueExpr="
> myBean.property", because the mnemonic replacement is done after the
> determination of whether or not the value isEL and isVB.
>  So to allow for mnemonics to be replaced by #{foo.bar},
> PropertyValueCommand would need to change to do the mnemonic replacement
> before determining isEL and isVB and isEarly.
>  Any thoughts? I think this may be a better solution than the prior
> discussed solution for overriding horizontally.
>  Ryan
>


Clay isEL and replaceMnemoic

2005-10-31 Thread Ryan Wynn
It seems beneficial to allow a mnemonic to be replaced by an EL expression.
This could be another approach to the 'horizontal override' of component
subtree and reduce the need to replicate the structure of the subtree in
children.
 For example,
 
 
 
 
 
 

 would allow a component to extend from parent an override the nested value
of child without duplicating the structure of parent just to override a
single attribute.
 
 Currently, this is supported but only if value = [EMAIL PROTECTED] and
valueExpr="myBean.property", because the mnemonic replacement is done after
the determination of whether or not the value isEL and isVB.
 So to allow for mnemonics to be replaced by #{foo.bar},
PropertyValueCommand would need to change to do the mnemonic replacement
before determining isEL and isVB and isEarly.
 Any thoughts? I think this may be a better solution than the prior
discussed solution for overriding horizontally.
 Ryan


RE: How to get the original URI from taglib?

2005-10-31 Thread Abdullah Jibaly
mapping.getPath() works for me, you just have to find a way to access it in 
your JSP...

you might be able to do that with:

requestScope['org.apache.struts.action.mapping.instance'].path

or better just set it to a variable in your form (reset method) or action.

Regards,
Abdullah

-Original Message-
From: Zsolt [mailto:[EMAIL PROTECTED]
Sent: Sunday, October 30, 2005 12:35 PM
To: Struts Users Mailing List
Subject: How to get the original URI from taglib?


Hi,

How can I figure out the origial URI (from a JSP taglib). I have tried
request.getPathInfo() and request.getRequestURI() but I get wrong values.

For example if my URI was http://localhost:8080/abcdef.do I would like to
get /abcdef.do.

I use tc-5.5.12.

Zsolt



-
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: caching of message resources when using bean:message tag

2005-10-31 Thread Lucas Opara
In fact, when you look at the code of the bean:message tag, it calls 
TagUtils.message(). In the message() method of TagUtils, args is never null, 
because of this piece of code in MessageResources : Object args[] = new Object
[] { arg0, arg1, arg2, arg3, arg4 };

Thus resources.getMessage(userLocale, key, args); is the method that is always 
called even if the arguments are null because the array is never null.

   public String message(
PageContext pageContext,
String bundle,
String locale,
String key,
Object args[])
throws JspException {

MessageResources resources =
retrieveMessageResources(pageContext, bundle, false);

Locale userLocale = getUserLocale(pageContext, locale);
String message = null;
if (args == null) {
//This is never called
message = resources.getMessage(userLocale, key);
} else {
message = resources.getMessage(userLocale, key, args);
}
if ((message == null) && log.isDebugEnabled()) {
// log missing key to ease debugging
log.debug(resources.getMessage("message.resources", key, bundle, 
locale));
}
return message;
}



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