Re: Tags as template parameters?

2009-10-03 Thread Paul Benedict
Dave,

You're a valuable resource to the Struts board! Pascal should pay
attention to what you say.

Paul

On Mon, Jul 20, 2009 at 4:15 PM, Kawczynski, David wrote:
> Sitemesh doesn't build the entire page... it is a Filter that grabs the
> response text (immediately before the servlet container sends it to the
> client) and adds to it.  Decorators contain what is added to the
> response.  I've found that if your decorators require a lot of run-time
> logic then yes, it will take more time then if it were never modified.
> (Exactly how much time depends on the decorator's logic.)  Otherwise,
> the time to decorate a page is negligible.  Be smart when writing your
> decorators... for instance, mapping different decorators to the
> diverging URI patterns is an easy way to avoid the time penalty
> associated with logic in decorators.
>
> HTH,
> -dave
>
>
>> -Original Message-
>> From: Pascal [mailto:pas...@voidmage.net]
>> Sent: Sunday, July 19, 2009 8:13 AM
>> To: Struts Users Mailing List
>> Subject: Re: Tags as template parameters?
>>
>> I just had a look at Sitemesh and it looks like what I want.
>> There is one
>> thing that disturbs me, though, it looks as if sitemesh will
>> build the page
>> every request, which causes quite some overhead, or am I
>> mistaken there?
>>
>> Pascal
>>
>> On Fri, 17 Jul 2009 20:44:59 -0400, Wes Wannemacher 
>> wrote:
>> > I'm on my phone so I only skimmed your message. If I read correctly,
>> > you should take a look at sitemesh.
>> >
>> > -W
>> >
>> > On 7/17/09, Pascal  wrote:
>> >> Hello list,
>> >>
>> >> in Struts2 it is possible to do something like
>> >>
>> >> 
>> >> 
>> >>   
>> >>
>> >>   A page
>> >>   Some content
>> >> 
>> >> 
>> >>
>> >> This works ok, but my problem is that I have to change every single
>> >> page, if i would like to have a custom footer for every page, for
>> >> example.
>> >>
>> >> Now my question is: Is it possible to do something like this?
>> >>
>> >> 
>> >>     
>> >>         A page
>> >>         Some content
>> >>     
>> >> 
>> >>
>> >> And as template definition say
>> >>
>> >> 
>> >> ...
>> >>
>> >> 
>> >>
>> >> 
>> >> This is the footer
>> >>
>> >> I know it is possible to use parameters for templates, but they
>> >> obviously have huge limitations as I can't just put the
>> tags there as I
>> >> did in my example.
>> >>
>> >> Also, I could do something like
>> >>
>> >> 
>> >> 
>> >> 
>> >>
>> >> which I also don't want because I would have an extra (unnecessary)
>> page.
>> >>
>> >> So, is it possible to pass whole XML-Structures to
>> templates? Maybe you
>> >> have some reasons why I shouldn't want what I'm suggesting
>> here, I would
>> >> be eager to hear them! :-)
>> >>
>> >> Pascal
>> >>
>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
> Notice:  This e-mail message, together with any attachments, contains
> information of Merck & Co., Inc. (One Merck Drive, Whitehouse Station,
> New Jersey, USA 08889), and/or its affiliates (which may be known
> outside the United States as Merck Frosst, Merck Sharp & Dohme or
> MSD and in Japan, as Banyu - direct contact information for affiliates is
> available at http://www.merck.com/contact/contacts.html) that may be
> confidential, proprietary copyrighted and/or legally privileged. It is
> intended solely for the use of the individual or entity named on this
> message. If you are not the intended recipient, and have received this
> message in error, please notify us immediately by reply e-mail and
> then delete it from your system.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: [Struts 1.3] first time use custom converter not working

2009-10-03 Thread Paul Benedict
Ever solve this? Are you sure you registered your converter properly?

Paul

On Wed, Sep 23, 2009 at 3:14 AM, senderj  wrote:
>
> I have a class Stk with property warType of type enum WarrType
>
>    public enum WarrType {
>        NONE, CALL, PUT; }
>
> I have in my struts config
>
>  type="org.apache.struts.validator.DynaValidatorForm">
> 
>
> and in my Action
>
>   MyConverter mc = new MyConverter();
>   ConvertUtils.register(mc, WarrType.class);
>   PropertyUtils.copyProperties(stk, form);
>   ..
> and embedded in the Action class
>
>   public class MyConverter implements Converter {
>   @Override
>   public WarrType convert(Class c, Object s) {
>        WarrType result = null;
>         System.out.println("I am running");
>         if (s.equals("NONE")) result = WarrType.NONE;
>        return result; 
>
> The problem is the convert() never executed. the copyProperties failed with
> "...had String ... expect WarrType...". Any idea why?
>
> --
> View this message in context: 
> http://www.nabble.com/-Struts-1.3--first-time-use-custom-converter-not-working-tp25531027p25531027.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: How is the max file size controlled for file uploads in Struts 1.3.8?

2009-10-03 Thread Paul Benedict
Frank,

Do you prefer an exception? What would you do with it?

Paul

On Thu, Jul 9, 2009 at 8:17 AM, Frank Russo  wrote:
> org.apache.struts.util.RequestUtils has the following at lines 408-415:
>
>                Boolean maxLengthExceeded =
>                    (Boolean) 
> request.getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED);
>
>                if ((maxLengthExceeded != null)
>                    && (maxLengthExceeded.booleanValue())) {
>                    ((ActionForm) 
> bean).setMultipartRequestHandler(multipartHandler);
>                    return;
>                }
>
> Why would it just return? Shouldn't it throw some kind of exception? When my 
> action is called, I have no way to know that the max file size was exceeded, 
> and my request params are empty, so the correct DispatchAction method isn't 
> being called.
>
> Has anyone else seen this behavior?
>
> 
> Frank Russo
> Developer ▪ Financial Services Division
> SAS® … THE POWER TO KNOW®
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Struts 1 - Initialization versus validation

2009-10-03 Thread Paul Benedict
Kevin,

Sounds like you want two separate action mappings. You could use
 to direct your use case.

Paul

On Mon, Sep 14, 2009 at 3:35 PM, Kevin Hale Boyes  wrote:
> Yes, I'm using form.reset() to initialize my fields but the problem is
> I don't want to initialize
> the fields if I'm coming into the SetupAction because of a validation error.
>
> I've worked around it for now by looking checking
>        ActionErrors errors = (ActionErrors)
> request.getAttribute(Globals.ERROR_KEY);
>        boolean haveErrors = (errors != null && !errors.isEmpty());
> and then switch on haveErrors.
>
> Kevin.
>
> 2009/9/14 Paweł Wielgus :
>> Hi Kevin,
>> as far as i know form.reset(...) should be used to reset form fields,
>> one good example is checkbox field that needs to be reseted. I don't
>> know if using reset method in order to initialize objects in form. Can
>> You do it with some kind of initialize/prepare method in SetupAction
>> or CrudAction?
>>
>> Best greetings,
>> Pawel Wielgus.
>>
>> 2009/9/14, Kevin Hale Boyes :
>>> I have a setup action defined:
>>>
>>> >>         type="package.SetupAction"
>>>         name="MyForm" validate="false">
>>>     
>>> 
>>>
>>> This action is responsible for setting up values in my (dyna) form
>>> before getting to the JSP page.
>>>
>>> I have a second action which is where the JSP will POST to:
>>>
>>> >>         type="package.CrudAction"
>>>         name="MyForm" validate="true" input="/setup">
>>>     
>>> 
>>>
>>>
>>> The idea is that if a validation error occurs then I'll be forwarded
>>> back the setup action
>>> and the page will be displayed again.  On success of the form POST I
>>> will actually
>>> come back to the same page to allow the user to input and POST again.
>>>
>>> The validation error could either happen from the (client-side)
>>> validator framework or
>>> it could happen from the CrudAction when it returns to
>>> mapping.getInputForward().
>>>
>>> Here's my problem though.  I would like to initialize the form fields
>>> (form.reset()) when
>>> the user first comes to the page or for success navigations but don't
>>> want to reset the
>>> form when coming to the action as a result of an error.
>>>
>>> Is there any way to do that?
>>>
>>> As noted in the subject, this is on Struts 1 and I'm using
>>> struts-validation.
>>>
>>> Thanks,
>>> Kevin.
>>>
>>> -
>>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>>> For additional commands, e-mail: user-h...@struts.apache.org
>>>
>>>
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>>
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Convention Confusion [BUG]?

2009-10-03 Thread RogerV



Musachy Barroso wrote:
> 
> that is pretty suspicious, can you open a jira ticket with the details?
> 

Logged. I have a demo war file (with source) available, but I couldn't see
where to attach it to the JIRA report.

Regards
-- 
View this message in context: 
http://www.nabble.com/Convention-Confusion-tp25658114p25732501.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: ognl problem with double value in form

2009-10-03 Thread Bill Bohnenberger
OK, thanks, Wes. Sorry I forgot to mention I was using 2.1.6.

Works fine with 2.1.8 jars!

Thanks again,
- Bill

On Sat, Oct 3, 2009 at 9:57 AM, Wes Wannemacher  wrote:

> Which version of struts are you using? We updated the OGNL dependency
> between 2.1.6 & 2.1.8, so if this is a bug with the new version we'll
> have to address it. If it's a problem with an old version, try
> updating to 2.1.8 jars.
>
> -Wes
>
> On Fri, Oct 2, 2009 at 7:43 PM, Bill Bohnenberger 
> wrote:
> > I have a double in an action:
> >
> >private double dval;
> >
> > with mutators
> >
> >public double getDval() { return dval; }
> >
> >public void setDval (double dval) { this.dval = dval; }
> >
> > I have this form in my jsp page:
> >
> > 
> >
> >
> > 
> >
> > Whenever I enter "0" or "0.0" in the text field, OGNL throws
> >
> > ognl.MethodFailedException: Method "setDval" failed for object
> > com.rp.db.actions.testact...@16cefa8 [java.lang.NoSuchMethodException:
> > setDval([Ljava.lang.String;)]
> >
> > BUT, it properly converts all non-zero values without complaint and even
> > converts the empty string to "0.0"!
> >
> > Is there some way I can get OGNL to accept the "0" and "0.0" values?
> >
> > Thanks,
> > Bill B
> >
>
>
>
> --
> Wes Wannemacher
>
> Head Engineer, WanTii, Inc.
> Need Training? Struts, Spring, Maven, Tomcat...
> Ask me for a quote!
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


Re: ognl problem with double value in form

2009-10-03 Thread Wes Wannemacher
Which version of struts are you using? We updated the OGNL dependency
between 2.1.6 & 2.1.8, so if this is a bug with the new version we'll
have to address it. If it's a problem with an old version, try
updating to 2.1.8 jars.

-Wes

On Fri, Oct 2, 2009 at 7:43 PM, Bill Bohnenberger  wrote:
> I have a double in an action:
>
>    private double dval;
>
> with mutators
>
>    public double getDval() { return dval; }
>
>    public void setDval (double dval) { this.dval = dval; }
>
> I have this form in my jsp page:
>
> 
>    
>    
> 
>
> Whenever I enter "0" or "0.0" in the text field, OGNL throws
>
> ognl.MethodFailedException: Method "setDval" failed for object
> com.rp.db.actions.testact...@16cefa8 [java.lang.NoSuchMethodException:
> setDval([Ljava.lang.String;)]
>
> BUT, it properly converts all non-zero values without complaint and even
> converts the empty string to "0.0"!
>
> Is there some way I can get OGNL to accept the "0" and "0.0" values?
>
> Thanks,
> Bill B
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Access Denied error with Struts 2.1.8

2009-10-03 Thread Dale Newfield

Dan R. Olsen III wrote:
I moved the project to a path with no spaces and I am still getting the 
same access denied error.


And what are the permissions on that deployed file? (not the input file, 
but the one pointed to by the error message)


Also, is that file valid?  Is there a chance you got a bad download? 
Did you check the checksum?


-Dale

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Setting a checkbox

2009-10-03 Thread Lee Clemens
You may need a getter method isIsChecked() or getIsChecked()

-Original Message-
From: Dan R. Olsen III [mailto:danec...@gmail.com] 
Sent: Friday, October 02, 2009 6:19 PM
To: Struts Users Mailing List
Subject: Setting a checkbox

I have the following tag:



isChecked is a boolean variable that is set in the action. When I put a 
variable in the name field for a textfield tag it will bring up the 
value of the variable in the text box. I want the checkbox above to be 
checked if isChecked is true and not checked if isChecked is false. All 
the examples I have found have not worked for me. Any extra help would 
be appreciated. I'm sure it is something simple that I am missing.





-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: [strut2] How to get ServletActionContext

2009-10-03 Thread Gary Moore
Uh, no sooner than I sent this query did I realize that adding 
singleton="false" to the factory bean solves my problem.

Thanks
Gary
Gary Moore wrote:

Newbie question here.
In my struts1 apps stuff gets loaded into an application container on 
start-up using ActionServlet, e.g. 
servlet.getServletContext().setAttribute( 
IConstants.APPLICATION_CONTAINER_KEY, app ); .


I'm trying to do the comparable in struts2 using a bean in 
applicationContext.xml:


class="com.clearridgeconsult.struts2.framework.AgricolaApplicationContainer" 
>
   value="/WEB-INF/config/NALTIndexConfig.xml"/>
   value="/WEB-INF/config/AgricolaIndexConfig.xml"/>



However, in the AgricolaApplicationContainer constructor, 
ServletActionContext.getServletContext()  is null.  From seaching the 
list archives, I've tried setting up a factory bean in 
applicationContext.xml to make the servlet context available:


class="com.clearridgeconsult.struts2.framework.StrutsServletContextLoader"/> 

   factory-method="getServletContext"/>
   class="com.clearridgeconsult.struts2.framework.AgricolaApplicationContainer" 
>
   value="/WEB-INF/config/NALTIndexConfig.xml"/>
   value="/WEB-INF/config/AgricolaIndexConfig.xml"/>

   
   

But, again, ServletActionContext.getServletContext() is null in the 
contextFactory bean.


I'm know I'm missing some obvious point here, but how do you make 
ServletActionContext made available?


Thanks,
Gary

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org






-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



[strut2] How to get ServletActionContext

2009-10-03 Thread Gary Moore
Newbie question here. 

In my struts1 apps stuff gets loaded into an application container on 
start-up using ActionServlet, e.g. 
servlet.getServletContext().setAttribute( 
IConstants.APPLICATION_CONTAINER_KEY, app ); .


I'm trying to do the comparable in struts2 using a bean in 
applicationContext.xml:


class="com.clearridgeconsult.struts2.framework.AgricolaApplicationContainer" 
>
   value="/WEB-INF/config/NALTIndexConfig.xml"/>
   value="/WEB-INF/config/AgricolaIndexConfig.xml"/>



However, in the AgricolaApplicationContainer constructor, 
ServletActionContext.getServletContext()  is null.  From seaching the 
list archives, I've tried setting up a factory bean in 
applicationContext.xml to make the servlet context available:


class="com.clearridgeconsult.struts2.framework.StrutsServletContextLoader"/>
   factory-method="getServletContext"/>
   class="com.clearridgeconsult.struts2.framework.AgricolaApplicationContainer" 
>
   value="/WEB-INF/config/NALTIndexConfig.xml"/>
   value="/WEB-INF/config/AgricolaIndexConfig.xml"/>

   
   

But, again, ServletActionContext.getServletContext() is null in the 
contextFactory bean.


I'm know I'm missing some obvious point here, but how do you make 
ServletActionContext made available?


Thanks,
Gary

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



[struts 2] different actions.extentions for different packages

2009-10-03 Thread Halil Ağın
Hello List;


I want to have differen extention names for actions in different packages.
For example, i have 2 package namespace

1. mail
2. registered


the actions in mail should have .ml extentions and others should have .scr

meanly, /mail/abc.ml should mapped to action named abc in the mail package.
and /registered/list.scr should mapped to action named list in the
registered package.

is it possible in struts 2.

regards,


-Halil AĞIN