Re: Setting Session time out

2007-12-26 Thread David Durham, Jr.
On Dec 25, 2007 1:56 AM, Raghuveer <[EMAIL PROTECTED]> wrote:
> If session of login user expires or left unused for 15 minutes application
> should fire session expire page automatically.

This is something that is best accomplished from a client.

HTML allows you to specify meta data about a document.

   http://www.w3.org/TR/html401/struct/global.html#h-7.4.4

And since these documents are usually retrieved via HTTP, HTML meta
tags include an attribute for setting HTTP response headers.  The
particular HTTP header that's often used to accomplish the task of
"firing a session expire page automatically" is the "refresh" header.
Here's the result of a quick google search:

   http://webdesign.about.com/od/metataglibraries/a/aa080300a.htm

> Any idea of how to handle this in my struts application?

Session expiration/timeout configuration is outside of the
responsibilities of a web framework like Struts.  Said configuration,
however, is specified by various servlets specifications.  You'll
likely end up modifying a web.xml to achieve your desired results.

-Dave

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



Re: Char lib for Struts 1

2007-12-28 Thread David Durham, Jr.
On Dec 28, 2007 7:08 AM, Sebastian Göttschkes
<[EMAIL PROTECTED]> wrote:
> Hi there,
>
> I'm trying to find a chart lib for Struts 1(.3.8). It should be something 
> small, easy to install and use. I just need pie charts in 2D, nothing special.
>
> Any suggestions?

It's not Struts specific but Google has a chart API.

http://code.google.com/apis/chart/

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



Re: unexpected behavior with a checkbox.

2008-01-02 Thread David Durham, Jr.
> Where the trouble comes in is if the field is unchecked which I thought
> would set the value of the Boolean to "false."  It doesn't, it remains
> as a true.
>
> How do I implement behavior where if the checkbox is unchecked it sets
> the corresponding property of the form to false?

The issue is that an unchecked checkbox does not send a value when a
form is submitted, so:

   request.getParameter("myUncheckedCheckbox") == null

You can run this check in an action, and modify forms appropriately.
I can say more on this topic, if you need, wrt. session-scoped forms
(and why you should not use them).

-Dave

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



Re: unexpected behavior with a checkbox.

2008-01-02 Thread David Durham, Jr.
> >
> >request.getParameter("myUncheckedCheckbox") == null
> >
>
> Oh.. yuck.. but thanks David for that work around.  Tried it and it
> works for my purposes.

There are things that can be done to avoid to the ugly null check.

1. Don't initialize check-box fields.  No initial values.
2. Don't use session-scoped forms.

It sounds like you need to start with a blank or default form that has
a check-box checked.  Perhaps the user should receive spam?  :)  I
haven't thought about that case much, but it seems similar in that, if
you don't want to use an initial value for reasons previously
mentioned, you're faced with using some other means to indicate this
box is checked by default.  If you have a "display new form action,"
you can put a value on the form whereby the box will start out
checked.  This is different than defining an initial value.   So long
as you don't specify an initial value for check-box fields, and Struts
creates a new form object for each submission, the state of a
check-box is preserved within an ActionForm.

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



Re: unexpected behavior with a checkbox.

2008-01-03 Thread David Durham, Jr.
On Jan 2, 2008 10:59 PM, ravi_eze <[EMAIL PROTECTED]> wrote:
>
> hi,
>
> the workaround works, but causes problems if the checkbox should be
> validated. More over the soln is based on assumptions that need not hold
> always.

Which solution are you saying is based on assumptions that need not
hold, and why?  I think you'll find that my solution wherein you 1)
you don't use session-scoped action forms (or the equivalent in s2)
and 2) you don't initialize checkboxes in action form initialization,
covers all bases, including validation.  Really, it's the only viable
option for struts 1, that I know of.  If the assumption that doesn't
hold is that you need session-scoped-like form behavior, then that's
easily resolved.

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



Re: unexpected behavior with a checkbox.

2008-01-10 Thread David Durham, Jr.
> > The issue is that an unchecked checkbox does not send a value when a
> > form is submitted, so:
>
> This depends on (a) whether or not we're talking about S2 and (b) if we are
> whether or not we're using an interceptor stack that includes the "checkbox"
> interceptor.

I just meant that an HTTP Server won't see a request parameter for an
unchecked checkbox [sic], because a W3C conforming HTML browser won't
send one [request parameter].  The checkbox interceptor seems kludgey
to me, but if it solves this problem for people in a mostly
transparent way, then it's a good thing.


-Dave

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



eclipse struts2 projects "missing java project struts2-core"

2007-05-25 Thread David Durham, Jr.

Hi,

I checked out the struts2 trunk from svn and imported the struts
projects via import projects.  I see a list of projects: api, core,
struts2-codebehind-plugin, ...  I have an M2_REPO variable setup.
core and api build without errors, but all of the plugin projects fail
to build because they're missing the dependency project struts2-core.
What's the recommended procedure for setting up the plugin projects,
and the core and api for that matter.  I'm trying to follow these
documents:

http://struts.apache.org/2.x/docs/building-the-framework-from-source.html
http://struts.apache.org/2.x/docs/building-with-maven.html

Thanks,

Dave

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



Re: eclipse struts2 projects "missing java project struts2-core"

2007-05-26 Thread David Durham, Jr.

On 5/26/07, Musachy Barroso <[EMAIL PROTECTED]> wrote:

There's probably an easier way, but I just create the elipse project for the
project I want to use, like let's say, core and showcase, doing:

core/
mvn eclipse:eclipse

apps/showcase/
mvn eclipse:eclipse -Dwtpversion=1.0

and then import the projects, if you do it like that, you need to compile
core with maven because the reference in the showcase project will be
pointing to the M2_REPO folder. To compile core(configure it to run as an
external tool):


That works for the showcase app.  Wondering why the mvn
eclipse:eclipse goal will build the plugin projects' eclipse metadata
with a project dependency of struts2-core instead of core?  Does this
have something to do with an assumption that you would have
struts1-core in the same workspace?

Sounds like reasonable fixes are: 1) change project dependency from
struts2-core to core or 2) change to M2_REPO dependency instead of
project dependency and use mvn build.

1) Worked for me.

2) M2_REPO dependency is implied, at this point.

https://issues.apache.org/struts/browse/WW-1947


core/
mvn -Dmaven.test.skip=true install

I think there is a way to have maven generate the projects with the
references between them for eclipse, but I'm not sure how, we can put it on
the wiki if someone replies :)


Would like to have some more info about how you setup the maven build.
I couldn't get this plugin http://m2eclipse.codehaus.org/> to
play nice.  Nor was I successfully able to add a "Program" builder to
my project.

-Dave

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



Re: [OT] Serious memory leak

2007-05-30 Thread David Durham, Jr.

Maybe you're creating a new session with each request.

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



Re: Extending DynaValidatorForm

2007-06-08 Thread David Durham, Jr.

On 6/8/07, Ambaris Mohanty <[EMAIL PROTECTED]> wrote:

Please someone send me the sample code for extending DynaValidatorForm and
implementing the reset method. I have no idea on how to do it. Please help.
I'm using struts 1.2.9.
Thank you,



HTML has the concept of a reset button:

  http://www.w3.org/TR/html401/interact/forms.html#reset-button

As stated in the link above, when a user activates a reset control,
the form values are set to their *inital values*.  This may not be the
reset behavior that you're looking for.

One way to implement a reset button that "clears" form element values
is with JavaScript.  You might do something like:

Reset


   function resetForm() {
   // acquire form reference, e.g.
   var myForm = document.forms['myForm'];

   // loop through elements
   for(var i = 0; i < myForm.elements.length; i++) {
  // check element type and implement reset
  //  your code goes here
   }
   }


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



Re: Extending DynaValidatorForm

2007-06-08 Thread David Durham, Jr.

On 6/8/07, David Durham, Jr. <[EMAIL PROTECTED]> wrote:

On 6/8/07, Ambaris Mohanty <[EMAIL PROTECTED]> wrote:
> Please someone send me the sample code for extending DynaValidatorForm and
> implementing the reset method. I have no idea on how to do it. Please help.
> I'm using struts 1.2.9.
> Thank you,


HTML has the concept of a reset button:

   http://www.w3.org/TR/html401/interact/forms.html#reset-button

...


Hmm, guess you were asking about extending DynaValidatorForm.  I must
have been thinking of some other question that was similar to this
one.  Anyway, a DynaValidatorForm is a DynaBean, so you can call
set("propertyName", "reset Value") from your reset override method.
These API versions aren't exact, but I don't think these classes have
changed much:

http://struts.apache.org/1.3.8/apidocs/org/apache/struts/validator/DynaValidatorForm.html
http://jakarta.apache.org/commons/beanutils/commons-beanutils-1.6.1/docs/api/org/apache/commons/beanutils/DynaBean.html

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



Re: Extending DynaValidatorForm

2007-06-11 Thread David Durham, Jr.

On 6/11/07, Ambaris Mohanty <[EMAIL PROTECTED]> wrote:

My code is as following...
struts-config.xml









Is this something where just adding "initial" will work for you?



This will affect the behavior of an html-reset control, because it
determines the initial value of new form elements.

Otherwise, if you're going to actually override
DynaValidatorForm.reset, something like this might work for you
(method signature truncated) :

reset(mapping, request) {
  set("username", "");
}

This is one step removed from the html-reset control, because it will
be executed within your servlet context, *not* from within a browser.

What's the actual problem you're trying to solve.

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



Re: [S2] Getting DAO from Spring in Struts Action

2007-06-14 Thread David Durham, Jr.

On 6/14/07, Wesslan <[EMAIL PROTECTED]> wrote:

Maybe http://struts.apache.org/2.x/docs/spring-plugin.html can be of some
help.


You have to give your spring actions (those you want dependency
injection for) the same value for the "name" attribute as the value
you give for your spring bean's "id" attribute.  This is spelled out
in the referenced document, but I missed that point the first time
through.

HTH,
Dave

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



Re: [S2] Getting DAO from Spring in Struts Action

2007-06-15 Thread David Durham, Jr.

On 6/14/07, M. Bitner <[EMAIL PROTECTED]> wrote:






Your action name has to correspond to your bean id, so:



Re: [S2] Exporting to CSV and Excel

2007-06-18 Thread David Durham, Jr.

On 6/18/07, Jeff Amiel <[EMAIL PROTECTED]> wrote:

On 6/18/07, Skip Hollowell <[EMAIL PROTECTED]> wrote:
> I see that in the new 2.0.8 (Thanks Ted, Don and team) that the Jasper
> plugin is included.  Does that mean that Jasper is the endorsed
> recommended way to export data to Excel and or CSV?  If so, great.  If
> not, can you offer up what you feel is a preferred mechanism for
> exporting to Excel?

I personally use display tag (http://displaytag.sourceforge.ne) which
has fine excel, csv and pdf export mechanism.  It all depends on what
you are trying to 'export'.


Both of these tools use Apache POI  as an
underlying Excel format  generator.  I wouldn't use Jasper as an Excel
generator, unless I were already using or intended to use Jasper as a
reporting engine.  Display tag is only applicable, in this case, if
you need tabular data within a JSP along with an option to export in
Excel format.

POI is fairly easy to use, I've found, but it does have some memory
related problems associated with very large excel files.

-Dave

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



Re: [S2] Getting DAO from Spring in Struts Action

2007-06-21 Thread David Durham, Jr.

On 6/15/07, M. Bitner <[EMAIL PROTECTED]> wrote:

That got it working - thank you all so much for your help.


Turns out I was wrong, though, and it's the "class" attribute that has
to match up.  Been awhile since I looked at that.  Good that you
solved your problem, anyway.


-Dave





On 6/15/07, David Durham, Jr. <[EMAIL PROTECTED]> wrote:
> On 6/14/07, M. Bitner <[EMAIL PROTECTED]> wrote:
> > 
> > 
> Your action name has to correspond to your bean id, so:
>
> 
> or
>
> 

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



Re: dispatcher setting encoding

2007-07-11 Thread David Durham, Jr.

On 7/11/07, Arnaud Cogoluegnes <[EMAIL PROTECTED]> wrote:

So it seems the filter dispatcher transforms the encoding for all files (if
configured with /* in web.xml), which can cause problem with UTF-8 and BOM.

Is there any way to exclude some files from the filtering ?


My first guess would be to change the /* to /*.do, or something to
that effect.  Consider this with the caveat that I don't fully
understand the FilterDispatcher.  I think that Filters can now (since
servlets 2.4, I think) be applied to RequestDispatcher.include/forward
calls, so it's possible that changing /* to /*.do would break some
result types or something else, for that matter, but I don't know for
sure.

HTH,

Dave

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



Re: Struts 2 performance

2007-07-11 Thread David Durham, Jr.

On 7/11/07, Ing. Andrea Vettori <[EMAIL PROTECTED]> wrote:

Can anyone suggest how to "test" my site for performance analysis
(best with a simple free product) ?
I can show here the result if interested.


I haven't used it personally, but there's the Eclipse TPTP project
that works with the eclipse web tools platform via a seperately
downloaded plugin (tptp-wtp).

http://www.eclipse.org/tptp/

HTH,
Dave

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



Re: [S2] Multiple Submits with different actions in a Form

2007-07-25 Thread David Durham, Jr.

On 7/25/07, Grish <[EMAIL PROTECTED]> wrote:

My problem though is I have a form with multiple submit buttons. I tried
specifying the action on each submit button but the action in my form
overrides the action specified in the buttons.


I have success with this technique in Firefox, but I think it's broken
in IE.  Is this what you're seeing?

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



Re: [S2] Multiple Submits with different actions in a Form

2007-07-25 Thread David Durham, Jr.

On 7/25/07, Grish <[EMAIL PROTECTED]> wrote:


no, what happens is the action specified in the form is what's executed. I'm
using firefox as well.

here's my button:



I tried having the form specify one action and one button have to submit the
form, and another button (like the one above) to have the form submit to
another action. But it seems the action in the form overrides my button.


Things like:






work for me in firefox, but don't seem to work in IE.

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



Re: [s2] broken in IE (was: [S2] Multiple Submits with different actions in a Form)

2007-07-26 Thread David Durham, Jr.

> Things like:
>
> 
> 
> 
> 
>
> work for me in firefox, but don't seem to work in IE.

Could you provide the rendered HTML that works in one browser but not the
other?


Sure.

TestCancel.jsp
--

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

<%@ taglib prefix="s" uri="/struts-tags"%>



   Cancel Test


   
   
   
   



struts-config.xml
--
  
   /TestCancel.jsp?cancelled=false
   /TestCancel.jsp?cancelled=true
  

com.TestCancel

package com;

public class TestCancel {

   public String submit() {
   return "submit";
   }

   public String cancel() {
   return "cancel";
   }

}


Removing "type=button" will fix the IE issue.

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



Re: [s2] broken in IE (was: [S2] Multiple Submits with different actions in a Form)

2007-07-26 Thread David Durham, Jr.

On 7/26/07, Dave Newton <[EMAIL PROTECTED]> wrote:

I thought IE's broken button behavior was already
documented, including on the wiki?


That may be.  Here's the rendered HTML:

http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>





   Cancel Test




   
   Submit



   
   Cancel



   





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



Re: [S2] dojo 0.9 and ***-conversion.properties

2007-08-02 Thread David Durham, Jr.
On 8/1/07, Oguz Kologlu <[EMAIL PROTECTED]> wrote:
> Unexpected Exception caught setting 'contacts%5B0%5D.firstName' on
> 'class easybed.web.struts2.ContactsAction: Error setting expression
> 'contacts%5B0%5D.firstName' with value '[Ljava.lang.String;@284bf3'
>
> Dojo 0.4.3 used to work ok (probably it didn't encode `[`
> characters). I realise this is a borderline S2 issue since it ships
> with 0.4.3 but it will eventually have to support 0.9 and will have
> to solve the issue.

Only thing I can think of is that maybe the parameter name is being
double escaped with JavaScript.  You might be able to test this by
manually forming a URL like:

   http://.../MyAction.do?contacts%5B0%5D.firstName=value

and seeing if the value is set properly in your action.  I think it
should be.  But, if you make the following request:

  http://.../MyAction.do?contacts%255B0%255D.firstName=value

which has the parameter name contacts[0].firstName in a double-escaped
form, maybe you can reproduce your error.  If the first URL is fine,
but the second URL fails with the exception you're seeing, then you're
double-escaping in your browser.  Could be a dojo bug, or just
something that's changed from 0.4.3 to 0.9 that users need to be aware
of.  Not sure.

HTH,

Dave

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



Re: File Upload problem

2008-03-19 Thread David Durham, Jr.
On Wed, Mar 19, 2008 at 5:19 AM, udaykumar <[EMAIL PROTECTED]> wrote:
>
>  I am using struts and have an upload.jsp and its associated UploadForm.java
>  and UploadAction.java. The jsp's form has an enctype=multipart/form-data and
>  contains an html:file field to upload a file as well as a bunch of text
>  fields for metadata associated with the file. If an error occurs during
>  validation, the struts controller servlet forwards to the jsp with error
>  messages. The problem is that the filepath the user specified is no longer
>  present. Is there a way to restore this value so the user doesn't have to
>  complete this field again (the other text fields remain filled in). Thanks
>  in advance

The issue is that inputs of type file are read-only to unsigned
javascript programs and of course the value attribute does not apply.
Otherwise, a page could try to hide a file input on a form with a
preset value of /etc/shadow or some other sensitive file, and have a
user unknowingly upload this file.

-Dave

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



Re: [OT] What do you code today?

2008-04-04 Thread David Durham, Jr.
On Fri, Apr 4, 2008 at 6:14 AM, Ted Husted <[EMAIL PROTECTED]> wrote:
>  So, if anyone else is up for sharing, I'd be interested in hearing
>  what sort of things other people are doing these days. (If your not
>  comfortable posting the list, feel free to mail me direct.)

I'm working with python  and plone these days, and I'm completely out
of my element.  It's kind of refreshing.

I wrote a little Plone product (really just modified some examples and
asked a lot of questions in irc :)) which facilitates integrating
external applications within a Plone site.  Check it out here:

  http://plone.org/products/contentcaller

You can use it to include a JSP or servlet or whathaveyou in a Plone
page.  There's also support for GWT.  I'm just getting started with
that, but it's kind of interesting.  A bit tangential, but Plone has
workflows as well, only they're visibility centric.

I also wrote a java library that can be used to automagically create
Java Beans from an excel file or csv.  You can see that here:

   http://code.google.com/p/beanfiles/

My employer graciously allowed me to opensource the beanfiles tool.
Maybe someone here will find it useful.  If not, doesn't bother me at
all. :)

--Dave

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



Re: Struts2 tags behaviour customizable? isXyz() instead of getXyz()

2008-04-04 Thread David Durham, Jr.
On Fri, Apr 4, 2008 at 1:17 PM, akash agrawal <[EMAIL PROTECTED]> wrote:
> myBean is not null, There are other field which are not boolean and I do get 
> them fine.

Is it boolean, or Boolean?  I've seen situations where I was hoping
isX would return a reference to a Boolean (when reference with
JavaBean dot notation), but I had to implement a getX instead.  Just 2
cents.

-Dave

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



Re: Struts2 tags behaviour customizable? isXyz() instead of getXyz()

2008-04-04 Thread David Durham, Jr.
On Fri, Apr 4, 2008 at 1:39 PM, akash agrawal <[EMAIL PROTECTED]> wrote:
>  It is a Boolean property but I still think it should work no matter whether 
> it is boolean or Boolean. APIs I am using are not mine so I can't change the 
> bean, but there are workaround I can put in although they aren't pretty. I 
> was hoping something can be done on the framework (Struts2) side.

Ask not what the framework can do for you, but what you can do for the
framework ...   it's Friday.  Seriously though, if you need to provide
a getMyBoolean, and you can't modify the original class, you can just
provide a wrapper to translate getMyBoolean to isMyBoolean.  If it's a
public class as I think the JavaBean spec requires it to be, you can
just extend it, otherwise you need a delegator for not just this
property but all the others.  Anyway, it's not really clear that this
is what you need anyway, so this is just more speculation.


--Dave

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



Re: [OT] UML and Reverse Engineering

2008-04-11 Thread David Durham, Jr.
>  A good opensource option is Poseidon for UML (http://www.gentleware.com/).
> The community edition is free but that edition doesn't include Java->UML.

Poseidon and ArgoUML share a common codebase.  Argo does Java -> UML,
and I think the community edition of Poseidon does as well, but I'm
possibly wrong on this point.

-Dave

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



Re: Struts2: Ajax Pagination using JQuery

2008-06-27 Thread David Durham, Jr.
On Fri, Jun 27, 2008 at 1:43 PM, Raghu <[EMAIL PROTECTED]> wrote:
> Hi, I want to implement ajax pagination on my struts2 page but I am not sure
> how to implement that. I am not very good in javascript and jquery but
> learning them..
>

You might be interested in something like this:

http://webplicity.net/flexigrid/

Regards,
Dave

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