How to minimize security related code in Action classes

2005-10-07 Thread Barnett, Brian W.
Can someone point me to some articles or provide some examples on how to
minimize security related code (authorization) in my Action classes? I am
currently using container-managed, form-based security (Tomcat) for
authentication and  and  elements in
web.xml.

The problem is that I'm not sure how best to have finer grained control of
which roles can do what. For example, I have a UserAction class with methods
that allow edit, add and delete of users. I want some roles to be able to
add and edit but not delete.

The urls might look something like this:
http://www.myapp.com/do/user?Dispatch=add
 
http://www.myapp.com/do/user?Dispatch=edit&id=5
 
http://www.myapp.com/do/user?Dispatch=delete&id=5
 

But web.xml allows url-patterns based on actions:
/do/user/*

So do I have to create a separate Action class for each one so that it is a
different URL? Right now I have code that checks in edit, add and delete
methods inside UserAction to see if the logged in user has the correct role.

Any suggestions would be appreciated.

TIA,
Brian Barnett

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 



RE: database design

2005-10-03 Thread Barnett, Brian W.
Adam,
Does Visio work with MySQL?

-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED] 
Sent: Monday, October 03, 2005 1:31 PM
To: Struts Users Mailing List
Subject: Re: database design


Rafael Taboada on 03/10/05 18:22, wrote:
> Hi folks. When u design a database... What soft do u use?? What's the 
> best??  I use Embarcadero E/R... Is there any program better than 
> embarcadero?
> 

microsoft visio. would use a linux tool but haven't found one. i prefer 
the way visio allows you to route the connections between the tables 
which is important for clarity with lots of tables. oracle's bundled ERD 
software is pants.

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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Change the query parm before forward

2005-09-23 Thread Barnett, Brian W.
Actually, you don't need to do anything in the jsp pages, my bad. See here:

http://forum.java.sun.com/thread.jspa?threadID=656481&messageID=3858400#3858
400

Or just google for "savetoken struts" for more info.


-Original Message-----
From: Barnett, Brian W. 
Sent: Friday, September 23, 2005 1:49 PM
To: 'Struts Users Mailing List'
Subject: RE: Change the query parm before forward


Struts has built in token functionality to prevent the "submit button
pressed twice" problem.

In action class add(), edit(), and delete() methods, or any method that is
preparing to send user to a form for subsequent submittal, add this:
saveToken(request). It's a member of Action.

In jsp page(s), add this:


In action class save() method, add this:
if (!isTokenValid(request)) { //add to ActionErrors }


-Original Message-
From: Lim Hock-Chai [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 23, 2005 1:58 PM
To: Struts Users Mailing List
Subject: RE: Change the query parm before forward


My app uses order item seq# in the query parm to add/update the shopping
cart.  If there is no order item seq#, I simply do add.  However, the
problem occur when user uses the browser back button and press submit again,
this cause my app to add again.  I prefer it to do update.

using session/request attribute might not work for me.  Not sure.  I'm new
to web development.

 

-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Friday, September 23, 2005 2:39 PM
To: Struts Users Mailing List
Subject: Re: Change the query parm before forward


From: "Lim Hock-Chai" <[EMAIL PROTECTED]>

> In my struts config file, I've a initialization action.  If say the
> order
> item
>  sequence# is missing in the query parm, I need to change it to default to
> the next item sequence # before it forward to the actual form.

In your initialization Action, set the form bean property for the sequence 
number to the correct value before you forward to the view.

If it's not a form bean property, you can set it as a request or session 
attribute under a known key.

(Otherwise, what are you doing that requires the sequence number to be a 
request parameter?)

-- 
Wendy Smoak




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



This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Change the query parm before forward

2005-09-23 Thread Barnett, Brian W.
Struts has built in token functionality to prevent the "submit button
pressed twice" problem.

In action class add(), edit(), and delete() methods, or any method that is
preparing to send user to a form for subsequent submittal, add this:
saveToken(request). It's a member of Action.

In jsp page(s), add this:


In action class save() method, add this:
if (!isTokenValid(request)) { //add to ActionErrors }


-Original Message-
From: Lim Hock-Chai [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 23, 2005 1:58 PM
To: Struts Users Mailing List
Subject: RE: Change the query parm before forward


My app uses order item seq# in the query parm to add/update the shopping
cart.  If there is no order item seq#, I simply do add.  However, the
problem occur when user uses the browser back button and press submit again,
this cause my app to add again.  I prefer it to do update.

using session/request attribute might not work for me.  Not sure.  I'm new
to web development.

 

-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED]
Sent: Friday, September 23, 2005 2:39 PM
To: Struts Users Mailing List
Subject: Re: Change the query parm before forward


From: "Lim Hock-Chai" <[EMAIL PROTECTED]>

> In my struts config file, I've a initialization action.  If say the 
> order
> item
>  sequence# is missing in the query parm, I need to change it to default to
> the next item sequence # before it forward to the actual form.

In your initialization Action, set the form bean property for the sequence 
number to the correct value before you forward to the view.

If it's not a form bean property, you can set it as a request or session 
attribute under a known key.

(Otherwise, what are you doing that requires the sequence number to be a 
request parameter?)

-- 
Wendy Smoak




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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Change the query parm before forward

2005-09-23 Thread Barnett, Brian W.
You could try using a Filter. I'm sure there are many tutorials and examples
out there. Here is an example:

Web.xml

MyFilter
com.wss.util.MyFilter
Some description.




MyFilter
/do/*


MyFilter.java

public class MyFilter implements Filter {
private ServletContext context;
private String filterName;

public void init(FilterConfig config) throws ServletException {
this.context = config.getServletContext();
this.filterName = config.getFilterName();
}


public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain)
  throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
HttpServletResponse response = (HttpServletResponse) res;

// Add preprocessing code here. Maybe you could do a
request.setAttribute() and then
// use the value in your Action. You have full access to
everything in the request,
// so you could iterate through the request params and do
your checking.

chain.doFilter(request, response);

// Add code here if we want to do something after the
request has been 
// processed in chain.doFilter().
}

public void destroy() {
// TODO Auto-generated method stub
}
}

-Original Message-
From: Lim Hock-Chai [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 23, 2005 12:00 PM
To: user@struts.apache.org
Subject: Change the query parm before forward


is there a way to change the query parm in the request before forward it?
 
In my struts config file, I've a initialization action.  If say the order
item sequence# is missing in the query parm, I need to change it to default
to the next item sequence # before it forward to the actual form.
 
thanks.
 

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



[OT] HttpSessionListener question - How to get to request object?

2005-09-22 Thread Barnett, Brian W.
Is there a way to get to the request object in an
HttpSessionListener.sessionCreated() method? Specifically, I want to call
request.getRemoteUser() so I know who just created the session.

TIA,
Brian Barnett

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: anyone else pass their ActionForm off to another layer

2005-07-12 Thread Barnett, Brian W.
Page 34 in Core J2EE Patterns 2nd Ed. talks about the problems related to
exposing presentation-tier data structures to the business tier. The main
problem this poses is that it increases the coupling between the tiers and
reduces the reusability of the underlying services. Pages 80-83 discuss some
excellent alternatives.

We recently experienced this when we wanted to expose some of our service
layer classes as web services. There were some instances where we passed the
form object and/or the request object. We had to do some refactoring.

Brian Barnett

-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 12, 2005 9:45 AM
To: Struts Users Mailing List
Subject: anyone else pass their ActionForm off to another layer


I was just replying to a post about keeping your Actions clean and doing 
the business logic in other classes.

One thing I didn't bring up, though, because I'm not sure how 'best 
practice' it is, is the concept of passing your ActionForm and sometimes 
the HttpServletRequest off to another class for some processing. I'm 
doing that a bit in this app I'm currently working on and I'm liking it.

Here are my thoughts. Typically I've dones this kind of stuff in my 
dispatch Action methods

 SomeForm sForm = (SomeForm)form;
 //some validation now possibly
 SomeVO vo = new SomeVO();
 BeanUtils.copyProperties( vo, form );
 service.update( vo );
 //save some success message or error message

The above is quite simple but sometimes there are some other things that 
  have to be done that aren't alway orthodox... ie, maybe having to 
build more than one VO from a form, or maybe some logic looking at 
certain form/request parameters to dictate some slightly altered service 
class method to call. All of this stuff tends to staring bloat the 
Action class which is supposed to mainly be a controller. I've started 
now playing around with pushing some of this off to another class and 
the Action then becomes mostly just responsible for 1) validation 2) 
saving any success or error messages 3) fowarding

So what happens is the Action looks like...

//EmployeeAction
execute(...) or dispatchmethod() {
EmployeForm empForm = (EmployeeForm)form;
//validate form, if success proceed..
boolean success = EmployeeActionHelper.updateEmployee( empForm, 
request );
//messages set up based on success or failure
}

The above hides all the mundane copy form properties to vo and any other 
logic (for example if returning a List you could put that in scope in 
the Helper).

Possibly all of this is overkill, but it came about based on a real use 
case. The situation is when CRUD operations are selected from the form, 
the type of Value Object created and the type of Service that gets 
called is based on a requirement passed in by the form. What gets done 
when the form is submitted can be very different based on the type of 
object being represented when the form submits, so I needed a way to get 
a unique type of Service/Delegate base on the ID. I found it clean to 
isolate all of this from the Action, so the Action method looks like...

update(..) {
MyForm myForm = (MyForm)form;
ServiceFactory.getService( myForm.getTypeID ).update( myForm ); //other
stuff

Now since the correct Service is obtained, it can do the copying of 
proeprties to the unique value object and can call the approrpriate DAO 
that is in that service class.

Anyway, I'm just babbling:)

-- 
Rick

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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: [OT] find out web app path / Quartz Scheduler?

2005-06-24 Thread Barnett, Brian W.
Pass it into the job using the JobDetail object.

JobDetail jobDetail = sched.getJobDetail("FooJob", "FooGroup");

String fooPath = servlet.getServletContext().getRealPath("foo");
jobDetail.getJobDataMap().put("fooPath", fooPath);


-Original Message-
From: Brian McGovern [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 24, 2005 9:29 AM
To: Struts Users Mailing List
Subject: [OT] find out web app path / Quartz Scheduler?


Hi

I've got a struts web app but am running Quartz also.  In some places in my
app I need the servlet to figure out the path under which its running.  I do
that like this.

getServlet().getServletContext().getRealPath("foo");

This returns me my web app path up to the foo directory.


But in my Quartz schedule class that doesnt extent any Action class this
obviously doesnt work.  So how can I get non servlet extended classes to
figure out current directory?

Thanks


 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Eclipse plug-in for Struts

2005-06-22 Thread Barnett, Brian W.
http://www.sysdeo.com/sysdeo/eclipse/tomcatplugin

-Original Message-
From: Tony Smith [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 22, 2005 10:59 AM
To: Struts Users Mailing List
Subject: Eclipse plug-in for Struts


Is there an Eclipse plug-in for Struts or Tomcat so
that I can develop, debug, and test my web app all in
Eclipse? Right now, if I want to change something I
have to write my program in Eclipse, write my jsp in
another text editor, export the jar file from Eclipse
to web-inf/lib, restart Tomcat, and open IE





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

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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Double posting problem [SOLVED]

2005-06-03 Thread Barnett, Brian W.
Well, here's what the problem was.

We added a line of code in our header.jsp tile like this:


There were times when the DistrictLogo was empty, which resulted in html
that looked like this:


This img tag with an empty src attribute caused a request to come into the
Struts controller servlet.

Whew! Glad to have found that one...

-Original Message-
From: Barnett, Brian W. 
Sent: Friday, June 03, 2005 11:49 AM
To: 'Struts Users Mailing List'
Subject: RE: Double posting problem


Thanks woodchuck, but the behavior is happening with any request, not just a
form submit using a button.

In the troubleshooting I've done since the post, I stepped out of the entire
call stack of methods and found out that the second hit on the breakpoint
comes when I step out of CoyoteAdapter.server(Request, Response). We're
using Tomcat 5.0.28. Maybe I'll post on the Tomcat list. I have no idea what
could be going on there ??

-Original Message-
From: Woodchuck [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 03, 2005 11:53 AM
To: Struts Users Mailing List
Subject: Re: Double posting problem


check to see if you are using image buttons  to submit
your forms.

these types of buttons submit your form by default.  if you define
javascript functions for these buttons to do your submitting that would be
the reason for the double submits your getting.  you can get around this
simply by returning false for the event like this:



this way, only your javascript function will be the one submitting.

just something to watch out for.

woodchuck


--- Wendy Smoak <[EMAIL PROTECTED]> wrote:

> From: "Barnett, Brian W." <[EMAIL PROTECTED]>
> 
> > We've spent the last couple of weeks enhancing our web app and now
> every
> > get/post to Tomcat from our web app is coming in twice.
> >
> > Any ideas on what I can check?
> 
> Do you have any Filters?  Check that chain.doFilter(...) is only
> called *once*.
> 
> --
> Wendy Smoak
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 




__ 
Discover Yahoo! 
Use Yahoo! to plan a weekend, have fun online and more. Check it out! 
http://discover.yahoo.com/

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



This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Double posting problem

2005-06-03 Thread Barnett, Brian W.
Thanks woodchuck, but the behavior is happening with any request, not just a
form submit using a button.

In the troubleshooting I've done since the post, I stepped out of the entire
call stack of methods and found out that the second hit on the breakpoint
comes when I step out of CoyoteAdapter.server(Request, Response). We're
using Tomcat 5.0.28. Maybe I'll post on the Tomcat list. I have no idea what
could be going on there ??

-Original Message-
From: Woodchuck [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 03, 2005 11:53 AM
To: Struts Users Mailing List
Subject: Re: Double posting problem


check to see if you are using image buttons  to submit
your forms.

these types of buttons submit your form by default.  if you define
javascript functions for these buttons to do your submitting that would be
the reason for the double submits your getting.  you can get around this
simply by returning false for the event like this:



this way, only your javascript function will be the one submitting.

just something to watch out for.

woodchuck


--- Wendy Smoak <[EMAIL PROTECTED]> wrote:

> From: "Barnett, Brian W." <[EMAIL PROTECTED]>
> 
> > We've spent the last couple of weeks enhancing our web app and now
> every
> > get/post to Tomcat from our web app is coming in twice.
> >
> > Any ideas on what I can check?
> 
> Do you have any Filters?  Check that chain.doFilter(...) is only 
> called *once*.
> 
> --
> Wendy Smoak
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 




__ 
Discover Yahoo! 
Use Yahoo! to plan a weekend, have fun online and more. Check it out! 
http://discover.yahoo.com/

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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Double posting problem

2005-06-03 Thread Barnett, Brian W.
Not using any Filters.

-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 03, 2005 11:24 AM
To: Struts Users Mailing List
Subject: Re: Double posting problem


From: "Barnett, Brian W." <[EMAIL PROTECTED]>

> We've spent the last couple of weeks enhancing our web app and now 
> every get/post to Tomcat from our web app is coming in twice.
>
> Any ideas on what I can check?

Do you have any Filters?  Check that chain.doFilter(...) is only called
*once*.

-- 
Wendy Smoak


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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



Double posting problem

2005-06-03 Thread Barnett, Brian W.
We've spent the last couple of weeks enhancing our web app and now every
get/post to Tomcat from our web app is coming in twice. I can't figure out
what was changed. I have a breakpoint in the execute() method of our
LookupDispatchAction derived base class and all incoming requests come in
twice now.

Form submits come in twice. Simple hrefs, , hit the breakpoint twice...

Any ideas on what I can check?

TIA,
Brian Barnett

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: [OT] Business Layer Ideas

2005-05-27 Thread Barnett, Brian W.
http://www.whitesandsolutions.com/wssBase-Framework%20Architecture.htm
http://www.whitesandsolutions.com/wssBase-Patterns.htm (Two images here. Use
navigation in left frame.)

View the above links with Microsoft Internet Explorer so you can use the pan
and zoom features.


-Original Message-
From: David Whipple [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 27, 2005 2:00 PM
To: Struts Users Mailing List
Subject: [OT] Business Layer Ideas


This is an off topic post, but there seem to be a lot of people with good
opinions here.

I am trying to provide a framework (based on Stuts and Spring) for our
company to use.  I'd like to make a reinforcement of the business layer in
applications.

We do not use EJBs, so a lot of the patterns that are out there do not seem
to apply.  I have not been able to find any references I like.

The goal is to encourage better program design and development by having a
clear definition of what are the business objects in the program.

We want to come up with a way through patterns to help programmers avoid
poor programming practices.  Clear separation into layers is one basic idea
behind this.  We want to come up with some interface to the business layer
which will force programmers to know what are to be the business objects in
their architecture.

Does anyone have any ideas and/or know of any references for this?

Thanks,
Dave


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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: [OT] Open a new browser window when submitting a form

2005-05-24 Thread Barnett, Brian W.
Thanks Frank. Do you know if it's possible to do something like that
conditionally? I have some controls on the form where I want the new browser
window to come up and others where I don't.

-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, May 24, 2005 9:49 AM
To: Struts Users Mailing List
Cc: 'Struts Users Mailing List'
Subject: Re: [OT] Open a new browser window when submitting a form


Sure... simply add the attribute:

target="_new"

to your  tag, and your all set.

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

On Tue, May 24, 2005 11:27 am, Barnett, Brian W. said:
> Is it possible to open a new browser window to display the results, 
> i.e., the response, of a form being submitted? If you've done this, 
> would you please provide an example?
>
> TIA,
> Brian Barnett
>
> **
> **
> This email may contain confidential material.
> If you were not an intended recipient,
> Please notify the sender and delete all copies.
> We may monitor email to and from our network.
>

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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



[OT] Open a new browser window when submitting a form

2005-05-24 Thread Barnett, Brian W.
Is it possible to open a new browser window to display the results, i.e.,
the response, of a form being submitted? If you've done this, would you
please provide an example?

TIA,
Brian Barnett

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: tree structure with struts

2005-05-16 Thread Barnett, Brian W.
Here are some links to tree controls:

http://pragmaticobjects.com/demo.html
http://www.common-controls.com/en/resources/taglib/tags/ctrl_tree.html
http://struts.application-servers.com/ (Struts Layout)
http://www.softcomplex.com/products/tigra_tree_menu/

And then of course, you have Java Server Faces :)

Brian Barnett


-Original Message-
From: pankaj dekate [mailto:[EMAIL PROTECTED] 
Sent: Monday, May 16, 2005 9:36 AM
To: user@struts.apache.org
Subject: tree structure with struts


Hi,

Anyone created a tree structure in struts.
Searched on google and found out Struts Layout lib doing the same.Is this
the only library available or do we need to write custom code for it.

THanks in advance,
pankaj

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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Losing request attributes after validate()

2005-05-06 Thread Barnett, Brian W.
To the action mapping

-Original Message-
From: David Johnson [mailto:[EMAIL PROTECTED] 
Sent: Friday, May 06, 2005 1:52 PM
To: Michael Jouravlev; Struts Users Mailing List
Subject: Re: Losing request attributes after validate()


a I see. Soam I adding scrope="session" to the Form Bean or the Action 
Mapping? 

On 5/6/05, Michael Jouravlev <[EMAIL PROTECTED]> wrote: 
> 
> > I do have redirect="true" set on the actionMapping that brings me to
> this
> > page, and tthe browser should be caching field values.
> >
> > the weird thing is this works in other places
> 
> If you want to keep redirect="true" (I personally prefer redirects for 
> better user experience), then you may want to set scope="session" for 
> your form.
> 
> This should not work in other places. Maybe your other forms have 
> session scope or somehow browser thinks that it can cache those pages?
> 
> > > You need to include hidden files for any static text properties.
> > >
> > > Typically I have  > > />
> > >
> > > NOTE: this should not be done for input fields
> > >
> > >  
> > >
> > I actually am for one of the properties.
> > In the page I have :
> >  and in 
> > the Action Class (right before the reditrct to this page) 
> > request.setAttribute("queryName",queryName);
> > and it shows fine in view--> source.
> > thn if I submit the form (wiuth an error) the hidden field is 
> > **not** populated
> 
> It will not be populated. You redirect to the page, that is, you 
> reload the page from the server using empty GET request with no query 
> parameters. Struts cannot populate your form bean since there is no 
> input data. So it just shows you JSP using current form field values. 
> If your form has request scope, it is recreated for each request, so 
> there are no values in it.
> 
> Do not use hidden fields. You started well using redirection to the 
> View ;-) Just change scope of your form to "session", and it will 
> retain values for you. But now you would have to clean unneeded values 
> in the reset() method. It is a bit of a hassle, but it works better 
> for an end user, and you do not need to pass viewstate in hidden HTML 
> fields.
> 
> Maybe you will find this useful: 
> http://wiki.apache.org/struts/StrutsCatalogRedirectToInputPage
> http://wiki.apache.org/struts/StrutsMultipleActionForms
> 
> Michael.
> 



-- 
-Dave
[EMAIL PROTECTED]

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: [OT] Survey - Tell me what you think about Struts.

2005-05-02 Thread Barnett, Brian W.
I addressed the "stuffing up of any useful CVS functionality" by using
Jalopy source code formatter. http://jalopy.sourceforge.net. The key is for
someone to specify the source code formatting rules, usually the defaults
are close enough for most. Jalopy provides "export" functionality, so all
you have to do is export the settings and distribute the export file to all
of your developers. Run Jalopy on the files before you commit them to CVS
and your problem is resolved.

Brian Barnett

-Original Message-
From: Adam Hardy [mailto:[EMAIL PROTECTED] 
Sent: Sunday, May 01, 2005 2:28 PM
To: Struts Users Mailing List
Subject: Re: [OT] Survey - Tell me what you think about Struts.


On 01/05/05 13:13 Simon Chappell wrote:
>>What is it that bugs you the most about development with Struts?
> 
> Trying to work with the struts-config.xml without a dedicated editor. 
> I have a small, three actions, project that I'm tinkering with and I 
> figured that it was small enough that I didn't need to worry and I 
> could just edit struts-config.xml using a text editor. Ouch.

Dedicated editors are a bane for me. The fact that they automatically 
format the whole file according to their xml whitespace, indenting and 
new line rules means that every line can change when a 2nd developer 
edits the file, which really stuffs up any useful CVS functionality.

My biggest issue with struts is the large number of obtuse servlet 
exceptions or plain empty pages that newbies can cause by doing 
something wrong.

Linked to that is the large amount of definitions in xml where the 
correctness is uncheckable until runtime. One silly typo and I have to 
compile, deploy, restart and navigate into the app to check it works. 
Perhaps there's some junit testing I should be doing to check it all in 
one click, but I haven't worked it out yet.

Adam

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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



[OT] Looking for a tree control tag library

2005-04-29 Thread Barnett, Brian W.
If you know of a good, configurable tree control tag library for use in jsp
pages, please advise.

Thanks,
Brian Barnett

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Popup Windows with Struts Actions

2005-04-05 Thread Barnett, Brian W.
Sorry, I'm a javascript beginner. Can you provide a sample javascript
onclick event?

Thanks...

-Original Message-
From: Wiebe de Jong [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 05, 2005 11:54 AM
To: 'Struts Users Mailing List'
Subject: RE: Popup Windows with Struts Actions



Like this:

CSV

Add the javascript to the onclick event. The first parameter is the action
and the second is the window name. There are some additional optional
parameters that you can add to control the window, etc.

Wiebe de Jong

-Original Message-
From: Dakota Jack [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, April 05, 2005 10:42 AM
To: Frank W. Zammetti
Cc: Struts Users Mailing List
Subject: Re: Popup Windows with Struts Actions

No, have the popup url from the page be a struts action -- popup.do.

Jack

On Apr 5, 2005 10:37 AM, Frank W. Zammetti <[EMAIL PROTECTED]> wrote:
> Not sure what you mean... You mean open the popup from WITHIN an 
> Action?
> 
> --
> Frank W. Zammetti
> Founder and Chief Software Architect
> Omnytex Technologies
> http://www.omnytex.com
> 
> On Tue, April 5, 2005 1:27 pm, Dakota Jack said:
> > Anyone have some code on using JavaScript to open and close popup 
> > windows with a Struts Action?  Thanks.
> >
> > Jack
> >
> > --
> > "You can lead a horse to water but you cannot make it float on its
back."
> > ~Dakota Jack~
> >
> > 
> > -
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> >
> >
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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


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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



RE: Model

2005-03-31 Thread Barnett, Brian W.
Here's a UML class diagram using iBATIS for db access. It might give you a
general idea on how to implement your model layer.
http://www.whitesandsolutions.com/wssBase-Framework%20Architecture.htm (You
have to view it with Internet Explorer if you want to be able to zoom in and
out on the image.)

-Original Message-
From: Ted Husted [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 31, 2005 11:10 AM
To: Struts Users Mailing List; Rafael Taboada
Subject: Re: Model


The MailReader example bundled with Struts 1.2 is a very excellent
demonstration of implementing a model layer. Just substitute something like
iBATIS or Hibernate for the database access.

HTH, Ted.

On Wed, 30 Mar 2005 13:24:18 -0500, Rafael Taboada
<[EMAIL PROTECTED]> wrote:
>  Hi folks.
> 
>  I'm developing on struts and I don't know how to implement model 
> layer.
> 
>  Do u know some sample codes about model layer?.. I was reviewing 
> about DAO in daoexample.sourceforge.net but i'd like to have another 
> material.
> 
>  thanks
> 
> --
> 
>  Rafael Taboada

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

 
This email may contain confidential material. 
If you were not an intended recipient, 
Please notify the sender and delete all copies. 
We may monitor email to and from our network. 


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



[OT] RE: automatic periodic execution of code

2005-02-16 Thread Barnett, Brian W.
Are you trying to configure Quartz in web.xml as a servlet or in
struts-config.xml as a struts plug-in?

We're using Tomcat, not WebSphere, but it seems like we ran into a few
issues trying to run it as a servlet. I don't remember what the issues were,
sorry. 

We ended up running it as a struts plug-in. Here's some sample code:

--snippet from struts-config.xml--
  

--QuartzPlugin class--
public class QuartzPlugin implements PlugIn {
private final static Log log =
LogFactory.getLog(QuartzPlugin.class.getName());
private String SCHOLAR_GROUP = "ScholarGroup";
Scheduler sched;

public void init(ActionServlet servlet, ModuleConfig moduleConfig)
  throws ServletException {
log.info("Quartz starting");

try {
sched = StdSchedulerFactory.getDefaultScheduler();
sched.start();

// Register job listeners with the scheduler
sched.addJobListener(new Stethoscope());

// Get the JobDetail object for our HeartBeatJob
JobDetail jobDetail =
sched.getJobDetail("HeartBeatJob", "ScholarJobGroup");

// Assign the Stethoscope to listen to the heart
beat.
jobDetail.addJobListener(Stethoscope.LISTENER_NAME);

} catch (Exception e) {
log.info("Quartz Scheduler failed to initialize: " +
e.toString());
throw new ServletException(e);
}

log.debug("Quartz started");
}

public void destroy() {
log.info("Quartz stopping");

try {
sched.shutdown();
} catch (SchedulerException ex) {
ex.printStackTrace();
}

sched = null;
}

-Original Message-
From: Gaet [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 16, 2005 2:47 AM
To: Struts Users Mailing List
Subject: Re: automatic periodic execution of code

Hello,

I know it is not the right place but does someone make Quartz works with
Websphere???
I'm trying this since two days and I'm unable to make it worksand I
haven't find a Quartz mailing list...

If somebody has experience and can help me...TIA...

Gaet

- Original Message -
From: "Cedric Levieux" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" 
Sent: Wednesday, February 16, 2005 10:19 AM
Subject: Re: automatic periodic execution of code


> Thanks for the Quartz project, I'll try it. for the moment I've got my own
> Thread Management system but using "standard" is for me a better thing.
>
> I hope that whan I'll stop tomcat Quatrz will shutdown too in a short
time.
>
> Thx,
>
> Cedric
>
> - Original Message -
> From: "Andrew Hill" <[EMAIL PROTECTED]>
> To: "Struts Users Mailing List" 
> Sent: Wednesday, February 16, 2005 6:54 AM
> Subject: Re: automatic periodic execution of code
>
>
> > I think Quartz has been the general consensus most times this has been
> > debated on the list.
> >
> > Sng Wee Jim wrote:
> >
> > > Hi,
> > >
> > >
> > >
> > >
> > > What would be the recommended way to execute some code periodically on
> > > tomcat/appserver?
> > >
> > >
> > >
> > >
> > >
> > > Should I
> > >
> > >
> > > 1. start a thread (not recommended in appserver and tomcat?) and do
> > > it in the run method
> > >
> > > 2. use third party tool like Quartz
> > > 3. or is there existing struts plugin to do it?
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > > - Jim
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >

> > > The information in this email is confidential and is intended solely
> > > for the addressee(s).
> > > Access to this email by anyone else is unauthorized. If you are not
> > > an intended recipient, please notify the sender of this email
> > >
> > > immediately. You should not copy, use or disseminate the
> > >
> > > information contained in the email.
> > > Any views expressed in this message are those of the individual
> > > sender, except where the sender specifically states them to be
> > > the views of Capco.
> > >
> > > http://www.capco.com/
> > >
> > >

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


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


RE: Design pattern for struts.

2005-02-15 Thread Barnett, Brian W.
Struts itself is an example of the Service to Worker Pattern, which is a
macro pattern using a combination of a controller and dispatcher with views
and helpers.

-Original Message-
From: Sandip Khetle [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, February 15, 2005 12:25 AM
To: user@struts.apache.org
Subject: Design pattern for struts.

Hi all

  Can anyone tell me what all design patterns does the struts
framework use.? Does it uses the mediator design pattern?


Thanks in advance

Regards,
Sandip Khetle

-
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: Need guidance in the presentation layer

2005-02-11 Thread Barnett, Brian W.
Have you looked at struts-menu. (http://struts-menu.sourceforge.net)


-Original Message-
From: Vijaya S [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 11, 2005 7:48 AM
To: Struts User mailing List
Subject: Need guidance in the presentation layer

Hi,

I am having the problem of designing my main menu. My main menu (or at least
I have designed like this) has two frames. left frame has  all the options
for the application. The options need to look like a tree structure where
only the top level nodes are displayed. When the user clicks on a node, then
the next level nodes are displayed. I have written an applet for this logic
and is working fine but then I don't know how to connect each of the detail
nodes from this applet to the corresponding jsp's?

Is there any other way of doing this without an applet and frames?

Thanks in advance,
Vijaya




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



Suggestions for providing online help in a struts web app

2005-02-07 Thread Barnett, Brian W.
I've written a couple of Struts web apps where the only online help was a
help icon next to some strategically chosen fields which when hovered over,
produced some rollover help text. One problem I found with this approach was
that if I wanted to provide help on a bunch of controls, the page got
cluttered with help icons. Another problem is that the help text is now
scattered throughout all my jsp pages, so any future attempt to create a
User's Guide of some kind using the help text, would be difficult.

I'm writing another Struts web app where I'd like a full-blown online help
system. By full-blown, I was thinking of a complete User's Guide that could
be viewed in full in a popup page (easy enough) but also an iframe within
the user's browser, probably in a right side bar, that would show a
context-sensitive section of the User's Guide, based on where the user is in
the app. This iframe could be toggled on or off with a Help icon somewhere
on each page.

I guess I'm wondering if there are some best practices for this sort of
thing in Struts, or if there is a plugin, library, etc., for developing
online help.

Thanks,
Brian Barnett

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



RE: Want to know abt patterns in Struts.

2005-02-04 Thread Barnett, Brian W.
Struts itself is an example of the Service to Worker Pattern, which is a
macro pattern using a combination of a controller and dispatcher with views
and helpers.

-Original Message-
From: Akshay Pandit [mailto:[EMAIL PROTECTED] 
Sent: Friday, February 04, 2005 12:45 AM
To: user@struts.apache.org
Subject: Want to know abt patterns in Struts.

Hi to all,

I would like to know how many j2ee patterns does struts framework make use
of. 
And also one more thing, I want to insert  UNICODE data in Database,
I've created the database with unicode support, what changes are
needed on struts end to make the application in UNICODE .

Thanks before Hand

-- 
Warm regards.

Akshay Pandit
Email  : [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: [OT] Re: Another ODBC OT Question

2005-01-27 Thread Barnett, Brian W.
I'm familiar with SQL Server and Oracle, but not MySQL. I suggest you follow
DGraham's search results, or google for MySQL, auto increment, primary keys.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 27, 2005 11:23 AM
To: Struts Users Mailing List
Subject: [OT] Re: Another ODBC OT Question

I googled this: 
http://www.google.com/search?sourceid=navclient&ie=UTF-8&rls=GGLD,GGLD:2004-
11,GGLD:en&q=jdbc+mysql+auto%5Fincrement

and found this: 
http://dev.mysql.com/tech-resources/articles/autoincrement-with-connectorj.h
tml

It was too easy, so it's probably the wrong thing.



Brandon Mercer <[EMAIL PROTECTED]> 
01/27/2005 01:17 PM
Please respond to
"Struts Users Mailing List" 


To
Struts Users Mailing List 
cc

Subject
Re: Another ODBC OT Question






Barnett, Brian W. wrote:

>What rdbms are you using?
> 
>
Sorry, that would have been helpful huh! lol  MySQL Connector/J 
(obviously) 3.0.x.  I think I know how to get the last id... but do I 
create another insert the same way I did the first?
Thanks,
Brandon

-
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: Another ODBC OT Question

2005-01-27 Thread Barnett, Brian W.
What rdbms are you using?

-Original Message-
From: Brandon Mercer [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 27, 2005 10:56 AM
To: Struts Users Mailing List
Subject: Another ODBC OT Question

Hello,
Ok, I've got another off topic question :-P.  That's two in a day!  
Three strikes and I'm out.  lol  Anyhow, I am inserting information into 
a database and I need to get the auto_increment value from my first 
insert and use the value it returns to create an entry in another 
table.  Does anyone have a code snippet that they could show me?  Thanks,
Brandon

-
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: Parse XML Files

2005-01-27 Thread Barnett, Brian W.
JDOM is a nice open-source XML manipulation library.
http://www.jdom.org/

-Original Message-
From: Nelson [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 27, 2005 10:24 AM
To: user@struts.apache.org
Subject: Parse XML Files


Hi Guys,

I'm new to struts and JSP and need to parse and compare XML files. I 
know you can do this with JSTL tags, but wanting to stick to the 
struts framework, I want to seperate my business method from my JSPs. 
Is their a standard way of doing this in struts, maybe using JAXP, or 
should I stick to JSTL?

Thanks



-
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 to determine machine name in a plug-in

2005-01-25 Thread Barnett, Brian W.
Can someone tell me how to determine the machine name of the server from
inside the init() method of a plug-in? It looks like I have an ActionServlet
object and a ModuleConfig object at my disposal.

Thank you,
Brian Barnett

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



RE: Displaytag, number formatting, and sorting

2005-01-06 Thread Barnett, Brian W.
Use a column decorator.



And create your decorator class something like this:

public class MoneyDecorator implements ColumnDecorator {

public MoneyDecorator() {
super();
}

public String decorate(Object value) {
String decoratedValue = "";
try {
if(value != null) {
// Assumes the value is a Double.
decoratedValue =
DataFormatter.formatMoney(((Double)value).toString());
}
} catch (Exception e) {
e.printStackTrace();
decoratedValue = "Format error.";
}
return decoratedValue;
}

}

-Original Message-
From: Andy Engle
To: user@struts.apache.org
Sent: 1/6/2005 6:41 PM
Subject: Displaytag, number formatting, and sorting

Hi all,

I am using displaytag, and I would like to have a sortable column of
large numbers.  I want to format these numbers (they're going to be
dollar amounts, like 1,400.00, 6.99, and the like), but it seems that I
cannot have the fancy number formatting and have that column sortable
all at the same time.  I either get a sortable column of numbers that
look like this:

1400.00
33938.39
3450984530.83
.99

...or a non-sortable column of nicely formatted numbers, like this:

1,400.00
33,938.39
3,450,984,530.83
.99

Has anyone been able to get the number formatting and the sorting to
work together?  If so, please tell me what I'm doing wrong.  I've tried
bean:write with a formatKey, html-el:rewrite, and whatever else to no
avail.

Thank you very much!


Andy


-
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: Security question

2005-01-04 Thread Barnett, Brian W.
Well, I guess I'll proceed with that. Thank you.

-Original Message-
From: Chaikin, Yaakov Y. [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, January 04, 2005 1:55 PM
To: 'Struts Users Mailing List'
Subject: RE: Security question

I don't know of any other way than to programmatically check user's role
inside your Action's method. There is no way to specify attributes in the
 of the . It just doesn't support such
pattern matching.

Yaakov.

-Original Message-
From: Jim Barrows [mailto:[EMAIL PROTECTED]
Sent: Tuesday, January 04, 2005 1:30 PM
To: Struts Users Mailing List
Subject: RE: Security question


> -Original Message-
> From: Barnett, Brian W. [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, January 04, 2005 11:04 AM
> To: 'Struts Users Mailing List'
> Subject: Security question
>
>
> I'm using LookupDispatchAction and role-based security. I
> want to allow
> certain roles to access certain dispatches of an action. I'm
> not sure what
> the best way to handle this is.
>
> Should I create separate Action classes? Is there a slick way
> to specify
> "dispatch level" security in web.xml?

The container managed security is handled by URL.  Which might include
parameters.
If not you'll have to use one of the dispatch that requires a seperate URL
to do this.

Alternatively you'll have to put the security checks inside each method.

>
> Can someone point me to a good article(s) on using role-based
> security in a
> struts app that might address these issues?
>
> Thanks,
> Brian
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

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

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



Security question

2005-01-04 Thread Barnett, Brian W.
I'm using LookupDispatchAction and role-based security. I want to allow
certain roles to access certain dispatches of an action. I'm not sure what
the best way to handle this is.

Should I create separate Action classes? Is there a slick way to specify
"dispatch level" security in web.xml?

Can someone point me to a good article(s) on using role-based security in a
struts app that might address these issues?

Thanks,
Brian

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



RE: ActionMessages problem

2004-12-27 Thread Barnett, Brian W.
Yes, I have the necessary tag libraries imported.

-Original Message-
From: Kishore Senji
To: Struts Users Mailing List
Sent: 12/27/2004 6:40 PM
Subject: Re: ActionMessages problem

Make sure that you have imported the "html" tag library


On Mon, 27 Dec 2004 12:53:27 -0600, Barnett, Brian W.
<[EMAIL PROTECTED]> wrote:
> Hello,
> I'm sure it's something simple, but I can't get my ActionMessage to
display
> in my JSP page.
> 
> Action class code:
> ActionMessages messages = new ActionMessages();
> messages.add(ActionMessages.GLOBAL_MESSAGE, new
> ActionMessage("errors.includedAmountGreaterThanAmountSpecified"));
> saveMessages(request, messages);
> 
> JSP code:
> 
>  id="message" message="true">
> 
> 
> I know the logic:messagesPresent is working because the image is
showing up
> on the page, just not the message.
> 
> What am I missing or doing incorrectly?
> 
> Thanks,
> Brian Barnett
> 
> -
> 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]



ActionMessages problem

2004-12-27 Thread Barnett, Brian W.
Hello,
I'm sure it's something simple, but I can't get my ActionMessage to display
in my JSP page.

Action class code:
ActionMessages messages = new ActionMessages();
messages.add(ActionMessages.GLOBAL_MESSAGE, new
ActionMessage("errors.includedAmountGreaterThanAmountSpecified"));
saveMessages(request, messages);

JSP code:




I know the logic:messagesPresent is working because the image is showing up
on the page, just not the message.

What am I missing or doing incorrectly?

Thanks,
Brian Barnett

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



RE: [OT] Request an app test (free beer!)

2004-12-20 Thread Barnett, Brian W.
On TI-99: Out of memory


-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
Sent: Monday, December 20, 2004 3:26 PM
To: Commons User; Struts User; Tomcat User
Subject: [OT] Request an app test (free beer!)

I was informed last OT post I made that the subject should always 
include the word "beer".  I added the "free" to get your attention :)

I'm working on something for which I need to know what the os.name 
property on various OS's is.  I would greatly appreciate it if some 
folks could try the following:

public class test {
public static void main(String[] args) {
System.out.println(System.getProperty("os.name"));
}
}

I'm particularly interested in various *nix variants, Linux, Mac and 
such.  Windows I already have answers for (although some verification to 
be sure nothing fishy is going on wouldn't hurt).

If you could just post your OS and what the result was, I would greatly 
appreciate it.  Thanks in advance!

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


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

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



RE: [OT - Friday]Corporate Stupidity

2004-12-10 Thread Barnett, Brian W.
Probably when my CEO tried for week to get me to stay at the company instead
of taking another opportunity. I spent about 2 hours a day for week in his
office as he explained why I should stay, comparing the opportunities, my
future, my pay, benefits, etc.

After additional research and a lot of thinking, I decided to leave the
company and take the other opportunity. Two weeks later, I learned that the
CEO reduced everyone in the company to minimum wage because of financial
problems!

I was glad I made the right choice and sickened by the behavior of the CEO.

-Original Message-
From: Jim Barrows [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 10, 2004 1:58 PM
To: Struts User List (E-mail)
Subject: [OT - Friday]Corporate Stupidity

Just found out that the 800lb brass monkeys have decided that it's a good
idea to do full background and checks on all their employees.
Which has got to be the dumbest thing ever been done to me as a contractor
or employee... 

so what's the stupidest thing a company has ever done to 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]



RE: How to disable Enter=Submit on struts form?

2004-11-08 Thread Barnett, Brian W.
What do you want the Enter key to do? Do you want it to move to the next
control, i.e., act like the Tab key?

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 08, 2004 4:54 PM
To: Struts Users Mailing List
Subject: How to disable Enter=Submit on struts form?






Anyone know how to stop a struts form from being submitted when the Enter
key is pressed and focus isn't on the submit button?
(ie I still want Enter to work - I just don't want Enter to equate to
pressing submit).


-
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: Session invalidation problem

2004-11-08 Thread Barnett, Brian W.
Sorry Frank, but I don't see anything. I suspect there is nothing happening
to the session object down in the AccountFB constructor. You probably
already checked that.

Since it is not an easy to duplicate bug, I'd probably scatter some debug
print statements throughout that snippet of code that checks the state of
the session variable and outputs it to the console. Then hammer away, or let
users hammer away. Sometimes something like this isn't possible to do,
though, esp., if it only happens on a production box.

Let us know what the fix is if you are able to find it.

Good luck.

-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 08, 2004 4:40 PM
To: Struts Users Mailing List
Subject: Re: Session invalidation problem

Can do... Remember, this is an inherited app, so don't kill me for 
things done here :)

Here's the execute() method of the Action...

   String path = mapping.getPath();
   ActionForward af = ActionHelpers.actionStart(cat, path, mapping, 
request);
   if (af != null) { return af; }
   HttpSession session = request.getSession();
   String findReceiveDate   = 
(String)request.getParameter("findReceiveDate");
   String findAccountNumber = 
TOAHelpers.strTrim((String)request.getParameter("findAccountNumber"));
   TOAFindAccountActionForm form = new TOAFindAccountActionForm();
   Connection conn = DBConnectionManager.createConnection();
   AccountFB acFB = new AccountFB(session, conn);
   form.setFindReceiveDate(findReceiveDate);
   form.setFindAccountNumber(findAccountNumber);
   session.setAttribute("TOAFindAccountActionForm", form);

... More stuff follows.  Just so you can follow along a bit, this app 
was converted from a non-Struts framework, so they took the past of 
least resistance and wound up not really using some Struts constructs 
properly.  Here, they are creating a form and putting it in session 
because the app has a number of screens that need to be completed before 
a final submission page, at which point they grab all the forms from 
session and process them.  The AccountFB is just a business delegate, 
that DBConnectionManager is a class that deals with everything 
database-related (it's actually not such a bad design when you get to 
know it... at least, things are nicely segregated and organized 
decently, which is more than I can say for many systems I've had the 
displeasure of dealing with).

Anyway, back to some semblence of an on-topic discussion... the 
exception is ocurring on that last line.

And here's the a ActionHelpers.actionStart() method...

 HttpSession session = request.getSession();
 if (!command.equalsIgnoreCase("/app/logon") && 
!command.equalsIgnoreCase("/app/changePassword")) {
   if (session == null || session.getAttribute("sessionAlive") == 
null) {
 request.setAttribute("message", "Your session timed out. 
Please log on again.");
 session.invalidate();
 return mapping.findForward("reload"); // Global forward
   }
 }

... Again, more stuff follows, but I think that's the pertinent piece. 
command is the path passed in, so they're just basically ignoring this 
check when logging on or changing the password, which is logical from 
the app's point of view.  Note that as of this afternoon I added the 
suggested catch of IllegalStateException here, but I wind up executing 
the exact same code you see here in the IF block, minus the call to 
session.invalidate().

So, as I was pointing out before, by the time execution returns from 
actionStart(), I don't see a way there wouldn't be a valid session, and 
hence that getAttribute() call in the Action shouldn't generate an 
IllegalStateException (I could see getting one BEFORE that point, but if 
it gets that far, as near as I can tell, it shouldn't be possible).

Spot anything Brian?  Thanks for your effort!

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

Barnett, Brian W. wrote:
> Hmm. Can you share a bigger snippet of the code, and point out where the
> exception is being thrown? (the 20 lines after)
> 
> -Original Message-
> From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 08, 2004 4:23 PM
> To: Struts Users Mailing List
> Subject: Re: Session invalidation problem
> 
> Yep, I am aware of that.  I in fact call it with just 
> request.getSession().  I should have been clearer... at this point in my 
> code, **based on what I do in the code prior to it**, I am guaranteed to 
> have a session.
> 
> Barnett, Brian W. wrote:
> 
>>You are not guaranteed to have a valid session at this point of your code.
>>It depends on how you retrieved the session 

RE: Session invalidation problem

2004-11-08 Thread Barnett, Brian W.
Hmm. Can you share a bigger snippet of the code, and point out where the
exception is being thrown? (the 20 lines after)

-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 08, 2004 4:23 PM
To: Struts Users Mailing List
Subject: Re: Session invalidation problem

Yep, I am aware of that.  I in fact call it with just 
request.getSession().  I should have been clearer... at this point in my 
code, **based on what I do in the code prior to it**, I am guaranteed to 
have a session.

Barnett, Brian W. wrote:
> You are not guaranteed to have a valid session at this point of your code.
> It depends on how you retrieved the session variable. If you called
> request.getSession() or request.getSession(true), then a session will be
> created for you if the request does not have a valid session. If you call
> request.getSession(false), a session will not be created. In this latter
> case, session will equal null.
> 
> -Original Message-
> From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
> Sent: Monday, November 08, 2004 3:49 PM
> To: Struts Users Mailing List
> Subject: Re: Session invalidation problem
> 
> Another good point, and I'll add code to catch that.  But, as I 
> understand it, session would never be null (not at this point in the 
> code anyway, which is inside an Action) because a session would have 
> been established by now anyway.
> 
> Also, the exception wasn't in this section of code anyway, it actually 
> happens about 20 lines after this.  I'm going to take your suggestion 
> anyway because I like adding checks that don't hurt anything, might save 
> me a headache down the road, but I don't think this will address my 
> initial problem.
> 
> Thanks Luiz!
> 

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


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

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



RE: Session invalidation problem

2004-11-08 Thread Barnett, Brian W.
You are not guaranteed to have a valid session at this point of your code.
It depends on how you retrieved the session variable. If you called
request.getSession() or request.getSession(true), then a session will be
created for you if the request does not have a valid session. If you call
request.getSession(false), a session will not be created. In this latter
case, session will equal null.

-Original Message-
From: Frank W. Zammetti [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 08, 2004 3:49 PM
To: Struts Users Mailing List
Subject: Re: Session invalidation problem

Another good point, and I'll add code to catch that.  But, as I 
understand it, session would never be null (not at this point in the 
code anyway, which is inside an Action) because a session would have 
been established by now anyway.

Also, the exception wasn't in this section of code anyway, it actually 
happens about 20 lines after this.  I'm going to take your suggestion 
anyway because I like adding checks that don't hurt anything, might save 
me a headache down the road, but I don't think this will address my 
initial problem.

Thanks Luiz!

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

Luiz Esmiralha wrote:
> On Mon, 8 Nov 2004 11:52:14 -0800 (PST), [EMAIL PROTECTED]
> <[EMAIL PROTECTED]> wrote:
> 
>>if (session == null || session.getAttribute("sessionAlive") == null) {
>>  request.setAttribute("message", "Your session timed out.  Please log on
again.");
>>  session.invalidate();
>>  return mapping.findForward("reload");
>>}
> 
> 
> Calling session.invalidate() will throw a NullPointerException if
> session == null.
> 
> -
> 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: Session invalidation problem

2004-11-08 Thread Barnett, Brian W.
Session.getAttribute(sessionAlive") will throw an IllegalStateException if
it is called against a session that is invalidated.

Try something like this:

try {
  Session.getAttribute(sessionAlive");
} catch (IllegalStateException e) {
  request.setAttribute("message", "Your session timed out.  Please log on
again.");
// Don't call invalidate(), as it also throws an IllegalStateException when 
// called against a session that is invalidated.
//  session.invalidate();
  return mapping.findForward("reload");
}

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Monday, November 08, 2004 12:52 PM
To: [EMAIL PROTECTED]
Subject: Session invalidation problem

Hello all.  I'm cross-posting this to the Tomcat and Struts lists because
I'm not sure where is more appropriate to post it.

I have an application that is throwing the following sporadic, but
thankfully infrequent, exceptions:

stack trace: java.lang.illegalstateexception: setattribute: session already
invalidated

It is on a call to session.setAttribute().  Here's the weird part... Just
before that method call I do the following:

if (session == null || session.getAttribute("sessionAlive") == null) {
  request.setAttribute("message", "Your session timed out.  Please log on
again.");
  session.invalidate();
  return mapping.findForward("reload");
}

The idea of course is to tell the user their session timed out.  Now, as I
understand it, the session==null portion will always be false because
session is never null, there is always a session associated with the
request, even if it's empty.  That's the reason I put the sessionAlive
attribute in during logon and check if THAT is null with each subsequent
request to indicate whether the session has timed out or not (please keep
the comments about this not being done in the typical way to a minimum...
this is an inherited app I'm dealing with).

Any idea why I might still be seeing that exception?  The verbiage of it is
a little odd and doesn't seem to make sense, especially considering the
check right before that is indicating the session is fine.  I guess it COULD
be timing out between that first check and the call to setAttribute(), but
I'm assuming the container wouldn't invalidate a session that is attached to
a live request, logically that would make sense, so I've more or less
discounted this possibility.  I appreciate any thoughts you may have!

Frank W. Zammetti

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



RE: [validator] How to submit only when ther are no eror

2004-10-07 Thread Barnett, Brian W.
Yes, you can manually do everything that the Struts tag and the
validation.xml file is doing for you.



...



Then you would have to write a validateFooForm javascript function that
validates the fields of your form. Your validateFooForm function should
return true if validation succeeds and false if validation fails.

   } -Original Message-
From: yacout dadoun [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 07, 2004 10:04 AM
To: [EMAIL PROTECTED]
Subject: RE: [validator] How to submit only when ther are no eror

Thanks, but is there a way to do that using jsp jstl  no struts tags  ?


>From: "Barnett, Brian W." <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: 'Struts Users Mailing List' <[EMAIL PROTECTED]>
>Subject: RE: [validator] How to submit only when ther are no eror
>Date: Thu, 7 Oct 2004 10:48:06 -0500
>
>One way to accomplish this is with client side validation. This is 
>dependent
>on scripting being enabled on the browser however.
>
>
>...
>
>
>
>-Original Message-
>From: yacout dadoun [mailto:[EMAIL PROTECTED]
>Sent: Thursday, October 07, 2004 9:49 AM
>To: [EMAIL PROTECTED]
>Cc: [EMAIL PROTECTED]
>Subject: [validator] How to submit only when ther are no eror
>
>Hi,
>I'm using struts1.2.4, using validator, how can i submit teh oage, which
>neans call my bean setter only when therer are norerror genrated by my
>validator? i guess it'll be done in teh Action java file but how? it always
>set the entered values even whne teh input is empty and wich imy validator
>does not allow
>Thanks
>
>_
>MSN(r) Calendar keeps you organized and takes the effort out of scheduling
>get-togethers.
>http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=ht
t
>p://hotmail.com/enca&HL=Market_MSNIS_Taglines
>   Start enjoying all the benefits of MSN(r) Premium right now and get the
>first two months FREE*.
>
>
>-
>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]
>

_
MSN(r) Calendar keeps you organized and takes the effort out of scheduling 
get-togethers. 
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=htt
p://hotmail.com/enca&HL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN(r) Premium right now and get the 
first two months FREE*.


-
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: [validator] How to submit only when ther are no eror

2004-10-07 Thread Barnett, Brian W.
One way to accomplish this is with client side validation. This is dependent
on scripting being enabled on the browser however.


...



-Original Message-
From: yacout dadoun [mailto:[EMAIL PROTECTED] 
Sent: Thursday, October 07, 2004 9:49 AM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: [validator] How to submit only when ther are no eror

Hi,
I'm using struts1.2.4, using validator, how can i submit teh oage, which 
neans call my bean setter only when therer are norerror genrated by my 
validator? i guess it'll be done in teh Action java file but how? it always 
set the entered values even whne teh input is empty and wich imy validator 
does not allow
Thanks

_
MSN(r) Calendar keeps you organized and takes the effort out of scheduling 
get-togethers. 
http://join.msn.com/?pgmarket=en-ca&page=byoa/prem&xAPID=1994&DI=1034&SU=htt
p://hotmail.com/enca&HL=Market_MSNIS_Taglines 
  Start enjoying all the benefits of MSN(r) Premium right now and get the 
first two months FREE*.


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



Best Practice for Struts app to .NET Web Service

2004-10-06 Thread Barnett, Brian W.
I have a Struts app that needs to communicate with a .Net web service via
SOAP. What is "best practice" for this? Can someone point me to some
relevant info?

Thanks,

Brian Barnett



RE: Scheduling Actions

2004-10-01 Thread Barnett, Brian W.
Try Quartz. I posted yesterday regarding Quartz and Struts. Weibe de Jong
replied with some excellent ideas on how to use the Quartz scheduler with
Struts and included some nice code to get you started.

-Original Message-
From: Ciaran Hanley [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 01, 2004 6:49 AM
To: Struts User Mailing List
Subject: OT: Scheduling Actions

Hi,

 

I have several actions in my struts webapp that require a user to manually
click a form button to carry out the action, e.g. update database. I want to
be able to schedule these actions to be carried out at a set time daily
without any user intervention. I am looking for suggestions on what ways
that this can be accomplished?

 

Thanks,

Ciaran

  _  


Ciaran Hanley

Software Development

Sentenial Ltd.

Tel: 00 353 (1) 629 2141
Fax: 00 353 (1) 629 2147

Mob: 00 353 (0) 87 916 4943
E-Mail: [EMAIL PROTECTED]

Web: www.sentenial.ie   

  

  _  

Notice:

The information in this e-mail is intended only for the named recipient and
may be privileged or confidential. If you are not the intended recipient,
please notify us immediately and do not copy, distribute or take any action
based on this e-mail. Sentenial Ltd will not be liable for direct, special,
indirect or consequential loss as a result of any virus being passed on or
arising from alteration of the contents of this e-mail by a third party. All
e-mail sent to or from this address is subject to archive and review by
someone other than the intended recipient. Any opinions expressed in this
e-mail are those of the individual and not necessarily those of Sentenial
Ltd. All Personal Data acquired by Sentenial Ltd for which the Data
Protection Act 1998 ("the Act") applies shall be stored and processed in
accordance with the Act. Should you wish to check, amend or remove the
details of your Personal Data held by Sentenial Ltd, please contact us at
 [EMAIL PROTECTED]

 

 


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



RE: Inicialiazing a LookupDispachAction

2004-10-01 Thread Barnett, Brian W.
Turn off validation in struts-config by setting validate="false". Then you
call validate manually in your save method, which is typically where you
would want validation code.

-struts-config snippet-










-save method in action class-
public ActionForward save(ActionMapping mapping, 
ActionForm form,
HttpServletRequest request, 
HttpServletResponse response) throws ServiceException {

ActionErrors errors;
MyForm myForm = (MyForm) form;
errors = myForm.validate(mapping, request);

if (errors.isEmpty()) {
// save to database ...
return mapping.findForward(Constants.SAVED);
} else {
saveErrors(request, errors);
return mapping.findForward(Constants.VALIDATIONERROR);
}
}

-Original Message-
From: Gabriel França Campolina [mailto:[EMAIL PROTECTED] 
Sent: Friday, October 01, 2004 6:44 AM
To: [EMAIL PROTECTED]
Subject: Inicialiazing a LookupDispachAction

Hi Folks,

I have a action-mapping that mapping a Action named ProdutoAction that
extends LookupDispachAction and have 3 methods into: start, delete,
save. I'd like inicialized my form  with values of my dataBase request
the method start. With ActionForm I can do, but I was used the
DynaValidatorForm and Validator. And When I request the url
.../produto.do?method=start, it validate my form and call the my input
attribute, How I call a method in LookupDispachAction without
validate?

Thanks,

Sorry Daniel, I don't more post my messages in portuguese

-- 
Gabriel França Campolina
Tel: 9202-8320

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

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



RE: Struts and Quartz Scheduler

2004-09-30 Thread Barnett, Brian W.
Thanks Wiebe. I saw your name on a post or two in the Quartz forum and was
hoping you'd respond to this here. I really appreciate it!

Brian Barnett

-Original Message-
From: Wiebe de Jong [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 30, 2004 12:28 PM
To: 'Struts Users Mailing List'; 'Thomas Vogt'
Subject: RE: Struts and Quartz Scheduler

Starting Quartz from a servlet is not a good idea, use a Plugin instead.

Reason:

I am running on the JBoss application server, and the threads that Quartz
creates on startup are attached to the app server when using the servlet
method. Everything works fine, but when your webapp is shutdown, the threads
keep going. The threads do not stop until the app server is stopped. So, if
you do a hot deploy (just replace the .ear) of your application, which I do
quite often during development, you'll end up with multiples of your jobs
executing at the same time.

Using plugin:

If you use a Struts plugin, the threads stop when the webapp stops, even
when doing hot deploys. In the plugin, the init() method gets called once
when Struts starts up and the destroy() method gets called once when Struts
shuts down. 

In my code below, I am called jobs implemented as stateless session beans.
Your jobs might be implemented differently.

Code:

Web.xml: 
Nothing here because you are not using a servlet

Struts-config.xml:
Add this line:

  

QuartzPlugin.java:

package com.mycompany.myapp;

import javax.servlet.*;
import javax.servlet.http.*;
import org.apache.commons.logging.*;
import org.apache.struts.action.*;
import org.apache.struts.config.*;

import org.quartz.*;
import org.quartz.impl.StdSchedulerFactory;
import org.quartz.jobs.ee.ejb.EJBInvokerJob;

import java.util.*;

public class QuartzPlugin implements PlugIn {

  private static Log log = LogFactory.getLog(QuartzPlugin.class);

  private String ECOM_GROUP = "eComGroup";

Scheduler sched;

  public void init(ActionServlet servlet, ModuleConfig moduleConfig)
throws ServletException {

log.info("Quartz starting");

//  Scheduler sched;
try {
  sched = StdSchedulerFactory.getDefaultScheduler();
  sched.start();
} catch (Exception e) {
  log.info("Quartz Scheduler failed to initialize: " + e.toString());
  throw new ServletException(e);
}

log.info("Initializing jobs...");

addJob(sched, "Heartbeat", "HeartbeatJob", "execute", "0 0/15 * * * ?");
// every 15 minutes
addJob(sched, "ExpiredTrial", "ExpiredTrialJob", "execute", "0 0 20/24 *
* ?"); // every day at 8pm

log.debug("Quartz started");  
  }

  private void addJob(Scheduler sched, String jobName, String jndiName,
String methodName, String timing) {
JobDetail jd = new JobDetail(jobName, ECOM_GROUP, EJBInvokerJob.class);
jd.getJobDataMap().put(EJBInvokerJob.EJB_JNDI_NAME_KEY, jndiName);
jd.getJobDataMap().put(EJBInvokerJob.EJB_METHOD_KEY, methodName);
Object[] jdArgs = new Object[0];
jd.getJobDataMap().put("args", jdArgs);
CronTrigger cronTrigger = new CronTrigger(jobName, ECOM_GROUP);   
try {
  cronTrigger.setCronExpression(timing);
  sched.scheduleJob(jd, cronTrigger);
} catch (Exception e) {
  e.printStackTrace();
}
  }
  
  public void destroy() {
log.info("Quartz stopping");

try {
sched.shutdown();
} catch (SchedulerException ex) {
ex.printStackTrace();
}
sched = null;
  }

}


I think I'll put this into my blog.

Wiebe de Jong
http://frontierj.blogspot.com/


-Original Message-
From: Thomas Vogt [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 29, 2004 10:08 PM
To: Struts Users Mailing List
Subject: AW: Struts and Quartz Scheduler

You need a class to be executed as Job

public final class BerechnungsJob implements Job
{
 /* (Kein Javadoc)
  * @see org.quartz.Job#execute(org.quartz.JobExecutionContext)
  */
 public void execute(JobExecutionContext context) throws
JobExecutionException
 {
...
 }
}

and you need a servlet that looks like this to init the Job Trigger

32  /***
33   * Die Klasse dient als Listener für den Servlet Container um den Timer
im Hintergrund laufen zu lassen.
34   *
36   * @version Version 1.0 27.08.2004
37   */
38  
39  public class TimerServlet implements Servlet
40  {
41  
42  /***
43   * @see javax.servlet.Servlet#init(ServletConfig)
44   */
45  public void init(ServletConfig arg0) throws ServletException
46  {
47  SchedulerFactory schedFact = new
org.quartz.impl.StdSchedulerFactory();
48  JobDetail jobDetail = new JobDetail("Calculation Timer",
"Calculation Timer", BerechnungsJob.class);
49  CronTrigger trigger = new CronTrigger("Calculation Timer",
"Calculation Timer");
50  
51  try
52  {
53  trigger.setCronExpression("0 0/5 * * * ?");
54  Scheduler sch

RE: html error handling

2004-09-30 Thread Barnett, Brian W.
Can you show us your jsp code?

-Original Message-
From: Shahin Hadjikuliev [mailto:[EMAIL PROTECTED] 
Sent: Thursday, September 30, 2004 6:32 AM
To: [EMAIL PROTECTED]
Subject: html error handling

Hi, 
I have jsp with  tag, if an error accures its displaying
only error message , I want to display error and html form under it,
how can I achive it?

Thanx

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



Struts and Quartz Scheduler

2004-09-29 Thread Barnett, Brian W.
Has anyone here integrated Quartz with Struts? I'm having a hard time
finding examples on this combination.

I'm using the latest version of Quartz, 1.4.2, and I'm initializing it in
web.xml like this:



QuartzInitializer
 

Quartz Initializer Servlet
 

org.quartz.ee.servlet.QuartzInitializerServlet
 

1


shutdown-on-unload
true

  

Anything you could share with me would be greatly appreciated. If you have a
quartz.properties file you could share, info on how you access the
QuartInitializerServlet, submit jobs, etc., I'd love to see them. Sample
code would be great.

If you know of a good document that explains it, please let me know about
it.

Thanks a bunch,
Brian Barnett

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



RE: [SOLVED] Validation problem - form still submits after client -side validat ion fails.

2004-09-20 Thread Barnett, Brian W.
Thanks for your input bmf5 and Hubert. For those interested, here are some
code snippets that worked for me:


...

...


 
<!--
function validateMe(thisForm) {
if (validateMyForm(thisForm)) {
document.forms[0].Dispatch.value='Save';
document.forms[0].submit();
} else {
return false;
}
}
-->


The above code allowed for both client and server-side validation, when
client-side validation failed the form did not get submitted, allowed images
for submit button, and allowed "enter" key to submit the form.

Brian Barnett


-Original Message-
From: Hubert Rabago [mailto:[EMAIL PROTECTED] 
Sent: Monday, September 20, 2004 3:59 PM
To: Struts Users Mailing List
Subject: Re: Validation problem - form still submits after client-side
validat ion fails.

I could be wrong, and i don't have the time to verify this with code
right now, but it's possible that the reason the form still gets
submitted is because you're calling form.submit() directly.  That
might be bypassing the onsubmit="return validateMyForm(this)".  You
*do* have that, right?  I don't know how to do what you're trying to
do with image buttons, though.  For that, you'll probably want Mike
McGrady's opinion since he works with image buttons a lot.

Do you have to call submit() explicitly?

Hubert

On Mon, 20 Sep 2004 15:51:55 -0500, Barnett, Brian W.
<[EMAIL PROTECTED]> wrote:
> Both the client-side and the server-side validation are executing instead
of
> just the client-side. I know it has something to do with the way I've
coded
> the save button. The underlying problem is that I want to use images and
> roll-over images for the save button but I also want the "enter" key to
> submit the form.
> 
> Here is the save button code in the jsp:
> 
> 
onclick="document.forms[0].Dispatch.value='Save';document.forms[0].submit();
> " src="/images/btn_primary_action_save.gif" align="right"
> onmouseover="src='/images/btn_primary_action_save_roll.gif'"
> onmouseout="src='/images/btn_primary_action_save.gif'"/>
> 
> The roll-over images works, and the "enter" key works but it looks like
the
> form still gets submitted after client-side validation fails. Does anyone
> know how to prevent that and still maintain images and "enter" key
> functionality?
> 
> Thanks,
> 
> Brian Barnett
> 
>

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



Validation problem - form still submits after client-side validat ion fails.

2004-09-20 Thread Barnett, Brian W.
Both the client-side and the server-side validation are executing instead of
just the client-side. I know it has something to do with the way I've coded
the save button. The underlying problem is that I want to use images and
roll-over images for the save button but I also want the "enter" key to
submit the form.

 

Here is the save button code in the jsp:

 



 

The roll-over images works, and the "enter" key works but it looks like the
form still gets submitted after client-side validation fails. Does anyone
know how to prevent that and still maintain images and "enter" key
functionality?

 

Thanks,

Brian Barnett



RE: [OT] synchronous form submit in a popup so parent ref reshes p rope rly

2004-09-10 Thread Barnett, Brian W.
Thanks Paul. It works like a cha rm.

-Original Message-
From: Paul McCulloch [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 10, 2004 10:42 AM
To: 'Struts Users Mailing List'
Subject: RE: [OT] synchronous form submit in a popup so parent refreshes p
rope rly

You could make the response from the submit be an html page which executes
the relevant (parent.reload; close) Javascript. 

Alternatively you could submit the form on the popup window so that the
response of this submission was displayed in the parent window (via the
'target' attribute of the form tag). You'd want to define the forward for
this action to be the refresh action you want your parent to perform.

Paul

> -Original Message-----
> From: Barnett, Brian W. [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 10, 2004 5:19 PM
> To: '[EMAIL PROTECTED]'
> Subject: [OT] synchronous form submit in a popup so parent 
> refreshes prope rly
> 
> 
> I have a popup with a save button that works like this:
> 
>  
> 
> onclick="document.forms[0].Dispatch.value='Save';document.form
> s[0].submit();
> window.opener.location.reload(true);window.close();"
> 
>  
> 
> The problem is that the parent window gets refreshed before the submit
> finishes what it needs to finish, i.e., write stuff to the 
> db. I want the
> parent window to be refreshed after the submit has finished. 
> What are some
> ways I can try to make sure the submit finishes before the 
> parent window
> gets updated?
> 
>  
> 
> Thanks,
> 
> Brian Barnett
> 
> 


**
Axios Email Confidentiality Footer
Privileged/Confidential Information may be contained in this message. If you
are not the addressee indicated in this message (or responsible for delivery
of the message to such person), you may not copy or deliver this message to
anyone. In such case, you should destroy this message, and notify us
immediately. If you or your employer does not consent to Internet email
messages of this kind, please advise us immediately. Opinions, conclusions
and other information expressed in this message are not given or endorsed by
my Company or employer unless otherwise indicated by an authorised
representative independent of this message.
WARNING:
While Axios Systems Ltd takes steps to prevent computer viruses from being
transmitted via electronic mail attachments we cannot guarantee that
attachments do not contain computer virus code.  You are therefore strongly
advised to undertake anti virus checks prior to accessing the attachment to
this electronic mail.  Axios Systems Ltd grants no warranties regarding
performance use or quality of any attachment and undertakes no liability for
loss or damage howsoever caused.
**


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

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



[OT] synchronous form submit in a popup so parent refreshes prope rly

2004-09-10 Thread Barnett, Brian W.
I have a popup with a save button that works like this:

 

onclick="document.forms[0].Dispatch.value='Save';document.forms[0].submit();
window.opener.location.reload(true);window.close();"

 

The problem is that the parent window gets refreshed before the submit
finishes what it needs to finish, i.e., write stuff to the db. I want the
parent window to be refreshed after the submit has finished. What are some
ways I can try to make sure the submit finishes before the parent window
gets updated?

 

Thanks,

Brian Barnett



RE: [OT] "Enter" key listener for form submittal

2004-09-01 Thread Barnett, Brian W.
I had a problem where I wanted to use images as the buttons on forms, but
then I lost the "enter" key and "spacebar" functionality. I ended up doing
this to solve it.



I use the syntax above for the "default" button on the form and leave the
other buttons 

Don't know if something like this would work in your situation though. It
works in IE and Netscape.

-Original Message-
From: Erik Weber [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 01, 2004 9:34 AM
To: Struts Users Mailing List
Subject: Re: [OT] "Enter" key listener for form submittal

It is necessary in my case because it is a requirement specified by the 
client. On very simple forms, it often won't require any programming. 
But if you have multiple submit buttons, it becomes a problem.

Erik


Barnett, Brian W. wrote:

>Out of curiosity, why is an enter key listener necessary in order to submit
>a form?
>
>-Original Message-
>From: Erik Weber [mailto:[EMAIL PROTECTED] 
>Sent: Wednesday, September 01, 2004 9:18 AM
>To: Struts Users Mailing List
>Subject: Re: [OT] "Enter" key listener for form submittal
>
>
>
>David Durham wrote:
>
>  
>
>>Erik Weber wrote:
>>
>>
>>
>>>I found this JavaScript, which is supposed to listen for the "Enter" key
>>>on any browser (and submit the form on keypress). However, it doesn't
>>>seem to be working in IE:
>>>
>>>
>>>if (document.layers) document.captureEvents(Event.KEYDOWN);
>>>document.onkeydown =
>>>function (evt) {
>>>var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : evt.keyCode;
>>>if (keyCode == 13) {
>>>document.forms[0].submit();
>>>}
>>>}
>>>
>>>
>>>
>>>Does anyone have an "Enter" key listener that has been shown to work in
>>>all browsers, or know what is wrong with this one?
>>>  
>>>
>>Consider returning false in order to halt the normal event 
>>propagation.  It may be that you are triggering the right form, but 
>>the "enter" event is being passed on and submitting the cancel button.
>>
>>
>
>
>Thanks, I will try that.
>
>  
>
>>Also, does document.forms[0].submit() trigger the submit with a submit 
>>value of cancel?  Does that make since?
>>
>>
>
>
>Hmm, would it not fail also on Mozilla if that were true?
>
>Thanks,
>Erik
>
>
>  
>
>>- Dave
>>
>>
>>
>>
>>
>>
>>
>>>Thanks,
>>>Erik
>>>
>>>-
>>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>>For additional commands, e-mail: [EMAIL PROTECTED]
>>>
>>>
>>> 
>>>
>>>  
>>>
>>-
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>  
>

-
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: [OT] "Enter" key listener for form submittal

2004-09-01 Thread Barnett, Brian W.
Out of curiosity, why is an enter key listener necessary in order to submit
a form?

-Original Message-
From: Erik Weber [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 01, 2004 9:18 AM
To: Struts Users Mailing List
Subject: Re: [OT] "Enter" key listener for form submittal



David Durham wrote:

> Erik Weber wrote:
>
>> I found this JavaScript, which is supposed to listen for the "Enter" key
>> on any browser (and submit the form on keypress). However, it doesn't
>> seem to be working in IE:
>>
>> 
>> if (document.layers) document.captureEvents(Event.KEYDOWN);
>> document.onkeydown =
>> function (evt) {
>> var keyCode = evt ? (evt.which ? evt.which : evt.keyCode) : evt.keyCode;
>> if (keyCode == 13) {
>> document.forms[0].submit();
>> }
>> }
>> 
>>
>>
>> Does anyone have an "Enter" key listener that has been shown to work in
>> all browsers, or know what is wrong with this one?
>
>
> Consider returning false in order to halt the normal event 
> propagation.  It may be that you are triggering the right form, but 
> the "enter" event is being passed on and submitting the cancel button.


Thanks, I will try that.

>
> Also, does document.forms[0].submit() trigger the submit with a submit 
> value of cancel?  Does that make since?


Hmm, would it not fail also on Mozilla if that were true?

Thanks,
Erik


>
>
> - Dave
>
>
>
>
>
>> Thanks,
>> Erik
>>
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>  
>>
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

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

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



[OT] File IO

2004-08-26 Thread Barnett, Brian W.
Hello,
Can someone point me to, or show me some sample java code, that opens,
reads, writes files using the relative path of the web application?

Thanks

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



RE: [OT]1,2,3,4 I declare a pun war!

2004-08-18 Thread Barnett, Brian W.
That was a b-d one.

-Original Message-
From: Jim Barrows [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, August 18, 2004 3:56 PM
To: Struts Users Mailing List
Subject: RE: [OT]1,2,3,4 I declare a pun war!



> -Original Message-
> From: David Durham [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 18, 2004 2:54 PM
> To: Struts Users Mailing List
> Subject: Re: [OT]1,2,3,4 I declare a pun war!
> 
> 
> Jim Barrows wrote:
> 
> >>> Sometimes it's a real feta to get to work though
> >>
> >> That's cheesy.
> >
> > Hey, as long is it doesn't make you blue, or throw bricks...
> 
> No, it wouldn't make you bleu; it's a white cheese made from ewe or 
> goat's milk...

Oh, now I feel sheepish.


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

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



[OT] "hidden" submit button

2004-08-11 Thread Barnett, Brian W.
Does anyone know how to create a hidden submit button? We're using images
for the buttons, but still want the "enter" key to submit the form. Is there
a better way to handle this? We tried a few things with css but it didn't
seem to work. (visibility:hidden and display:none will hide the button, but
"enter" does nothing.)

 

Thanks,

Brian



RE: [OT] RTF & PDF export options

2004-07-20 Thread Barnett, Brian W.
I've been exposed to JasperReports, but in this case, I think it would be
overkill for what I need. Thanks for the idea.

-Original Message-
From: Coyne, Jimmy [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, July 20, 2004 3:23 AM
To: 'Struts Users Mailing List'
Subject: RE: [OT] RTF & PDF export options

Did you have a look at JasperReports (
http://jasperreports.sourceforge.net/index.html) ? 
Jimmy


> -Original Message-
> From: Barnett, Brian W. [mailto:[EMAIL PROTECTED]
> Sent: 19 July 2004 23:22
> To: '[EMAIL PROTECTED]'
> Subject: [OT] RTF & PDF export options
>
>
> Any suggestions for converting html to RTF and PDF inside an action class
> and then sending the RTF or PDF back to the client?
>
>
>
> Open source tools, code snippets, tips & tricks, etc. ??
>
>
>
> Thanks a bunch.
>
>
>
> Brian Barnett
>
>


-
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: [OT] RTF & PDF export options

2004-07-20 Thread Barnett, Brian W.
Forgive my naivety, Wendy, but what are the benefits of redirecting to a
Servlet?

-Original Message-
From: Wendy Smoak [mailto:[EMAIL PROTECTED] 
Sent: Monday, July 19, 2004 4:46 PM
To: Struts Users Mailing List
Subject: Re: [OT] RTF & PDF export options

From: "Barnett, Brian W." <[EMAIL PROTECTED]>
> Any suggestions for converting html to RTF and PDF inside an action
> class and then sending the RTF or PDF back to the client?

iText, but I don't do it in an Action, I redirect to a Servlet whose job it
is to output the PDF bytes.

-- 
Wendy Smoak


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

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



[OT] RTF & PDF export options

2004-07-19 Thread Barnett, Brian W.
Any suggestions for converting html to RTF and PDF inside an action class
and then sending the RTF or PDF back to the client?

 

Open source tools, code snippets, tips & tricks, etc. ??

 

Thanks a bunch.

 

Brian Barnett



RE [OT]: onsubmit form ERROR

2004-07-14 Thread Barnett, Brian W.
Hmm. I've never seen that syntax, but that doesn't mean much. Here are the
syntaxes I've seen:

document.MonitorForm.submit()
document.forms[0].submit()
document.forms["MonitorForm"].submit()

I've seen something as simple as a semi-colon at the end of javascript work
wonders too :)



-Original Message-
From: Isaac Mosquera [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 14, 2004 2:01 PM
To: Struts Users Mailing List
Subject: RE: onsubmit form ERROR

thanks, but that didn't work, it seems as though i'm getting a valid form 
object because if use:
  alert( document.forms.MonitorForm.name ) and alert( 
document.forms.MonitorForm.action )
they both return the right output, however its just the submit() function 
which gives me errors.
-isaac
At 12:45 PM 7/14/2004 -0700, you wrote:
>Try document.MonitorForm.submit()
>
>-Original Message-
>From: Isaac Mosquera [mailto:[EMAIL PROTECTED]
>Sent: Wednesday, July 14, 2004 1:47 PM
>To: [EMAIL PROTECTED]
>Subject: onsubmit form ERROR
>
>i have the following piece of HTML/JavaScript and this problem happens
>quite frequently but i dont know how to fix it.
>
>  onchange="document.forms.MonitorForm.submit()">
>
>although there is a valid form with the name "MonitorForm" in the html page
>i get this error:
>
>"object doesn't support this property or method"
>
>-isaac
>
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]


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

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



RE: onsubmit form ERROR

2004-07-14 Thread Barnett, Brian W.
Try document.MonitorForm.submit()

-Original Message-
From: Isaac Mosquera [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 14, 2004 1:47 PM
To: [EMAIL PROTECTED]
Subject: onsubmit form ERROR

i have the following piece of HTML/JavaScript and this problem happens 
quite frequently but i dont know how to fix it.

 

although there is a valid form with the name "MonitorForm" in the html page 
i get this error:

"object doesn't support this property or method"

-isaac



-
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: Trying to learn Struts, need help understanding design proces s

2004-06-25 Thread Barnett, Brian W.
A nice combination of tools/libraries we use is the display tag library to
display tabular data in a jsp page and iBATIS SQL Maps for data access.
Both are widely used as far as I know.

The iBATIS site also has a JPetStore demo based on Struts which provides a
great example (source code included) of how to implement a struts
application, based on best practices.

http://displaytag.sourceforge.net/
http://www.ibatis.com

Hope this helps.
Brian Barnett

-Original Message-
From: Jamison Roberts [mailto:[EMAIL PROTECTED] 
Sent: Friday, June 25, 2004 12:46 PM
To: Struts Mailing List
Subject: Trying to learn Struts, need help understanding design process

I've been a C#/.Net developer for two years.  Recently my company has
decided to move towards Java/Struts, so i've spent the last three
weeks familiarizing myself with Java, JDBC, Type 4 drivers, Tomcat,
Ant, and Struts.

Struts is the last thing i've tried to tackle, and I thought I had a
handle on it, however I don't.  I'm not sure of the best (or
correct/standard) way of doing simple things.  I've read that if I
ever have a *.jsp showing in the address bar outside of the entry
page, i've done something wrong.

I'd like to give an example, and hear suggestions on the correct way
to implement such an idea.  Simple example to follow...

Let's say I have a database that contains a two tables:  one called
teams, and one called riders.  There is a one-to-many relationship
between teams and riders based on a "teamid."

In the teams table, we have the following data (Primary Key in parens):
(1) USPS
(2) T-Mobile
(3) Cofidis
(4) Phonak
...

In the riders table, we have this data (relationship in parens):
Lance Armstrong (teamid = 1)
George Hincapie (teamid = 1)
Jan Ullrich (teamid = 2)
Alexandre Vinokourov (teamid = 2)
David Millar (teamid = 3)
Tyler Hamilton (teamid = 4)
...

>From the Index.jsp, there should be a link to another page that will
have a single select box, and a submit button.  The select box needs
to be populated with a list of teams/teamids from the database.

Upon submission of the form, all riders will be displayed in a table.

Pretty simple stuff, except I can't seem to figure out how to do it
with Struts.  The closest i've gotten is to have a "static" Teams.jsp
with an input-text box, which calls an Action to display the users. 
In otherwords my Index.jsp links to Teams.jsp, instead of something
like Teams.do (and I can't figure out how to populate a select box
from a Vector or other sort of list).

I apologize for asking simple questions, but i'm at the end of my rope
trying to figure out all these "new" technologies (new to my Microsoft
dominated world).

-
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: when delete a record

2004-06-23 Thread Barnett, Brian W.
There are numerous ways it could be done. It's really up to you on the
workflow you would like. One simple way is to just use the edit page as your
delete page as well.  We use one jsp page for add/edit/delete and have a
flag on our form bean indicating whether we are adding/editing/deleting. We
set the flag in the Action class, and check it in the jsp page. Based on its
state, the jsp page is rendered slightly differently. (Delete button instead
of Save button, read-only fields vs. input fields, etc.)

Here are a few code snippets:

** Action class snippet **  
public ActionForward deleteWidget(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws ServiceException {

  int widgetId = new Integer ((String) request.getParameter("widgetId
")).intValue();

  WidgetForm widgetForm = (WidgetForm) form;
  WidgetService widgetService = (WidgetService)
serviceManager.getService("Widget");
  widgetForm.setWidgetDTO((WidgetDTO) widgetService.getOneWidget
(widgetId));
  widgetForm.setMode(Constants.MODE_DELETE);
  return mapping.findForward(Constants.EDIT);
}

** JSP snippet **

  

  

  


  


  

  


Hope this helps.
Brian Barnett

-Original Message-
From: Julia Weaver [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 23, 2004 9:07 AM
To: Struts Users Mailing List
Subject: when delete a record 

Hi,

Can anyone please tell me:
How to do a confirmation when delete a record in
struts? 

Thank you,



__
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail

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

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



RE: a fine example of an example

2004-06-21 Thread Barnett, Brian W.
JPetStore 4 at www.ibatis.com

-Original Message-
From: josh [mailto:[EMAIL PROTECTED] 
Sent: Monday, June 21, 2004 11:01 AM
To: [EMAIL PROTECTED]
Subject: a fine example of an example

Hi,

I have recently completed my first struts application and I am beginning
to feel comfortable with the framework.  What I would like now is to
look at someone else's code for a really good example of how things
should be done.  Does anyone know where I can download a shining example
of coding in struts?  I would like to get some ideas on how to make my
code better.

Thanks in advance

josh


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

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



[OT] jasper.runtime.BodyContentImpl problem

2004-06-16 Thread Barnett, Brian W.
I must have done something to mess up my dev environment. My jsp pages will
not render now. This is what displays in the browser now:

 
[ServletException in:/WEB-INF/jsp/AgentList.jsp]
org.apache.jasper.runtime.BodyContentImpl.clearBody()V'

 

I upgraded Tomcat (5.0.16 to 5.0.25), Eclipse (M4 to RC2), and installed
Sysdeo's Tomcat plugin. Does anybody have any ideas on what I can do
fix/troubleshoot this? Reverting back to Tomcat 5.0.16 and Eclipse M4 does
not work. The identical code base runs fine on another machine, so I'm
guessing the dev environment is messed up.

 

TIA,

Brian Barnett

 

Here's the stack trace:

 

2004-06-15 23:24:53 ApplicationDispatcher[] Servlet.service() for servlet
jsp threw exception
java.lang.AbstractMethodError:
org.apache.jasper.runtime.BodyContentImpl.clearBody()V
at
org.apache.jasper.runtime.BodyContentImpl.setWriter(BodyContentImpl.java:619
)
at
org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:735)
at
org.apache.jasper.runtime.PageContextImpl.pushBody(PageContextImpl.java:721)
at
org.apache.jsp.WEB_002dINF.jsp.AgentList_jsp._jspx_meth_html_submit_0(AgentL
ist_jsp.java:241)
at
org.apache.jsp.WEB_002dINF.jsp.AgentList_jsp._jspx_meth_html_form_0(AgentLis
t_jsp.java:214)
at
org.apache.jsp.WEB_002dINF.jsp.AgentList_jsp._jspService(AgentList_jsp.java:
91)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
11)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:284)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:204)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:750)
at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:636)
at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:546)
at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:1
002)
at
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:626)
at
org.apache.struts.tiles.TilesUtilImpl.doInclude(TilesUtilImpl.java:137)
at org.apache.struts.tiles.TilesUtil.doInclude(TilesUtil.java:177)
at
org.apache.struts.taglib.tiles.InsertTag.doInclude(InsertTag.java:756)
at
org.apache.struts.taglib.tiles.InsertTag$InsertHandler.doEndTag(InsertTag.ja
va:881)
at
org.apache.struts.taglib.tiles.InsertTag.doEndTag(InsertTag.java:473)
at
org.apache.jsp.WEB_002dINF.jsp.common.systemLayout_jsp._jspx_meth_tiles_inse
rt_2(systemLayout_jsp.java:219)
at
org.apache.jsp.WEB_002dINF.jsp.common.systemLayout_jsp._jspService(systemLay
out_jsp.java:110)
at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
11)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:103)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:284)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:204)
at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:750)
at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDis
patcher.java:510)
at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatch
er.java:445)
at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher
.java:359)
at
org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:10
69)
at
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcesso
r.java:274)
at
org.apache.struts.tiles.TilesRequestProcessor.processTilesDefinition(TilesRe
questProcessor.java:254)
at
org.apache.struts.tiles.TilesRequestProcessor.processForwardConfig(TilesRequ
estProcessor.java:309)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:279)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(

RE: using java.util.Map

2004-06-15 Thread Barnett, Brian W.
If you don't use the collection attribute, and you want different values and
labels in the list, you need to define two separate collections, one for the
values and one for the labels.

ArrayList statesValues = new ArrayList();
statesValues.add("RS");
statesValues.add("SC");
statesValues.add("PR");
ArrayList statesLabels = new ArrayList();
statesLabels.add("Rio Grande do Sul");
statesLabels.add("Santa Catarina");
statesLabels.add("Paraná");

Next, put these ArrayLists in scope (I put them in my formbean):
myForm.setStatesValues(statesValues);
myForm.setStatesLabels(statesLabels);

And then reference them like this in your jsp:


   


This worked for me, giving me html as you suggested you wanted.

Brian Barnett

-Original Message-
From: Henrique VIECILI [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 15, 2004 12:12 PM
To: Struts Users Mailing List
Subject: Re:  using java.util.Map

Ok, but probably 'allSchools' is actually a collection of beans that have
getSchoolId() and getSchoolName() methods, right?!

What I have is a java.util.Map like this:

Map states = new HashMap();
states.put("RS","Rio Grande do Sul");
states.put("SC","Santa Catarina");
states.put("PR","Paraná");

and i want to render something like this on my html


  Rio Grande do Sul
  Santa Catarina
  Paraná


I guess that is it,
Henrique Viecili
  - Original Message - 
  From: Barnett, Brian W. 
  To: 'Struts Users Mailing List' 
  Sent: Tuesday, June 15, 2004 2:57 PM
  Subject: RE:  using java.util.Map


  Here is an example that we have used and it works:

  
  
  

  -Original Message-
  From: Henrique VIECILI [mailto:[EMAIL PROTECTED] 
  Sent: Tuesday, June 15, 2004 12:00 PM
  To: Struts Users Mailing List
  Subject:  using java.util.Map

  Does anyone know howto use the  tag with the values and
label
  inside a Map?

  I´ve tried this:

  

  but it didnt work...

  Any sugestions?!

  Henrique Viecili

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

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



RE: using java.util.Map

2004-06-15 Thread Barnett, Brian W.
Here is an example that we have used and it works:





-Original Message-
From: Henrique VIECILI [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 15, 2004 12:00 PM
To: Struts Users Mailing List
Subject:  using java.util.Map

Does anyone know howto use the  tag with the values and label
inside a Map?

I´ve tried this:



but it didnt work...

Any sugestions?!

Henrique Viecili

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



how to check if html:errors will display anything

2004-06-07 Thread Barnett, Brian W.
How can I check if the html:errors tag will display anything down inside my
jsp page? I have the html:errors tag inside a table tag and I don't want the
table generated at all if there aren't any errors to display.

 

Thanks,

Brian Barnett



Struts 1.1 with commons-lang-2.jar

2004-05-27 Thread Barnett, Brian W.
Struts 1.1 ships with some 1.x version of commons-lang.jar.  Is it okay to
use a 2.x version of commons-lang.jar with Struts 1.1?



RE: standard tags vs. struts specific tags

2004-05-27 Thread Barnett, Brian W.
Thanks Rick.

-Original Message-
From: Rick Reumann [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 27, 2004 1:00 PM
To: Struts Users Mailing List
Subject: Re: standard tags vs. struts specific tags

Barnett, Brian W. wrote:


> Does this mean I should use jstl from Sun or are the standard tags (c,
fmt,
> sql, etc) that come with struts 1.1 just fine?

Sun's site makes it very annoying. I don't know why they don't provide a 
link to the JSTL tags directly. You can get the JSTL tags here:

http://jakarta.apache.org/taglibs/index.html

And yes use them instead of the struts tags where possible. You still 
need to use the struts form tags and I still use the  and html:messages tags, but that's about it.


-- 
Rick

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

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



standard tags vs. struts specific tags

2004-05-27 Thread Barnett, Brian W.
Found this on the Struts site:

"The Struts team encourages the use of the standard tags over the Struts
specific tags when possible"

 

Does this mean I should use jstl from Sun or are the standard tags (c, fmt,
sql, etc) that come with struts 1.1 just fine?

 

If from Sun, is there some way to download and install just the standard tag
libraries? They come bundled with J2EE 1.4 or Java Web Services Developer
Pack 1.3, but I don't want to install either of those just to get the jstl
1.1.  I just want to replace my c.tld, fmt.tld, standard.jar, etc., with the
ones I should be using.

 

Thanks.



RE: Best way to connect to Database in struts

2004-05-27 Thread Barnett, Brian W.
Use iBATIS SqlMaps and Dao framework. www.ibatis.com


-Original Message-
From: Axel Seinsche [mailto:[EMAIL PROTECTED] 
Sent: Thursday, May 27, 2004 11:43 AM
To: Struts Users Mailing List
Subject: Re: Best way to connect to Database in struts

Zaid wrote:

>Dear Friends,
>
>I am new to struts, so I was confused in choosing the best way to make
>connection to Database, whether data-resources or Plugin or any other
>method, however, if any suggested way to connect, please inform me. Baring
>in mind that I am using MySQL server.
>  
>
As the Struts data-sources did not work for me, I used JNDI to access my 
DB. This works very well. I somewhere read, that the Struts data-sources 
are not developed any longer and the suggest to use JNDI. I don't know, 
if this is true. But it could be possible.

Axel

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



version confusion

2004-05-26 Thread Barnett, Brian W.
I'm a recent convert to java (from micro$oft... sh) and i'm still trying
to understand which versions of which products work together. I just got
Tomcat 5.x, which implements Servlet 2.4 and JSP 2.0.  Does it matter if I
use Struts 1.0, 1.1 or 1.2 with this? Why?

 

How does the version of the JRE affect things?  How do I know which version
of the JSTL I need?

 

Is there some good reading on these topics somewhere?  (A document that can
explain how all these products work together and how the version of one
affects the version of another?)

 

Thanks,

Brian Barnett



RE: jsp and message resource file

2004-04-19 Thread Barnett, Brian W.
One way is to put this in your jsp file:


The reference it like this:


-Original Message-
From: Barnett, Brian W. [mailto:[EMAIL PROTECTED] 
Sent: Monday, April 19, 2004 2:44 PM
To: '[EMAIL PROTECTED]'
Subject: jsp and message resource file

What do you have to do to make a message resource file available to jsp
pages.

 

I've seen examples of 

 

but I think I have to do something else in order for that to work.

 

Thanks,

Brian Barnett


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



jsp and message resource file

2004-04-19 Thread Barnett, Brian W.
What do you have to do to make a message resource file available to jsp
pages.

 

I've seen examples of 

 

but I think I have to do something else in order for that to work.

 

Thanks,

Brian Barnett



session scoped action form question

2004-04-19 Thread Barnett, Brian W.
Can someone enlighten me as to why when I instantiate a new ActionForm, the
old data seems to hang around? Here is the information:

 

I have a session scoped action form defined in struts config:

 

  

   

   etc, etc,

  

 

My dispatch method looks something like this:

 

public ActionForward addNewWidget(ActionMapping mapping, 

ActionForm form,

HttpServletRequest request, 

HttpServletResponse
response) {

form = new WidgetForm();

((WidgetForm) form).setMode(Constants.MODE_INSERT);

return mapping.findForward(Constants.ADD);

}

 

Assume that prior to adding a new widget, the user has already edited an
existing one, so the session-scoped WidgetForm is populated with the edited
widget's info.

 

After the addNewWidget() method is called and the user is sent to the add
page, the previous edited widget's data still displays. Why is this? Doesn't
the line "form = new WidgetForm();" wipe out the old object?

 

Essentially, I just want an empty WidgetForm when the user wants to add a
new widget. I was hoping not to have to write a "clear" method for all of my
session scoped ActionForms. I'm sure there's a simple solution, please
enlighten me.

 

(I hope the syntax is correct above. I was typing from memory. I don't have
the code here in front of me.)

 

Thanks,

Brian Barnett



RE: Struts, Business Logic, DAOs

2004-04-15 Thread Barnett, Brian W.
One option is to use "service" objects that sit between the DAOs and the
Actions. Following your example, one service class might look something like
this:

public class WidgetService {
public void delete(int id) {
WidgetDAO w = new WidgetDAO();
try {
// start transaction
w.delete(id);
// deletes on other related tables could go here
// commit transaction
} catch (Exception e) {
// rollback transaction
}
}
}

The action class would never access DAO classes directly, but would always
use service classes. This allows your action classes to remain relatively
simple and uncluttered.

execute(...) {
 WidgetService.delete(widgetId);
}

Your business rules would be implemented in WidgetService.delete(). You may
have to pass in additional parameters in order for your business rules to be
executed.

We typically have one service object per dao object.


-Original Message-
From: Paul Barry [mailto:[EMAIL PROTECTED] 
Sent: Thursday, April 15, 2004 11:13 AM
To: [EMAIL PROTECTED]
Subject: Struts, Business Logic, DAOs

I have a question about business logic.  The best way I can think to 
explain this is with an example.  I know this is kind of long, but I am 
trying to keep this as simple as possible while still being able to 
illustrate the point.  Let's say I have Users and Widgets.  I would have 
Business Objects for each one, something like this:

public User {
   public int getId();
   public boolean isAdmin();
}

public Widget {
   public int getId();
   public User getCreator();
}

Now assume I am using a DAO like this:

public WidgetDAO {
   public void delete(int id);
}

Assume the implementation of this DAO would delete a row from the widget 
table in the database.  So using struts I would have an action with a 
method like this:

execute(...) {
 WidgetDAO.delete(widgetId);
}

Assume the widgetId came from an ActionForm, the details are irrelevant. 
  The point is this would all work fine, you could call the action with 
a URL like /deleteWidget.do?widgetId=4 and it would delete widget 4. 
Also, assume there is other logic already handling logging in the user 
so there is a UserBO object in a session attribute, which is used to 
populate the creator property of the Widget.

But now let's say I have 2 business rules:

1.  users that are admins can delete any widget
2.  non-admin users can only delete widgets they created

So specifically from the objects above, you can delete a widget if 
user.isAdmin() returns true or widget.getCreator().getId() == 
user.getId().  The question is where should this kind of logic go?

You could get away with putting it in the action, but in a real world 
application this type of logic would be much more complicated and 
probably get re-used across different actions.  The Struts guidelines 
even say this:

"Rather than creating overly complex Action classes, it is generally a 
good practice to move most of the persistence, and "business logic" to a 
separate application layer. When an Action class becomes lengthy and 
procedural, it may be a good time to refactor your application 
architecture and move some of this logic to another conceptual layer; 
otherwise, you may be left with an inflexible application which can only 
be accessed in a web-application environment."

http://jakarta.apache.org/struts/userGuide/building_controller.html#action_c
lasses

I doesn't seem like this logic belongs in the DAO either, because if you 
  don't want that kind of logic mixed in with code to get the data out 
of the database.  Does it belong in the business objects, maybe by 
expanding the Widget object like this?

public Widget {
   public int getId();
   public User getCreator();
   public boolean canDelete(UserBO);
}

And then canDelete would in turn call a DAO to check that?  Or would a 
separate layer be better, like this:

public WidgetLogic {
 public boolean canDeleteWidget(User, Widget);
}


Are there any best practices or sample applications that you know of 
that have a good example of a business logic layer?











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



dealing with nullable db columns

2004-04-15 Thread Barnett, Brian W.
Wondering if anybody has a slick way of dealing with nullable database
columns. We have a data transfer object that has member variables, one for
each database column, and of course all the getters and setters.

 

For View layer purposes, we have a class which extends Struts'
ValidatorForm. This Form class has a DTO as a member variable.

 

public class SchoolYearDTO implements Serializable {

  private int yearId;

  private String externalKey;

  private String display;

  private int yearBegin;

  private int yearEnd;

  // getters and setters follow...

}

 

public class SchoolYearForm extends BaseForm {

  private SchoolYearDTO schoolYearDTO;

  // additional view only member variables are included here as well

  public SchoolYearDTO getSchoolYearDTO() {

return schoolYearDTO;

  }

  public void setSchoolYearDTO(SchoolYearDTO schoolYearDTO) {

this.schoolYearDTO = schoolYearDTO;

  }

}

 

The jsp pages use the Form like this:

 



  



 

What we are hoping to avoid is a duplicate set of member variables with
accompanying getters and setters in the Form object for the nullable fields.
(These getters and setters would essentially move data back and forth
between the view and the DTO, "massaging" it as appropriate for the view and
for the database. Is there a better way?)

 

For those familiar with iBatis, we are using the "null" functionality
provided there, but we don't want -999 appearing in the user interface for
null integers, we just want the text box to be empty.

 

Thanks,

Brian Barnett