[ANN] Easy Struts 0.6.4 compatible Eclipse 2.1

2003-03-15 Thread Emmanuel Boudrant
Easy Struts 0.6.4 is available, now it's working with both Eclipse 2.0 and Eclipse 
2.1. Here the
changes logs : 

- Eclipse 2.1 Compatible (build with Eclipse 2.1 RC-1) 
- Improve XSLT errors management 
- Improve add Struts support operation 
- Struts config tree is now sorted 
- XML elements message-resources/plug-in respect DTD order 
- Minor fix... 

Planned features for next majors version : 

- Tiles editor (0.7) 
- Refactoring (no completion date) 


http://easystruts.sf.net 
http://easystruts.sourceforge.net/update.html

Thx, 
-emmanuel 


___
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

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



BeanUtils.copyProperties between from and DAO issues

2003-03-15 Thread Dan Allen
I just wanted to see if I am working an uphill battle here or this
is really the reality of the situation.  I think you all might find
this question particularly intriguing.

Assume that my DAO (Data Access Object) is storing a list of ids
which matches with a relationship.  For example sake, it is a list
of Service Ids which coorespond to services available.  I have the
following method definitions

public List setServices(List services) {}

public List getServices() {}

public void setServicesIds(int[] serviceIds) {}

public int[] getServiceIds() {}

In my form a have a mutiple-select which I populate with all the
industries from the database table.  The multiple-select is set as a
java.lang.String[] since all form elements must be of type String
(am I right?)

Now, either I am populating from my form or populating to my form
using BeanUtils.copyProperties().  It would appear as though the
following conversion is failing horribly

int[] -- String[]

and

String[] -- int[]

..since the data never populates or saves (I did change the methods to
using String[] instead of int[] and it worked, so I know the issue
is the datatype, not because I don't know how to setup a form in
struts, I did finally figure that much out).

Short of creating method defintions which take and recieve String[]
arrays or manually iterating the form property in my Action class
and converting them to int[], is there any hope?

rant
Why is is so d*** hard to convert between a string and a primitive
integer in Java???  Damn, in PHP you don't even blink when you have
these two types.
/rant

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
The idea of implementing a serious complex set of business 
logic rules in a scripting language like Perl really scares me. 
Perl is too much 'write once, read never again'. And that's no good 
for business logic that requires maintenance. 
 - voostind
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



[Q] struts-template - I centralized the layout file, but am I missing something?

2003-03-15 Thread Jeff Smith
I have 3 different pages in my test app:
Greet Unauthenticated User, Login and Greet Authenticated User

There is a PageUnauthGreet.jsp, PageAuthGreet.jsp and PageLoginUser.jsp.
Each has an identical structure:

%@ taglib uri='/tags/struts-template' prefix='template' %
template:insert template='/TemplateMain.jsp'
 template:put name='pagename' content='Logon' direct='true'/
 template:put name='header' content='/TileHeader.jsp'/
 template:put name='sidebar' content='/TileSidebar.jsp'/
 template:put name='content' content='FOO.jsp'/
/template:insert

The only difference between the 3 files is the FOO.jsp which loads the
content tile specific for that particular page.
Each one loads a different tile: TileUnauth.jsp, TileAuth.jsp and
FormLogon.jsp

This structure works fine. But it started to bug me that whenever I create a
new page, I had to create the structure.jsp and then the tile.jsp

So then I implemented a MasterLayout.jsp page like this:

%@ taglib uri='/tags/struts-template' prefix='template' %
%@ taglib uri='/tags/struts-bean' prefix='bean' %
bean:parameter id=tilePage name=tilePage/
bean:define id=fullTilePage value='%= tilePage %'/
template:insert template='/TemplateMain.jsp'
 template:put name='pagename' content='Logon' direct='true'/
 template:put name='header' content='/TileHeader.jsp'/
 template:put name='sidebar' content='/TileSidebar.jsp'/
 template:put name='content' content='%=fullTilePage%'/
/template:insert

Now I've been able to get rid of all my structure.jsp files and replace it
with this single MasterLayout.jsp

I can invoke it from the struts-config.xml with an action reference like
this:

 action path=/Logon
 type=org.apache.struts.actions.ForwardAction
 parameter=/MasterLayout.jsp?tilePage=FormLogon.jsp/

So essentially, I can now display any page that follows the standard
structure by writing a single tile for the content section of the page and
then invoking the MasterLayout with a tilePage= parameter to indicate which
tile should be thrown into the content section.

I have two questions:

1) Am I overlooking something that is likely to bite me?

2) Is there a more elegant way to control the filler tile?

In particular, I'm not crazy about the resulting URL line displayed in the
browser location. When I forwarded to the logon success page, I had a nice
url that just said:
http://localhost/MyAppName/LogonSubmit.do

But now that I am redirecting (instead of forwarding - to break the
back-button stomping issue) it shows a much icky-er
http://localhost:/MyAppName/MasterLayout.jsp?tilePage=/TileWelcome.jsp

I can live with it the way it is, but I want to be sure I'm exploiting all
the power there is to be had from the templates and tiles system, the action
forwarding syntax and all of that stuff.

Thanks,
Jefficus


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



Re: [Q] Hierarchy display taglib?

2003-03-15 Thread Arron Bates
No taglib itself, but nested tags will allow the recursion to happen and thus
make the tree. Try this...

http://keyboardmonkey.com/pilotlight

...the JSP Recursion  Trees! part. It should do the trick.


Arron.



 Is there a taglib for presenting hierarchically defined content in a 
 JSP that contains open/close icons etc?
 
 Jefficus
 
 -
 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: include struts pages within a struts page?

2003-03-15 Thread Thomas . Rimmele


 Hello everybody,
 
 Is it possible to include struts pages within a struts page?
 
 Example:
 /showPage.do?pageId=1 shows a navigation. The user of the webpage never
 looks at this page directly but he could.
 
 /showPage.do?pageId=10 shows the home page. Instead of including something
 like 
 /navigation.jsp within page 10,  /showPage.do?pageId=1 is included.
 
 The advantage is, that page 10 doesn't have to know which database
 requests have to be done
 to display page 1. Page 10 simple has to know the url of page 1. The pages
 could be splitted into standalone
 components. If you simply include /navigation.jsp, all database work
 must have been done already.
 
 But this means, that the ActionServlet may be called more than once for
 one request. 
 
 Did anybody do this already?
 Could it cause problems if the controller is passed multiple times per
 request?
 
 
 Greethings,
 
 Thomas Rimmele
 
 
 http://www.swissinfo.org
 


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



design concern

2003-03-15 Thread santhosh
Hello Everybody,

I have one design concern.  In our project we have ejb's.  Now in some modules i have 
only the some sql quries to be executed based on the user search condition.  here 
where should i prepare the sql queries.  should i create in Action class or  session 
bean.

waiting for the reply.

Thanx with regds
santhosh hegde A


Re: [Q] struts-template - I centralized the layout file, but am I missing something?

2003-03-15 Thread Dan Allen

Jeff Smith ([EMAIL PROTECTED]) wrote:

 I have 3 different pages in my test app:
 Greet Unauthenticated User, Login and Greet Authenticated User
 
 There is a PageUnauthGreet.jsp, PageAuthGreet.jsp and PageLoginUser.jsp.
 Each has an identical structure:
 
 %@ taglib uri='/tags/struts-template' prefix='template' %
 template:insert template='/TemplateMain.jsp'
  template:put name='pagename' content='Logon' direct='true'/
  template:put name='header' content='/TileHeader.jsp'/
  template:put name='sidebar' content='/TileSidebar.jsp'/
  template:put name='content' content='FOO.jsp'/
 /template:insert
 
 The only difference between the 3 files is the FOO.jsp which loads the
 content tile specific for that particular page.
 Each one loads a different tile: TileUnauth.jsp, TileAuth.jsp and
 FormLogon.jsp
 
 This structure works fine. But it started to bug me that whenever I create a
 new page, I had to create the structure.jsp and then the tile.jsp
 
 So then I implemented a MasterLayout.jsp page like this:
 
 %@ taglib uri='/tags/struts-template' prefix='template' %
 %@ taglib uri='/tags/struts-bean' prefix='bean' %
 bean:parameter id=tilePage name=tilePage/
 bean:define id=fullTilePage value='%= tilePage %'/
 template:insert template='/TemplateMain.jsp'
  template:put name='pagename' content='Logon' direct='true'/
  template:put name='header' content='/TileHeader.jsp'/
  template:put name='sidebar' content='/TileSidebar.jsp'/
  template:put name='content' content='%=fullTilePage%'/
 /template:insert
 
 Now I've been able to get rid of all my structure.jsp files and replace it
 with this single MasterLayout.jsp
 
 I can invoke it from the struts-config.xml with an action reference like
 this:
 
  action path=/Logon
  type=org.apache.struts.actions.ForwardAction
  parameter=/MasterLayout.jsp?tilePage=FormLogon.jsp/
 
 So essentially, I can now display any page that follows the standard
 structure by writing a single tile for the content section of the page and
 then invoking the MasterLayout with a tilePage= parameter to indicate which
 tile should be thrown into the content section.
 
 I have two questions:
 
 1) Am I overlooking something that is likely to bite me?
 
 2) Is there a more elegant way to control the filler tile?
 
 In particular, I'm not crazy about the resulting URL line displayed in the
 browser location. When I forwarded to the logon success page, I had a nice
 url that just said:
 http://localhost/MyAppName/LogonSubmit.do
 
 But now that I am redirecting (instead of forwarding - to break the
 back-button stomping issue) it shows a much icky-er
 http://localhost:/MyAppName/MasterLayout.jsp?tilePage=/TileWelcome.jsp
 
 I can live with it the way it is, but I want to be sure I'm exploiting all
 the power there is to be had from the templates and tiles system, the action
 forwarding syntax and all of that stuff.

You are on the verge of using tiles, go for it.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
While they're pumping, you're soaking them 
 -- Speed Loader TV Advert
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Re: Validator Indexed Properties

2003-03-15 Thread Vic Cekvenich
It works fine for my clients with 2 diferent patches offered, on dev 
list a long time ago:
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=8798
and attached sollution on May of 2002, almost a year ago, you can search 
the dev list on the topic.

Then there is a 2nd better patch that I kind of stop giving out becuase 
there was to much private traffic:
http://www.mail-archive.com/[EMAIL PROTECTED]/msg55192.html
(one commiter did ask for the 2nd one and I gave it out)

So, it's known bug with a known solution. :-(

.V

Jim Krygowski wrote:
Hey All-

I can't seem to get the validation.xml file configured correctly so that I
can validate indexed properties.   I've done a bunch of Mailing List/Google
searches and come up dry.  I've tried to configure it as suggested by D.
Winterfeldt and P. Ginnaram, but neither approach worked.  I ended up
getting the following useless javascript function rendered:
function DateValidations () {
}
Which as you notice, contains no validations.  I've hard-coded
(field=indexed[0].value) and the javascript rendered worked perfectly.  Of
course that's useless because I don't know how many result may come back.
Matt Raible seemed to be on the same route (note that his emails to the list
post-date Winterfeldt  Ginnaram) but his last email seems to indicate that
he's going to write his own custom javascripts to handle this.
My question is, does the validator handle indexed properties as of
struts-1.1b3 (aka RC1)??? If so, how is it done?  If not, does anyone have a
workaround (Matt if you're listening...)?
Here are a few links to the discussions regarding the validator and indexed
properties:
D. Winterfeldt Thu, 13 Jun 2002
Re: Indexed Property Validation on a String[]
http://www.mail-archive.com/[EMAIL PROTECTED]/msg33752.html
P. Ginnaram Tue, 20 Aug 2002
http://www.mail-archive.com/[EMAIL PROTECTED]/msg38703.html
M Raible
Validating Indexed Properties
17 Dec 2002
http://www.mail-archive.com/[EMAIL PROTECTED]/msg51913.html
Mon, 20 Jan 2003
http://www.mail-archive.com/[EMAIL PROTECTED]/msg54868.html
Tue, 21 Jan 2003
http://www.mail-archive.com/[EMAIL PROTECTED]/msg55133.html
Brandon Goodin Sat, 01 Feb 2003
[Validator] indexed property validation
http://www.mail-archive.com/[EMAIL PROTECTED]/msg56956.html


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


Re: [Q] struts-template - I centralized the layout file, but am Imissing something?

2003-03-15 Thread James CE Johnson
Hi Jeff,

I generally use Tiles to handle these kinds of things.

In your struts-config.xml install the Tiles plugin:
   plug-in className=org.apache.struts.tiles.TilesPlugin 
   set-property property=definitions-config
   value=/WEB-INF/tiles-definitions.xml/
   set-property property=definitions-parser-validate value=true /
   set-property property=moduleAware value=true /
   /plug-in
In your tiles-definitions.xml define your layout and other tiles:
  
tiles-definitions

 definition name=layout path=/WEB-INF/jsp/layout.jsp
   put name=title   value=Portfolio Analytics /
   put name=header  value=/WEB-INF/jsp/header.jsp /
   put name=footer  value=/WEB-INF/jsp/footer.jsp/
   put name=bodyvalue=/WEB-INF/jsp/blank.jsp /
   put name=menuvalue=/WEB-INF/jsp/menus/menuAll.jsp /
 /definition
 
 definition name=welcome extends=layout
  !-- replace the value of body in layout with something 
different  --
 put name=body value=/WEB-INF/jsp/welcome.jsp/
 /definition

/tiles-definitions

Back in struts-config your actions forward to tiles instead of jsps:

 action-mappings
   action path=/index type=some.object.Name
 forward name=success path=welcome/
   /action
 /action-mappings
Finally, your layout.jsp
%@ taglib uri=/WEB-INF/tiles.tld prefix=tiles %
html
 body
   tiles:insert attribute=header/
   tiles:insert attribute=menu/
   tiles:insert attribute=body/
   tiles:insert attribute=footer/
 /body
/html
Hope that helps a bit,
J
Jeff Smith wrote:

I have 3 different pages in my test app:
Greet Unauthenticated User, Login and Greet Authenticated User
There is a PageUnauthGreet.jsp, PageAuthGreet.jsp and PageLoginUser.jsp.
Each has an identical structure:
%@ taglib uri='/tags/struts-template' prefix='template' %
template:insert template='/TemplateMain.jsp'
template:put name='pagename' content='Logon' direct='true'/
template:put name='header' content='/TileHeader.jsp'/
template:put name='sidebar' content='/TileSidebar.jsp'/
template:put name='content' content='FOO.jsp'/
/template:insert
The only difference between the 3 files is the FOO.jsp which loads the
content tile specific for that particular page.
Each one loads a different tile: TileUnauth.jsp, TileAuth.jsp and
FormLogon.jsp
This structure works fine. But it started to bug me that whenever I create a
new page, I had to create the structure.jsp and then the tile.jsp
So then I implemented a MasterLayout.jsp page like this:

%@ taglib uri='/tags/struts-template' prefix='template' %
%@ taglib uri='/tags/struts-bean' prefix='bean' %
bean:parameter id=tilePage name=tilePage/
bean:define id=fullTilePage value='%= tilePage %'/
template:insert template='/TemplateMain.jsp'
template:put name='pagename' content='Logon' direct='true'/
template:put name='header' content='/TileHeader.jsp'/
template:put name='sidebar' content='/TileSidebar.jsp'/
template:put name='content' content='%=fullTilePage%'/
/template:insert
Now I've been able to get rid of all my structure.jsp files and replace it
with this single MasterLayout.jsp
I can invoke it from the struts-config.xml with an action reference like
this:
action path=/Logon
type=org.apache.struts.actions.ForwardAction
parameter=/MasterLayout.jsp?tilePage=FormLogon.jsp/
So essentially, I can now display any page that follows the standard
structure by writing a single tile for the content section of the page and
then invoking the MasterLayout with a tilePage= parameter to indicate which
tile should be thrown into the content section.
I have two questions:

1) Am I overlooking something that is likely to bite me?

2) Is there a more elegant way to control the filler tile?

In particular, I'm not crazy about the resulting URL line displayed in the
browser location. When I forwarded to the logon success page, I had a nice
url that just said:
http://localhost/MyAppName/LogonSubmit.do
But now that I am redirecting (instead of forwarding - to break the
back-button stomping issue) it shows a much icky-er
http://localhost:/MyAppName/MasterLayout.jsp?tilePage=/TileWelcome.jsp
I can live with it the way it is, but I want to be sure I'm exploiting all
the power there is to be had from the templates and tiles system, the action
forwarding syntax and all of that stuff.
Thanks,
Jefficus
-
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: BeanUtils.copyProperties between from and DAO issues

2003-03-15 Thread Vic Cekvenich
Write a util function link longString in here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/src/war/org/apache/scaffoldingLib/util/BUtil.java
You can just say in bean:
List l = getDAOx().getResult();
And now you have a list in you bean, populated by dao.

.V

Dan Allen wrote:
I just wanted to see if I am working an uphill battle here or this
is really the reality of the situation.  I think you all might find
this question particularly intriguing.
Assume that my DAO (Data Access Object) is storing a list of ids
which matches with a relationship.  For example sake, it is a list
of Service Ids which coorespond to services available.  I have the
following method definitions
public List setServices(List services) {}

public List getServices() {}

public void setServicesIds(int[] serviceIds) {}

public int[] getServiceIds() {}

In my form a have a mutiple-select which I populate with all the
industries from the database table.  The multiple-select is set as a
java.lang.String[] since all form elements must be of type String
(am I right?)
Now, either I am populating from my form or populating to my form
using BeanUtils.copyProperties().  It would appear as though the
following conversion is failing horribly
int[] -- String[]

and

String[] -- int[]

...since the data never populates or saves (I did change the methods to
using String[] instead of int[] and it worked, so I know the issue
is the datatype, not because I don't know how to setup a form in
struts, I did finally figure that much out).
Short of creating method defintions which take and recieve String[]
arrays or manually iterating the form property in my Action class
and converting them to int[], is there any hope?
rant
Why is is so d*** hard to convert between a string and a primitive
integer in Java???  Damn, in PHP you don't even blink when you have
these two types.
/rant
Dan



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


max selected options

2003-03-15 Thread Dan Allen
Is there already a validation in place the checks that only a
limited amount of indexed property items are selected?  Consider
either a multi-select box or an indexed set of input fields.  I want
to prevent the user (via manipulation of the form or just regular
use) from being able to populate with more than X number of items.
I guess I could easily add it server side with my own validation
rule, but I was just curious if anyone had anything like it already.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Chaos reigns within. 
Reflect, repent, and reboot.  Order shall return.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Re: BeanUtils.copyProperties between from and DAO issues

2003-03-15 Thread Dan Allen
Right, but I was hoping that perhaps it should do this conversion
itself.  Here's why.  It doesn't make sense for my DAO to be talking
about ids in string format, for that would be out of character,
catering to the view.  There isn't a way (that I know of) to get the
form to populate itself with an array of primitive or lang integers.
So therefore, I am asking, do I have to make my DAO bend over
backwards to fix this hole in the view?  And why can't
copyProperties handle this conversion?  Seems simple to me.

Dan

 Write a util function link longString in here:
 http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/src/war/org/apache/scaffoldingLib/util/BUtil.java
 
 You can just say in bean:
 List l = getDAOx().getResult();
 
 And now you have a list in you bean, populated by dao.
 
 .V
 
 Dan Allen wrote:
  I just wanted to see if I am working an uphill battle here or this
  is really the reality of the situation.  I think you all might find
  this question particularly intriguing.
  
  Assume that my DAO (Data Access Object) is storing a list of ids
  which matches with a relationship.  For example sake, it is a list
  of Service Ids which coorespond to services available.  I have the
  following method definitions
  
  public List setServices(List services) {}
  
  public List getServices() {}
  
  public void setServicesIds(int[] serviceIds) {}
  
  public int[] getServiceIds() {}
  
  In my form a have a mutiple-select which I populate with all the
  industries from the database table.  The multiple-select is set as a
  java.lang.String[] since all form elements must be of type String
  (am I right?)
  
  Now, either I am populating from my form or populating to my form
  using BeanUtils.copyProperties().  It would appear as though the
  following conversion is failing horribly
  
  int[] -- String[]
  
  and
  
  String[] -- int[]
  
  ...since the data never populates or saves (I did change the methods to
  using String[] instead of int[] and it worked, so I know the issue
  is the datatype, not because I don't know how to setup a form in
  struts, I did finally figure that much out).
  
  Short of creating method defintions which take and recieve String[]
  arrays or manually iterating the form property in my Action class
  and converting them to int[], is there any hope?
  
  rant
  Why is is so d*** hard to convert between a string and a primitive
  integer in Java???  Damn, in PHP you don't even blink when you have
  these two types.
  /rant
  
  Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
This is a test of the Emergency Broadcast System.  If this had 
been an actual emergency, do you really think we'd stick around 
to tell you?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



DynaActionForm - html:select example?

2003-03-15 Thread Becky Norum
Does anyone have an example of how to use a DynaActionForm form-property
with a html:select in the associated form?

I'm a little confused - do I have to use a Map to represent the
options?  So I can't just hard-code them in the page?

Thanks!

Becky Norum
[EMAIL PROTECTED]




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



DataSource references in Business Layer

2003-03-15 Thread Guido
Two simple questions.

1. I usally define all the datasources i need in struts-config.xml file.
It is very easy, but how can I obtain a datasource reference in my
business logic classes?

I hate the idea of passing the reference to the business methods and I
don't want to include all my business logic in the Action classes (that is
what i am actually doing)... Maybe it is not possible and I should use
JNDI or something like that instead.

2. What method should I use if ActionServlet.findDataSource(String) is now
deprecated?

Thank you very much,
Guido.

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



[HK] DynaActionForm ?

2003-03-15 Thread harish krishnaswamy
In the following .jsp code, can modelBeans be a
property array in a DynaActionForm (view2SubmitForm in
this case) bean?

logic:iterate id=mb name=view2SubmitForm
property=modelBeans
type=com.agilix.myapp.view.view1.ModelBean2

tr
tdhtml:text name=mb property=id//td
tdhtml:text name=mb property=name
size=50//td
tdhtml:text name=mb property=price//td
/tr

/logic:iterate

I tried the above code, I don't get an error but the
values entered in the text tag never makes it to
ModelBean2 bean.

Also, I see from the BeanUtils docs that the DynaBean
properties can be indexed and mapped, can
DynaActionForm do the same too? If yes, can someone
please point me to resources?

-Harish


__
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

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



Re: DataSource references in Business Layer

2003-03-15 Thread Dan Allen
You will inherit a method from Action called getDataSource() which I
think you should look into.  There is a method in action for just
about every handler you would need, including

getResources()
saveMessages()
saveErrors()
getDataSource()

etc..

Check out the API docs for Action.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
The Linux philosophy is to laugh in face of danger.  Oops. 
Wrong one. 'Do it yourself' That's it 
 -- Linus Torvalds
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Re: DataSource references in Business Layer

2003-03-15 Thread David Graham
You can grab the datasource out of the ServletContext.  Use JNDI or pass the 
DataSource to some ServiceFactory that your business layer can use.

David



From: Guido [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: DataSource references in Business Layer
Date: Sat, 15 Mar 2003 17:22:20 +0100 (MET)
Two simple questions.

1. I usally define all the datasources i need in struts-config.xml file.
It is very easy, but how can I obtain a datasource reference in my
business logic classes?
I hate the idea of passing the reference to the business methods and I
don't want to include all my business logic in the Action classes (that is
what i am actually doing)... Maybe it is not possible and I should use
JNDI or something like that instead.
2. What method should I use if ActionServlet.findDataSource(String) is now
deprecated?
Thank you very much,
Guido.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


_
Tired of spam? Get advanced junk mail protection with MSN 8. 
http://join.msn.com/?page=features/junkmail

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


how to pass the value from FormBean to custom tag

2003-03-15 Thread eizo umeda
hi I am having a trouble with developing a custom tag in struts. 
When I try to get a value which create in the FormBean, I could not 
pass to the value in my custom tag when an action /test is run. 

jsp is looks like this... 
%@ taglib uri=/WEB-INF/customtag.tld prefix=MyCustom %
MyCustom:MyCustom name=fooForm property=value /

form-beans type=org.apache.struts.action.ActionFormBean
   form-bean name=fooForm type=test.LoginForm /
/form-beans
... snip
action path=/test name=fooForm scope=request type=test.LoginAction
/action
...

fooFormBean is the name of form-bean in the struts-config.xml, and 
has setValue method and getValue method. In the MyCustom class, I 
tried to grab the instance of fooBean, which is actually test.LoginForm class.
does anybody has an idea to solve the issue?
Also, i would like to know if there are good pointers which describe to develop 
a custom tag in struts.

Thanks for any help,


eizo umeda  [EMAIL PROTECTED]


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



Re: DataSource references in Business Layer

2003-03-15 Thread Guido
Thank you.  I was searching in ActionServlet class instead of Action.

Now the Eclipse IDE warning singal has disappear and I can sleep again :P

On Sat, 15 Mar 2003, Dan Allen wrote:

} You will inherit a method from Action called getDataSource() which I
} think you should look into.  There is a method in action for just
} about every handler you would need, including
}
} getResources()
} saveMessages()
} saveErrors()
} getDataSource()
}
} etc..
}
} Check out the API docs for Action.
}
} Dan
}
} --
} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
} Daniel Allen, [EMAIL PROTECTED]
} http://www.mojavelinux.com/
} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
} The Linux philosophy is to laugh in face of danger.  Oops.
} Wrong one. 'Do it yourself' That's it
}  -- Linus Torvalds
} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
}
} -
} To unsubscribe, e-mail: [EMAIL PROTECTED]
} For additional commands, e-mail: [EMAIL PROTECTED]
}



Guido Garcia Bernardo
[EMAIL PROTECTED]
[EMAIL PROTECTED]
stat rosa pristina
nomine, nomina nuda tenemus.

http://members.ud.com/services/teams/team.htm?id=D8624419-BFB6-4772-A01A-0045631F979F

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



Re: BeanUtils.copyProperties between from and DAO issues

2003-03-15 Thread Vic Cekvenich
The FormBean can easily be populated by an array.
casting is easy, and done once in a util function.
beanUtils is usefull, but ... maybe not in this case.
Maybe, I am just not getting you question, so someone else jump in.
.V

Dan Allen wrote:
Right, but I was hoping that perhaps it should do this conversion
itself.  Here's why.  It doesn't make sense for my DAO to be talking
about ids in string format, for that would be out of character,
catering to the view.  There isn't a way (that I know of) to get the
form to populate itself with an array of primitive or lang integers.
So therefore, I am asking, do I have to make my DAO bend over
backwards to fix this hole in the view?  And why can't
copyProperties handle this conversion?  Seems simple to me.
Dan


Write a util function link longString in here:
http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/src/war/org/apache/scaffoldingLib/util/BUtil.java
You can just say in bean:
List l = getDAOx().getResult();
And now you have a list in you bean, populated by dao.

.V

Dan Allen wrote:

I just wanted to see if I am working an uphill battle here or this
is really the reality of the situation.  I think you all might find
this question particularly intriguing.
Assume that my DAO (Data Access Object) is storing a list of ids
which matches with a relationship.  For example sake, it is a list
of Service Ids which coorespond to services available.  I have the
following method definitions
public List setServices(List services) {}

public List getServices() {}

public void setServicesIds(int[] serviceIds) {}

public int[] getServiceIds() {}

In my form a have a mutiple-select which I populate with all the
industries from the database table.  The multiple-select is set as a
java.lang.String[] since all form elements must be of type String
(am I right?)
Now, either I am populating from my form or populating to my form
using BeanUtils.copyProperties().  It would appear as though the
following conversion is failing horribly
int[] -- String[]

and

String[] -- int[]

...since the data never populates or saves (I did change the methods to
using String[] instead of int[] and it worked, so I know the issue
is the datatype, not because I don't know how to setup a form in
struts, I did finally figure that much out).
Short of creating method defintions which take and recieve String[]
arrays or manually iterating the form property in my Action class
and converting them to int[], is there any hope?
rant
Why is is so d*** hard to convert between a string and a primitive
integer in Java???  Damn, in PHP you don't even blink when you have
these two types.
/rant
Dan




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


Re: BeanUtils.copyProperties between from and DAO issues

2003-03-15 Thread Dan Allen

 The FormBean can easily be populated by an array.
 casting is easy, and done once in a util function.
 beanUtils is usefull, but ... maybe not in this case.
 Maybe, I am just not getting you question, so someone else jump in.

Let me clarify.  My business object has a signature

public void setIndustryIds(int[] industryIds) {}

my form has a field

field name=industryIds type=java.lang.String[]/

the BeanUtils.copyProperties doesn't see that these two properties
should be linked, it simply doesn't call the setIndustryIds()
method.  Can I do something like

field name=industryIds type=int[]/



Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Since no one can ever know for certain whether or not his own 
view of creation is the correct one, it is impossible for him 
to know if someone else's is the wrong one.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Re: DataSource references in Business Layer

2003-03-15 Thread Dan Allen

Guido ([EMAIL PROTECTED]) wrote:

 Thank you.  I was searching in ActionServlet class instead of Action.
 
 Now the Eclipse IDE warning singal has disappear and I can sleep again :P
Can you sleep for me too?  I have no time for that.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Chaos reigns within. 
Reflect, repent, and reboot.  Order shall return.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



concept: optional fields - NULL

2003-03-15 Thread Dan Allen
Assume a form has a field like so

Age: [   ]

The user decided he/she is too bashful (or maybe just too old) to
fill in the form and bypasses it, which we allow because people are
wierd like that (by the way I am 25 and proud to be whatever age I
am, but I am broke as a bank that just got robbed)

moving on...now all fields are deemed to be type java.lang.String so
the form posts this as  (the empty string object).

Now, assume my database has a field type

int(3) NULL

Naturally, I would want to enter NULL for this user since no one
browsing the web can be of age 0.  How could I get the form-bean to
treat an optional field as NULL if it is empty so that the database
gets the correct value?  Or, do I just have to do this manually?

Dan

p.s. Sorry for all the questions but Struts rocks and I just want to
make it work for what I need since these issues are only petty.

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Personally, I'm not finding Windows 
to be less expensive to administer, 
but those security holes--that'll kill 'em, 
-- Al Gillen, IDC
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



RE: BeanUtils.copyProperties between from and DAO issues

2003-03-15 Thread Ken Connie


-Original Message-
From: Dan Allen [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 9:14 AM
To: Struts Users Mailing List
Subject: Re: BeanUtils.copyProperties between from and DAO issues


Right, but I was hoping that perhaps it should do this conversion
itself.  Here's why.  It doesn't make sense for my DAO to be talking
about ids in string format, for that would be out of character,
catering to the view.  There isn't a way (that I know of) to get the
form to populate itself with an array of primitive or lang integers.
So therefore, I am asking, do I have to make my DAO bend over
backwards to fix this hole in the view?  And why can't
copyProperties handle this conversion?  Seems simple to me.

Dan

 Write a util function link longString in here:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/src/wa
r/org/apache/scaffoldingLib/util/BUtil.java

 You can just say in bean:
 List l = getDAOx().getResult();

 And now you have a list in you bean, populated by dao.

 .V

 Dan Allen wrote:
  I just wanted to see if I am working an uphill battle here or this
  is really the reality of the situation.  I think you all might find
  this question particularly intriguing.
 
  Assume that my DAO (Data Access Object) is storing a list of ids
  which matches with a relationship.  For example sake, it is a list
  of Service Ids which coorespond to services available.  I have the
  following method definitions
 
  public List setServices(List services) {}
 
  public List getServices() {}
 
  public void setServicesIds(int[] serviceIds) {}
 
  public int[] getServiceIds() {}
 
  In my form a have a mutiple-select which I populate with all the
  industries from the database table.  The multiple-select is set as a
  java.lang.String[] since all form elements must be of type String
  (am I right?)
 
  Now, either I am populating from my form or populating to my form
  using BeanUtils.copyProperties().  It would appear as though the
  following conversion is failing horribly
 
  int[] -- String[]
 
  and
 
  String[] -- int[]
 
  ...since the data never populates or saves (I did change the methods to
  using String[] instead of int[] and it worked, so I know the issue
  is the datatype, not because I don't know how to setup a form in
  struts, I did finally figure that much out).
 
  Short of creating method defintions which take and recieve String[]
  arrays or manually iterating the form property in my Action class
  and converting them to int[], is there any hope?
 
  rant
  Why is is so d*** hard to convert between a string and a primitive
  integer in Java???  Damn, in PHP you don't even blink when you have
  these two types.
  /rant
 
  Dan

--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
This is a test of the Emergency Broadcast System.  If this had
been an actual emergency, do you really think we'd stick around
to tell you?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

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



nl2br taglib

2003-03-15 Thread Dan Allen
Are there any taglibs that have an attribute similar to
filter=true for the bean:write that would do nl2br=true

Users enter non-html text and when I display it I want to replace
endline characters with html line break markups so that it preserves
the whitespace.

If not, I guess I will be learning how to do a custom taglib today.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Windows: where do you want your data to disappear to today?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



RE: BeanUtils.copyProperties between from and DAO issues

2003-03-15 Thread Khalid K.
If this is the case, I would think that
org.apache.commons.beanutils.BeanUtils should be modified to do String[]
to int[] conversion ???
Thati s my 2 cents :)
Khalid


-Original Message-
From: Ken  Connie [mailto:[EMAIL PROTECTED] 
Sent: Saturday, March 15, 2003 1:03 PM
To: Struts Users Mailing List
Subject: RE: BeanUtils.copyProperties between from and DAO issues




-Original Message-
From: Dan Allen [mailto:[EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 9:14 AM
To: Struts Users Mailing List
Subject: Re: BeanUtils.copyProperties between from and DAO issues


Right, but I was hoping that perhaps it should do this conversion
itself.  Here's why.  It doesn't make sense for my DAO to be talking
about ids in string format, for that would be out of character,
catering to the view.  There isn't a way (that I know of) to get the
form to populate itself with an array of primitive or lang integers. So
therefore, I am asking, do I have to make my DAO bend over backwards to
fix this hole in the view?  And why can't copyProperties handle this
conversion?  Seems simple to me.

Dan

 Write a util function link longString in here:

http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/basicportal/bP/WEB-INF/sr
c/wa
r/org/apache/scaffoldingLib/util/BUtil.java

 You can just say in bean:
 List l = getDAOx().getResult();

 And now you have a list in you bean, populated by dao.

 .V

 Dan Allen wrote:
  I just wanted to see if I am working an uphill battle here or this 
  is really the reality of the situation.  I think you all might find 
  this question particularly intriguing.
 
  Assume that my DAO (Data Access Object) is storing a list of ids 
  which matches with a relationship.  For example sake, it is a list 
  of Service Ids which coorespond to services available.  I have the 
  following method definitions
 
  public List setServices(List services) {}
 
  public List getServices() {}
 
  public void setServicesIds(int[] serviceIds) {}
 
  public int[] getServiceIds() {}
 
  In my form a have a mutiple-select which I populate with all the 
  industries from the database table.  The multiple-select is set as a

  java.lang.String[] since all form elements must be of type String 
  (am I right?)
 
  Now, either I am populating from my form or populating to my form 
  using BeanUtils.copyProperties().  It would appear as though the 
  following conversion is failing horribly
 
  int[] -- String[]
 
  and
 
  String[] -- int[]
 
  ...since the data never populates or saves (I did change the methods

  to using String[] instead of int[] and it worked, so I know the 
  issue is the datatype, not because I don't know how to setup a form 
  in struts, I did finally figure that much out).
 
  Short of creating method defintions which take and recieve String[] 
  arrays or manually iterating the form property in my Action class 
  and converting them to int[], is there any hope?
 
  rant
  Why is is so d*** hard to convert between a string and a primitive 
  integer in Java???  Damn, in PHP you don't even blink when you have 
  these two types. /rant
 
  Dan

--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel
Allen, [EMAIL PROTECTED] http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - This is a
test of the Emergency Broadcast System.  If this had been an actual
emergency, do you really think we'd stick around to tell you?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

-
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: BeanUtils.copyProperties between from and DAO issues

2003-03-15 Thread Dan Allen

Khalid K. ([EMAIL PROTECTED]) wrote:

 If this is the case, I would think that
 org.apache.commons.beanutils.BeanUtils should be modified to do String[]
 to int[] conversion ???
 Thati s my 2 cents :)

Thank you!!  Me too.  Okay, let's go with this!  Devs?

Also, when doing the conversion, anything which does not parse to an
int should become 0 (naturally you won't attempt the conversion an
expect anything else).

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Hey, somebody, sometime, somewhere, said something I think that 
just maybe might have been true but I think that I maybe 
didn't like it. 
 
F^CK IT, I'm suing everybody. 
 -- slashdot member in response to 
petswarehouse.com sueing google.com
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Re: nl2br taglib

2003-03-15 Thread Anil Amarakoon
No such thing exists. May be you are already doing this on jsp. here we
go..
%
 myString.replace(\n,br);
pageContext.setAttribute(anyName,myString);
%

bean:write name=anyName filter=false

.anil


Dan Allen wrote:

 Are there any taglibs that have an attribute similar to
 filter=true for the bean:write that would do nl2br=true

 Users enter non-html text and when I display it I want to replace
 endline characters with html line break markups so that it preserves
 the whitespace.

 If not, I guess I will be learning how to do a custom taglib today.

 Dan

 --
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Daniel Allen, [EMAIL PROTECTED]
 http://www.mojavelinux.com/
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 Windows: where do you want your data to disappear to today?
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

 -
 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: BeanUtils.copyProperties between from and DAO issues

2003-03-15 Thread Vic Cekvenich
I see where you were going:

#1. Post a request for enhancement in bugzilla for commons.(which will 
CC commons-dev), not in Struts, and not in User.

#2. Wait a while.

#3. Give up waiting, and extend BennUtils to do what you need it to do.

#4. Submit a  enhancement code to BeanUtils bugzila, thus benefiting 
open source.

hth,
.V
Dan Allen wrote:
Khalid K. ([EMAIL PROTECTED]) wrote:


If this is the case, I would think that
org.apache.commons.beanutils.BeanUtils should be modified to do String[]
to int[] conversion ???
Thati s my 2 cents :)


Thank you!!  Me too.  Okay, let's go with this!  Devs?

Also, when doing the conversion, anything which does not parse to an
int should become 0 (naturally you won't attempt the conversion an
expect anything else).
Dan



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


Testing your Struts Application

2003-03-15 Thread Aaron O'Hara
Can anybody point out some good automated testing strategies for
Struts-based applications?

Ideally, I'd like to run automated tests that simulate an end user:
1) filling out a form and testing for success and expected failure
2) clicking on a url that brings up a result set

I know I could unit test some of my business and data layers, but that
leaves out potential run-time errors that may exist in the JSP pages
(like a typo for an html:text property=naame / tag).

I'm really interested to know what automated testing is working for
people, especially for larger web applications with more moving parts.

Aaron



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



Re: Testing your Struts Application

2003-03-15 Thread Jeff Kyser
several previous posts refer to this - might check it out:

http://strutstestcase.sourceforge.net/

-jeff

On Saturday, March 15, 2003, at 04:02  PM, Aaron O'Hara wrote:

Can anybody point out some good automated testing strategies for
Struts-based applications?
Ideally, I'd like to run automated tests that simulate an end user:
1) filling out a form and testing for success and expected failure
2) clicking on a url that brings up a result set
I know I could unit test some of my business and data layers, but that
leaves out potential run-time errors that may exist in the JSP pages
(like a typo for an html:text property=naame / tag).
I'm really interested to know what automated testing is working for
people, especially for larger web applications with more moving 
parts.

Aaron



-
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: nl2br taglib

2003-03-15 Thread Dan Allen
Anil Amarakoon ([EMAIL PROTECTED]) wrote:

 No such thing exists. May be you are already doing this on jsp. here we
 go..
 %
  myString.replace(\n,br);
 pageContext.setAttribute(anyName,myString);
 %
 
 bean:write name=anyName filter=false
 
 .anil

Fine, I'll write a custom taglib, because there is absolutely no
reason that this should be a scriplet.  This is exactly equivalence
in importance in tablib terms as html tag escaping.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
I'm old enough to know better, but still too young to care.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Re: module name problem?

2003-03-15 Thread Eddie Bush
Have you tried it?  It should work fine, AFAIK.  I patched things some 
time ago now to properly process which module is being requested.  The 
change was such that it would allow module names along the lines of what 
you're asking about.

If in doubt; try it.  If it doesn't work (and I really think it should) 
post again and ask for help.  ... and remember:  If you experience 
problems with the tag libraries (or some other part of Struts) not 
knowing which module you're in MAKE SURE YOU ARE CALLING YOUR PAGES WITH 
AN ACTION.  This is a very, very common problem for most folks.  When 
working with modules, it is imperative that you involve the controller 
in the request (since it puts the configuration data for the requested 
module in the request) -- failure to do so will make you feel like you 
are stuck in the default module.

Good Luck!

Navjot Singh wrote:

hi list,

Is it necessary to have module name as  config/mod1
Can it be config/pre/mod1 ?
Has anybody tried something like this before?

Any answer is appreciated.
-Navjot Singh
--
Eddie Bush




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


Re: design concern

2003-03-15 Thread Dan Tran
According to Struts, every thing should go to action. It is a good habit
consistent with MVC2 frameword/pattern.

-Dan

- Original Message -
From: santhosh [EMAIL PROTECTED]
To: 'Struts Users Mailing List' [EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 5:01 AM
Subject: design concern


Hello Everybody,

I have one design concern.  In our project we have ejb's.  Now in some
modules i have only the some sql quries to be executed based on the user
search condition.  here where should i prepare the sql queries.  should i
create in Action class or  session bean.

waiting for the reply.

Thanx with regds
santhosh hegde A

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



Re: design concern

2003-03-15 Thread David Graham
I have one design concern.  In our project we have ejb's.  Now in some
modules i have only the some sql quries to be executed based on the user
search condition.  here where should i prepare the sql queries.  should i
create in Action class or  session bean.
Actions should never contain sql or business logic.  They should execute a 
method on a business layer class like a session bean.

David

_
MSN 8 with e-mail virus protection service: 2 months FREE*  
http://join.msn.com/?page=features/virus

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


[Q] Accessing struts-tiles attribute in a bean?

2003-03-15 Thread Jeff Smith
James and Dan turned me on to tiles. I love them - as I love any tool that
simplifies what I was already doing via brute force. :-)

I feel I'm on the verge of a new level of understanding, but sadly, haven't
quite crossed over.

In my tiles structure, I want to have my pages get their titles from the
application resource.

So I dutifully created a titleKey attribute in my tile-description.xml, like
so:
definition name=StandardLayout path=/Jsps/Templates/TemplateMain.jsp
  put name=titleKey value=some.resource.key/
  put name=header value=/Jsps/Tiles/TileHeader.jsp/
  put name=content value=/Jsps/Tiles/TileWelcome.jsp/
  put name=menu value=/Jsps/Tiles/TileMenu.jsp/
/definition

In my TemplateMain.jsp, I want to take that titleKey and look up the proper
title string from my application resource file.

But I can't figure out how to access the value of the titleKey attribute
into the key field of the bean:message tag.

Is this possible?

One day a light will go on in my head, and I won't feel so confused by all
this. :-)

Jefficus


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



Re: design concern

2003-03-15 Thread Dan Allen

David Graham ([EMAIL PROTECTED]) wrote:

 I have one design concern.  In our project we have ejb's.  Now in some
 modules i have only the some sql quries to be executed based on the user
 search condition.  here where should i prepare the sql queries.  should i
 create in Action class or  session bean.

You should create a search interface on your business layer that
can take generic filters and will interpret them into actual
business queries, whether they be XPath, SQL or some other data
service.  You can really do it however you like, either the simple
route of creating overloaded methods called search() or a series of
methods that talk about the filters you want to setup.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Real programmers don't change their wardrobe too often: there 
are no clothes stores that are open at two o'clock in the morning. 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Collection-backed form properties solution

2003-03-15 Thread harish krishnaswamy
After spending quite sometime on the collection-backed
form properties solution, I figured its worth
mentioning the solution I dug out. I have to say that
the documentation on this one is pretty sparse. Ok
here we go...

I have a jsp that needs to accept an order for items.
This jsp has single-occurence fields like customer
name and address and multi-occurence fields like item
id, item name and item price. The later is the focus
of this message. I have created a plain java bean for
the multi-occurence fileds called ItemBean.

public class ItemBean {
  public ItemBean() {
  }
  public void setId(int id) {
this.id = id;
  }
  public int getId() {
return this.itemId;
  }
  public void setName(String name) {
this.name = name;
  }
  public String getName() {
return this.name;
  }
  public void setPrice(double price) {
this.price = price;
  }
  public double getPrice() {
return this.price;
  }
}

I have created a DynaActionForm bean as follows:

form-bean name=orderForm dynamic=true   
  type=org.apache.struts.action.DynaActionForm
  form-property name=name type=java.lang.String/
  form-property name=address 
type=java.lang.String/
  form-property name=itemBeans 
type=java.util.ArrayList/
  form-property name=event
type=java.lang.String/
/form-bean

And I have a jsp like shown below:

html:form action=view2Submit.do

Name: html:text property=name/nbsp;
Address: html:text property=address/

table

tr
tdId:/td
tdName:/td
tdPrice:/td
/tr

logic:iterate id=itemBeans indexId=idx 
  name=orderForm property=itemBeans 
  type=com.xyz.ItemBean

tr
tdhtml:text name=itemBeans property=id 
  indexed=true//td
tdhtml:text name=itemBeans property=name 
  size=50 indexed=true//td
tdhtml:text name=itemBeans property=price 
  indexed=true//td
/tr

/logic:iterate

tr
tdhtml:submit value=Save 
  onclick=setSubmitEvent('saveActivity');/
/td
tdhtml:submit value=Add 
  onclick=setSubmitEvent('addActivityProperty');/
/td
/tr
/table

html:hidden property=event/

/html:form

Notice that the values of id and property
attributes of the logic:iterate tag are the same.
This is what makes the name of the html text fields to
evaluate to the right format, which is:
itemBeans[n].id for the id field. This itemBeans is
the name of the indexed-property in the form bean. The
event field is used by DispatchAction.

Hope this was helpful to atleast someone.

-Harish

__
Do you Yahoo!?
Yahoo! Web Hosting - establish your business online
http://webhosting.yahoo.com

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



Re: nl2br taglib

2003-03-15 Thread Dan Allen
Attached is a hacked version of WriteTag.java from the struts
library to include a nl2br attribute which will convert \n to br
/ in the output.  It was a pretty simple hack and you can just
update your .tld file to include the java class
net.creativerge.struts.taglib.bean.WriteTag and change your .tld
definition to include the nl2br attribute (just like the filter
attribute) and you will be there.

Someone can feel free to add this to bugzilla, but I have way too
much on my plate right now to put up a fight.

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
This is a test of the Emergency Broadcast System.  If this had 
been an actual emergency, do you really think we'd stick around 
to tell you?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Re: nl2br taglib

2003-03-15 Thread Dan Allen
...see, I'm fading here...trial #2

Dan

[WriteTag.java]

package net.creativerge.struts.taglib.bean;

import javax.servlet.jsp.JspException;

import org.apache.struts.util.RequestUtils;
import org.apache.struts.util.ResponseUtils;

public class WriteTag extends org.apache.struts.taglib.bean.WriteTag
{
protected boolean nl2br = false;

public boolean getNl2br()
{
return nl2br;
}

public void setNl2br(boolean nl2br)
{
this.nl2br = nl2br;
}

public int doStartTag() throws JspException
{
// Look up the requested bean and skip if ignoring and it does not 
exist
if (ignore  (RequestUtils.lookup(pageContext, name, scope) == null))
{
return (SKIP_BODY);
}

// Look up the requested property value
Object value =  RequestUtils.lookup(pageContext, name, property, 
scope);
if (value == null)
{
return (SKIP_BODY);
}

// Convert value to the String with some formatting
String output = formatValue(value);

// filter xml characters if requested
if (filter)
{
output = ResponseUtils.filter(output);
}

// convert endlines to br / tags if requested
if (nl2br)
{
output = output.replaceAll(\n, br /);
}

// Print this property value to our output writer
ResponseUtils.write(pageContext, output);

// Continue processing this page
return (SKIP_BODY);
}
}

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
There is no such thing as a casual knowledge of xslt, either 
you know everything about it or you are sitting in the creek.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Re: design concern

2003-03-15 Thread Dan Tran
oops, I misread the question. Please see the answers from both David and Dan
Alen

- Original Message -
From: Dan Tran [EMAIL PROTECTED]
To: Struts Users Mailing List [EMAIL PROTECTED]
Sent: Saturday, March 15, 2003 4:47 PM
Subject: Re: design concern


 According to Struts, every thing should go to action. It is a good habit
 consistent with MVC2 frameword/pattern.

 -Dan

 - Original Message -
 From: santhosh [EMAIL PROTECTED]
 To: 'Struts Users Mailing List' [EMAIL PROTECTED]
 Sent: Saturday, March 15, 2003 5:01 AM
 Subject: design concern


 Hello Everybody,

 I have one design concern.  In our project we have ejb's.  Now in some
 modules i have only the some sql quries to be executed based on the user
 search condition.  here where should i prepare the sql queries.  should i
 create in Action class or  session bean.

 waiting for the reply.

 Thanx with regds
 santhosh hegde A

 -
 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: nl2br taglib

2003-03-15 Thread Arron Bates
Dan,

I think that you may have better luck in a tag that doesn't actually extend or
particularly work around the write tag, but simply filters the results of body
content. That way your not just restricted to filering the content of a bean
property. Markup would be like...


mylib:nl2br whatever nested:write property=something //mylib:nl2br


...And in this would could get the advantages of nested tags or whatever form
you wanted. It also means you don't have to worry about blocking/supporting
the logic of any underlying tag.


The tag class itself would look like...

// import whatever

public class NL2BR extends BodyTagSupport {
  
  public int doAfterBody() throws JspException {
if (bodyContent != null) {
  String filteredContent = bodyContent.getString();
  
  // filter here...

  ResponseUtils.writePrevious(pageContext, filteredContent);
  bodyContent.clearBody();
}
  }
}


...this should, in theory, do the trick. No properties or anything, simply
filter whatever comes through in the body content.


Arron.


PS: get my mail the other day?...
  email client plays funny buggers at times,
  so I don't know what's sent and what's not.



 ...see, I'm fading here...trial #2
 
 Dan
 
 [WriteTag.java]
 
 package net.creativerge.struts.taglib.bean;
 
 import javax.servlet.jsp.JspException;
 
 import org.apache.struts.util.RequestUtils;
 import org.apache.struts.util.ResponseUtils;
 
 public class WriteTag extends org.apache.struts.taglib.bean.WriteTag
 {
   protected boolean nl2br = false;
 
   public boolean getNl2br()
   {
   return nl2br;
   }
 
   public void setNl2br(boolean nl2br)
   {
   this.nl2br = nl2br;
   }
 
   public int doStartTag() throws JspException
   {
   // Look up the requested bean and skip if ignoring and it does not 
 exist if (ignore  (RequestUtils.lookup(pageContext, name, scope) 
 == null)) {   return (SKIP_BODY); }
 
   // Look up the requested property value
   Object value =  RequestUtils.lookup(pageContext, name, property,
  scope);  if (value == null)  {   return 
 (SKIP_BODY); }
 
   // Convert value to the String with some formatting
   String output = formatValue(value);
 
   // filter xml characters if requested
   if (filter)
   {
   output = ResponseUtils.filter(output);
   }
 
   // convert endlines to br / tags if requested
   if (nl2br)
   {
   output = output.replaceAll(\n, br /);
   }
 
   // Print this property value to our output writer
   ResponseUtils.write(pageContext, output);
 
   // Continue processing this page
   return (SKIP_BODY);
   }
 }
 
 -- 
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 Daniel Allen, [EMAIL PROTECTED]
 http://www.mojavelinux.com/
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 There is no such thing as a casual knowledge of xslt, either 
 you know everything about it or you are sitting in the creek.
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 -
 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:Select box in struts

2003-03-15 Thread Sreepuram, Preshanth
Hi all, 

I just need a help ,how to generate dynamically dropdown , when the options are in a 
hashtable r vector ,
please help me , send me the code which will be useful.

help will be appreciated

regards
prahsanth

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



Re: Select box in struts

2003-03-15 Thread Rick Reumann
On Sat, Mar 15,'03 (11:13 PM GMT-0500), Sreepuram, wrote: 
 
 I just need a help ,how to generate dynamically dropdown , when the
 options are in a hashtable r vector , please help me , send me the
 code which will be useful.

There are tons of examples of this in the archives and in the
documentation...but anyway...:) 

For a Map:

html:select property=yourProperty
html:options collection=someMap property=key
labelProperty=value/
/html:select



For A Collection of FooBar beans:


html:select name=yourFormName property=yourProperty 
html:options collection=nameOfCollectionInScope
property=nameOfaFooBarBeanProperty
labelProperty=nameOfaFooBarBeanProperty/
/html:select


PS - As you progress through Struts keep up an open text document of
things you do so you can refer back to it...that's where I got this
from..my StrutsNotes.txt

-- 
Rick

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



possible bug in html-el

2003-03-15 Thread Dan Allen
I swear I am going to lose my mind over this one.  Same exact code
on two different pages one using html and one using html-el taglib.

logic:messagesPresent
html:messages id=error
licore:out value=${error}//li
/html:messages
/logic:messagesPresent

If I use html-el, I get a jsp error that something is null in the
page and I trace it back to the fact that it is looking running
findAttribute() to find the ActionMessages (in this case errors)
object and does not find it and throws a jsp exception.

If I manually type in the name like so

logic:messagesPresent
html:messages id=error name=org.apache.struts.ERROR
licore:out value=${error}//li
/html:messages
/logic:messagesPresent

Then I get no null and it works.  Somehow, when the tag is
processed, the name is getting set to empty string when it is
excluded, which I just cannot understand.  It is clearly only not
working in html-el

Dan

-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
Daniel Allen, [EMAIL PROTECTED]
http://www.mojavelinux.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
umm... i guess this is my signature. 8-}
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

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



Re: possible bug in html-el

2003-03-15 Thread David M. Karr
 Dan == Dan Allen [EMAIL PROTECTED] writes:

Dan I swear I am going to lose my mind over this one.  Same exact code
Dan on two different pages one using html and one using html-el taglib.

Dan logic:messagesPresent
Dan html:messages id=error
Dan licore:out value=${error}//li
Dan /html:messages
Dan /logic:messagesPresent

Dan If I use html-el, I get a jsp error that something is null in the
Dan page and I trace it back to the fact that it is looking running
Dan findAttribute() to find the ActionMessages (in this case errors)
Dan object and does not find it and throws a jsp exception.

Dan If I manually type in the name like so

Dan logic:messagesPresent
Dan html:messages id=error name=org.apache.struts.ERROR
Dan licore:out value=${error}//li
Dan /html:messages
Dan /logic:messagesPresent

Dan Then I get no null and it works.  Somehow, when the tag is
Dan processed, the name is getting set to empty string when it is
Dan excluded, which I just cannot understand.  It is clearly only not
Dan working in html-el

This was a bug in RC1.  It's fixed in the nightly build.

-- 
===
David M. Karr  ; Java/J2EE/XML/Unix/C++
[EMAIL PROTECTED]   ; SCJP; SCWCD




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