Re: Display only 100 chars of a string

2009-06-23 Thread Stefano Tranquillini
About this link:
http://www.opensymphony.com/ognl/html/LanguageGuide/staticMethods.html

said: You can call a static method using the syntax
@cl...@method(args). If you leave out class, it defaults to
java.lang.Math, to make it easier to call min and max methods. If you
specify the class, you must give the fully qualified name.

but, i don't understand how to call the min method of math is i.e.
@method(min(100,1000)) ?? or what else?

thanks




-- 
Stefano

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



Getting the default Locale in JSP

2009-06-23 Thread Vishnu Vyasan Nelliparmbil
 

 

Hi Friends,

 

How can I get a default Locale settings from browser?

 

Regards

Vishnu

 

 

 



Re: Getting the default Locale in JSP

2009-06-23 Thread Antonio Petrelli
2009/6/23 Vishnu Vyasan Nelliparmbil 

> How can I get a default Locale settings from browser?


In JSP with EL:
${request.locale}

Antonio


Re: Exceptions thrown by constructor different from those thown by execute() ?

2009-06-23 Thread Paweł Wielgus
Hi Jan,
i'm not going into details of your solution but interceptors are a way
better tool for that job, search the list for authentication subjects.
You can also use libraries like acegi or similiar.

Best greetings,
Pawel Wielgus.

2009/6/22, Jan T. Kim :
> Dear All,
>
> I'm trying to use exceptions to make sure a user is logged in, using
> struts 2.1.6. My idea is
>
> * a subclass of ActionSupport that checks that a user is logged
>   in, and throws a NotLoggedInException if that's not the case
>
> * all other action handlers are subclasses of that subclass
>
> * use a global exception mapping to map the NotLoggedInException
>   to a suitable login action
>
> I can't seem to get this to work, I get a 500 response with a stack
> trace, saying "Unable to instantiate Action". If I arrange for the
> constructor to complete without an exception and for the execute()
> method to throw a NotLoggedInException, I get to the login action as
> I intend.
>
> So it seems that only exceptions thrown by execute(), but not those
> thrown by constructors, are handled as specified by the exception
> mappings (at least the global ones) -- is that right? And if so, why
> is that?
>
> Or do you thing I've just made some silly mistake here?
>
> Best regards, Jan
> --
>  +- Jan T. Kim ---+
>  | email: j@uea.ac.uk |
>  | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
>  *-=<  hierarchical systems are for files, not for humans  >=-*
>
> -
> 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: Exceptions thrown by constructor different from those thown by execute() ?

2009-06-23 Thread Jan T. Kim
On Tue, Jun 23, 2009 at 06:41:48AM -0200, Pawe? Wielgus wrote:
> Hi Jan,
> i'm not going into details of your solution but interceptors are a way
> better tool for that job, search the list for authentication subjects.
> You can also use libraries like acegi or similiar.

thanks for this pointer, I agree that this is probably a bad example
as such ad-hoc development of authentication mechanisms isn't really
a good idea.

My question is about exception handling in general, though: Why does
my handler work as expected when the exception is thrown by execute(),
but not when it's thrown by the constructor?

Having run into this, I'd like to understand it before moving on.

Best regards, Jan

> 2009/6/22, Jan T. Kim :
> > Dear All,
> >
> > I'm trying to use exceptions to make sure a user is logged in, using
> > struts 2.1.6. My idea is
> >
> > * a subclass of ActionSupport that checks that a user is logged
> >   in, and throws a NotLoggedInException if that's not the case
> >
> > * all other action handlers are subclasses of that subclass
> >
> > * use a global exception mapping to map the NotLoggedInException
> >   to a suitable login action
> >
> > I can't seem to get this to work, I get a 500 response with a stack
> > trace, saying "Unable to instantiate Action". If I arrange for the
> > constructor to complete without an exception and for the execute()
> > method to throw a NotLoggedInException, I get to the login action as
> > I intend.
> >
> > So it seems that only exceptions thrown by execute(), but not those
> > thrown by constructors, are handled as specified by the exception
> > mappings (at least the global ones) -- is that right? And if so, why
> > is that?
> >
> > Or do you thing I've just made some silly mistake here?
> >
> > Best regards, Jan
> > --
> >  +- Jan T. Kim ---+
> >  | email: j@uea.ac.uk |
> >  | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
> >  *-=<  hierarchical systems are for files, not for humans  >=-*
> >
> > -
> > 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
> 

-- 
 +- Jan T. Kim ---+
 | email: j@uea.ac.uk |
 | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=<  hierarchical systems are for files, not for humans  >=-*

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



Re: Struts2 and Security

2009-06-23 Thread Dave Newton

aum strut wrote:

Our requirement is to use good authentication framework for our application
and as per the initial application draft we are not going to use spring in
our application.

as we have found that Spring Security is quite a matured framework so we are
just investigating the option, if we can use it without using spring at all,
but as suggested if we can use it by including only some libraries than this
is not a bad choice at all.


I'm pretty sure that Spring Security requires the use of Spring--I'm not 
sure how this fact can escape you. Here's the first sentence of the 
first paragraph on the Spring Security site:


"Spring Security is one of the most mature and widely used Spring projects."

Just because Spring isn't being used by anything *else* in your app 
doesn't mean it doesn't use Spring.


(It's difficult for me to understand why you'd not want to use Spring 
anywhere else in the app, unless you're using another IoC/DI solution.)


Dave

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



Re: Localization in struts 2

2009-06-23 Thread Dave Newton

Johnson nickel wrote:

public String execute() throws Exception{
System.out.println("Inside Index action");
request.getSession().setAttribute(org.apache.struts.Globals.LOCALE_KEY,
  new java.util.Locale("fr","FR"));
System.out.println(request.getSession());
return SUCCESS;
}


(Yet another reason tabs are evil.)

The I18N interceptor does this work for you, AFAIK.


In struts.xml file,

 /index.jsp


Here, i don't want to return the jsp file.


What do you want to return?

You can use dynamic results to modify the content of the result 
configuration. If you have an action property you can include it in the 
result:


/index_${foo}.jsp

(At least I assume that would work.)

Dave

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



Re: Display only 100 chars of a string

2009-06-23 Thread Dave Newton

Stefano Tranquillini wrote:

About this link:
http://www.opensymphony.com/ognl/html/LanguageGuide/staticMethods.html

said: You can call a static method using the syntax
@cl...@method(args). If you leave out class, it defaults to
java.lang.Math, to make it easier to call min and max methods. If you
specify the class, you must give the fully qualified name.

but, i don't understand how to call the min method of math is i.e.
@method(min(100,1000)) ?? or what else?


What have you tried so far? I sure wouldn't think the word "method" 
should appear--why not just try what seems obvious, for example 
"@@min(...)" or "@min(...)"?


I think I'd be more comfortable specifying the full class anyway.

Dave

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



Re: Exceptions thrown by constructor different from those thown by execute() ?

2009-06-23 Thread Jim Kiley
Presumably the code calling execute() wraps it in a try/catch, but the call
that is instantiating the action in the first place doesn't do that.  You'd
have to look at the source to be sure, but of course that's the nice part
about working on open-source projects.
>From a philosophical perspective, though -- no clue, I don't have a lot of
insight into why the devs make all the decisions they make.

jk

On Tue, Jun 23, 2009 at 5:12 AM, Jan T. Kim  wrote:

> On Tue, Jun 23, 2009 at 06:41:48AM -0200, Pawe? Wielgus wrote:
> > Hi Jan,
> > i'm not going into details of your solution but interceptors are a way
> > better tool for that job, search the list for authentication subjects.
> > You can also use libraries like acegi or similiar.
>
> thanks for this pointer, I agree that this is probably a bad example
> as such ad-hoc development of authentication mechanisms isn't really
> a good idea.
>
> My question is about exception handling in general, though: Why does
> my handler work as expected when the exception is thrown by execute(),
> but not when it's thrown by the constructor?
>
> Having run into this, I'd like to understand it before moving on.
>
> Best regards, Jan
>
> > 2009/6/22, Jan T. Kim :
> > > Dear All,
> > >
> > > I'm trying to use exceptions to make sure a user is logged in, using
> > > struts 2.1.6. My idea is
> > >
> > > * a subclass of ActionSupport that checks that a user is logged
> > >   in, and throws a NotLoggedInException if that's not the case
> > >
> > > * all other action handlers are subclasses of that subclass
> > >
> > > * use a global exception mapping to map the NotLoggedInException
> > >   to a suitable login action
> > >
> > > I can't seem to get this to work, I get a 500 response with a stack
> > > trace, saying "Unable to instantiate Action". If I arrange for the
> > > constructor to complete without an exception and for the execute()
> > > method to throw a NotLoggedInException, I get to the login action as
> > > I intend.
> > >
> > > So it seems that only exceptions thrown by execute(), but not those
> > > thrown by constructors, are handled as specified by the exception
> > > mappings (at least the global ones) -- is that right? And if so, why
> > > is that?
> > >
> > > Or do you thing I've just made some silly mistake here?
> > >
> > > Best regards, Jan
> > > --
> > >  +- Jan T. Kim ---+
> > >  | email: j@uea.ac.uk
> |
> > >  | WWW:   http://www.cmp.uea.ac.uk/people/jtk
> |
> > >  *-=<  hierarchical systems are for files, not for humans  >=-*
> > >
> > > -
> > > 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
> >
>
> --
>  +- Jan T. Kim ---+
>  | email: j@uea.ac.uk |
>  | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
>  *-=<  hierarchical systems are for files, not for humans  >=-*
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>


-- 
Jim Kiley
Senior Technical Consultant | Summa
[p] 412.258.3346
http://www.summa-tech.com


Re: Exceptions thrown by constructor different from those thown by execute() ?

2009-06-23 Thread Wes Wannemacher
On Tue, Jun 23, 2009 at 8:50 AM, Jim Kiley wrote:
[...]
> From a philosophical perspective, though -- no clue, I don't have a lot of
> insight into why the devs make all the decisions they make.
>
[...]

The decisions I make are usually heavily weighted by how impressed
girls will be :)

I would go against adding security via exceptions thrown by a
constructor. In the default ObjectFactory for xwork, the flow for
creating instances of classes is pretty easy to follow. The exception
handling is deferred to callers (as evidenced by the various "throws
Exception" qualifiers on the methods). The main reason I would be
against it is that you aren't the one calling "new" on the classes. I
can appreciate what you are trying to do, so file a JIRA and when we
have time to investigate, we could probably implement it, but to solve
your problem, the best bet is an interceptor.

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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



Update to Struts 2.1.7

2009-06-23 Thread Pro1712

Hello!

I try to update from Struts 2.1.6 to 2.1.7.

I've got simple actions like this:

/pages/Test1.jsp


In Struts 2.1.6 'input' was called when invoking the action.
In Struts 2.1.7 'execute' is called.

Why is ecexute called now?
What is the default action that is called? How can I change it?

Thanks for your help!
-- 
View this message in context: 
http://www.nabble.com/Update-to-Struts-2.1.7-tp24166101p24166101.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: Update to Struts 2.1.7

2009-06-23 Thread Wes Wannemacher
Struts 2.1.7 is not officially released yet, it is being staged and voted on...

And, I am not sure if your configuration makes sense, I have never
mapped the * result before. Do you have a test1-validation.xml file
alongside the class file? Does test1 have a 'validate' method? Also,
how do you know which method is called? I'm assuming all results
render the same page...

-Wes

On Tue, Jun 23, 2009 at 9:34 AM, Pro1712 wrote:
>
> Hello!
>
> I try to update from Struts 2.1.6 to 2.1.7.
>
> I've got simple actions like this:
> 
>    /pages/Test1.jsp
> 
>
> In Struts 2.1.6 'input' was called when invoking the action.
> In Struts 2.1.7 'execute' is called.
>
> Why is ecexute called now?
> What is the default action that is called? How can I change it?
>
> Thanks for your help!
> --
> View this message in context: 
> http://www.nabble.com/Update-to-Struts-2.1.7-tp24166101p24166101.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
>
>



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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



Re: Exceptions thrown by constructor different from those thown by execute() ?

2009-06-23 Thread Jan T. Kim
On Tue, Jun 23, 2009 at 09:03:22AM -0400, Wes Wannemacher wrote:
> On Tue, Jun 23, 2009 at 8:50 AM, Jim Kiley wrote:
> [...]
> > From a philosophical perspective, though -- no clue, I don't have a lot of
> > insight into why the devs make all the decisions they make.
> >
> [...]
> 
> The decisions I make are usually heavily weighted by how impressed
> girls will be :)
> 
> I would go against adding security via exceptions thrown by a
> constructor. In the default ObjectFactory for xwork, the flow for
> creating instances of classes is pretty easy to follow. The exception
> handling is deferred to callers (as evidenced by the various "throws
> Exception" qualifiers on the methods). The main reason I would be
> against it is that you aren't the one calling "new" on the classes. I
> can appreciate what you are trying to do, so file a JIRA and when we
> have time to investigate, we could probably implement it, but to solve
> your problem, the best bet is an interceptor.

I (again) agree that an interceptor is more suited for security. I'm
undecided whether this is an issue suitable for a JIRA, it's more that
based on the documentation on Exception Configuration
[http://struts.apache.org/2.0.14/docs/exception-configuration.html], I
would have anticipated that exceptions would be mapped as configured
by exception-mapping elements regardless of whether they're thrown
by execute() or by a constructor.

My guess is it's more likely this is an issue for documentation,
or perhaps it's a (not exceedingly) FAQ. Or perhaps it's just me,
as I've only started with struts a few weeks ago.

Best regards, Jan
-- 
 +- Jan T. Kim ---+
 | email: j@uea.ac.uk |
 | WWW:   http://www.cmp.uea.ac.uk/people/jtk |
 *-=<  hierarchical systems are for files, not for humans  >=-*

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



Re: Exceptions thrown by constructor different from those thown by execute() ?

2009-06-23 Thread Wes Wannemacher
On Tue, Jun 23, 2009 at 9:56 AM, Jan T. Kim wrote:
[...]
> I (again) agree that an interceptor is more suited for security. I'm
> undecided whether this is an issue suitable for a JIRA, it's more that
> based on the documentation on Exception Configuration
> [http://struts.apache.org/2.0.14/docs/exception-configuration.html],
[...]

Based on the documentation, except for the second sentence on the page -

"The core idea is that an Exception thrown during the Action method
can be automatically caught and mapped to a predefined Result."

Don't worry about filing a JIRA, I can see where you are coming from.
I'd likely take the time to look at it since the difference between
throwing an exception in the action method and the action constructor
is subtle and I think many people want to use the exception-mapping to
catch any and all sorts of errors.

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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



Forward to another page on Submit

2009-06-23 Thread Sam Wun
Dear all,

I have a problem when I click a submit button of a page, it doesn't go
straight to the next desired page.
Here is my little project:
Firstly, I want to show you how it supposed to flow:
Input page -> Help page

But the problem is it does go to the Help page when I click the submit
button on the Input page.

Here are the source files:

--- input.jsp:

 # cat input.jsp
<%@ include file="/html/portlet/struts_redirect_portlet/init.jsp" %>


Hello the INPUT page.














  
  





   
   


--- help.jsp:
=

 # cat help.jsp
<%@ include file="/html/portlet/struts_redirect_portlet/init.jsp" %>


Hello the HelP FORM ??.














  
  





   
   


-- RedirectAction.java:
=
package com.ip6networks.struts_redirect.portlet;

import com.ip6networks.struts_redirect.portlet.RedirectForm;

import com.liferay.portal.struts.PortletAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/** @struts.action name="RedirectForm" path="/struts_redirect_portlet/input"
 * scope="session"
 * input="/portlet/struts_redirect_portlet/input.jsp"
 *
 * @struts.action-forward name="input"
path="/portlet/struts_redirect_portlet/input.jsp" redirect="true"
 * @struts.action-forward name="help"
path="/portlet/struts_redirect_portlet/help.jsp" redirect="true"
 */
public class RedirectAction extends PortletAction {

public ActionForward execute(
ActionMapping mapping, ActionForm form,
HttpServletRequest req,
HttpServletResponse res)
throws Exception {

RedirectForm redirectForm = (RedirectForm) form;

String comment = redirectForm.getComment().trim();
   if ( comment.length() > 0) {
  return mapping.findForward("help");
}

  return mapping.findForward("input");

}

public ActionForward render(
ActionMapping mapping, ActionForm form,
PortletConfig config,
RenderRequest req, RenderResponse res)
throws Exception {

return mapping.findForward("input");
}
}

--- RedirectForm.java
=
# cat RedirectForm.java
package com.ip6networks.struts_redirect.portlet;

import org.apache.struts.validator.ValidatorForm;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 * @struts.form name="RedirectForm"
 */
public class RedirectForm extends ValidatorForm {
private String comment="";

public String getComment() {return this.comment;}

/**
 * @struts.validator type="required" msgkey="error.comment.required"
*/
public void setComment(String c) {this.comment = c;}

public void reset(ActionMapping mapping, HttpServletRequest req) {
this.comment = "";
}

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest req) {

ActionErrors errors = new ActionErrors();
try{
  if (this.comment == null || this.comment.length() < 1)
   {
errors.add("comment", new
ActionMessage("error.comment.required"));
   }
}
catch(NullPointerException npe){}

return errors;
}

}

--- ReidrectHelpAction.java
=
# cat RedirectHelpAction.java
package com.ip6networks.struts_redirect.portlet;

import com.liferay.portal.struts.PortletAction;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.PortletConfig;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/** @struts.action name="RedirectHelpForm" path="/struts_redirect_portlet/help"
 * scope="session"
 * input="/portlet/struts_redirect_portlet/help.jsp"
 *
 * @struts.action-forward name="help"
path="/portlet/struts_redirect_portlet/help.jsp" redirect="true"
 */

public class RedirectHelpAction extends PortletAction {

public Action

Re: Forward to another page on Submit

2009-06-23 Thread Sam Wun
sorry for the typo, I meant it "DOESN't" go to the Help page when I
click the submit button on the Input page.

On Wed, Jun 24, 2009 at 12:10 AM, Sam Wun wrote:
> Dear all,
>
> I have a problem when I click a submit button of a page, it doesn't go
> straight to the next desired page.
> Here is my little project:
> Firstly, I want to show you how it supposed to flow:
> Input page -> Help page
>
> But the problem is it does go to the Help page when I click the submit
> button on the Input page.
>
> Here are the source files:
>
> --- input.jsp:
> 
>  # cat input.jsp
> <%@ include file="/html/portlet/struts_redirect_portlet/init.jsp" %>
>
> 
>        Hello the INPUT page.
> 
>  type="java.lang.String" />
>
> 
>        
>        
>        
> 
>
> 
>  focus="comment">
>
> 
> 
>  
>  
> 
> 
> 
>
> 
>   
>   
> 
>
> --- help.jsp:
> =
>
>  # cat help.jsp
> <%@ include file="/html/portlet/struts_redirect_portlet/init.jsp" %>
>
> 
>        Hello the HelP FORM ??.
> 
>  type="java.lang.String" />
>
> 
>        
>        
>        
> 
>
> 
> 
>
> 
> 
>  
>  
> 
> 
> 
>
> 
>   
>   
> 
>
> -- RedirectAction.java:
> =
> package com.ip6networks.struts_redirect.portlet;
>
> import com.ip6networks.struts_redirect.portlet.RedirectForm;
>
> import com.liferay.portal.struts.PortletAction;
>
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
>
> import javax.portlet.ActionRequest;
> import javax.portlet.ActionResponse;
> import javax.portlet.PortletConfig;
> import javax.portlet.RenderRequest;
> import javax.portlet.RenderResponse;
>
> import org.apache.struts.action.ActionForm;
> import org.apache.struts.action.ActionForward;
> import org.apache.struts.action.ActionMapping;
>
> /** @struts.action name="RedirectForm" path="/struts_redirect_portlet/input"
>  * scope="session"
>  * input="/portlet/struts_redirect_portlet/input.jsp"
>  *
>  * @struts.action-forward name="input"
> path="/portlet/struts_redirect_portlet/input.jsp" redirect="true"
>  * @struts.action-forward name="help"
> path="/portlet/struts_redirect_portlet/help.jsp" redirect="true"
>  */
> public class RedirectAction extends PortletAction {
>
>        public ActionForward execute(
>                        ActionMapping mapping, ActionForm form,
> HttpServletRequest req,
>                        HttpServletResponse res)
>                throws Exception {
>
>                RedirectForm redirectForm = (RedirectForm) form;
>
>                String comment = redirectForm.getComment().trim();
>               if ( comment.length() > 0) {
>                  return mapping.findForward("help");
>                }
>
>                  return mapping.findForward("input");
>
>        }
>
>        public ActionForward render(
>                        ActionMapping mapping, ActionForm form,
> PortletConfig config,
>                        RenderRequest req, RenderResponse res)
>                throws Exception {
>
>                return mapping.findForward("input");
>        }
> }
>
> --- RedirectForm.java
> =
> # cat RedirectForm.java
> package com.ip6networks.struts_redirect.portlet;
>
> import org.apache.struts.validator.ValidatorForm;
>
> import javax.servlet.http.HttpServletRequest;
>
> import org.apache.struts.action.ActionErrors;
> import org.apache.struts.action.ActionForm;
> import org.apache.struts.action.ActionMapping;
> import org.apache.struts.action.ActionMessage;
>
> /**
>  * @struts.form name="RedirectForm"
>  */
> public class RedirectForm extends ValidatorForm {
>    private String comment="";
>
>    public String getComment() {return this.comment;}
>
>        /**
>     * @struts.validator type="required" msgkey="error.comment.required"
>        */
>    public void setComment(String c) {this.comment = c;}
>
>    public void reset(ActionMapping mapping, HttpServletRequest req) {
>        this.comment = "";
>    }
>
>    public ActionErrors validate(ActionMapping mapping,
> HttpServletRequest req) {
>
>        ActionErrors errors = new ActionErrors();
>        try{
>          if (this.comment == null || this.comment.length() < 1)
>           {
>                errors.add("comment", new
> ActionMessage("error.comment.required"));
>           }
>        }
>        catch(NullPointerException npe){}
>
>        return errors;
>    }
>
> }
>
> --- ReidrectHelpAction.java
> =
> # cat RedirectHelpAction.java
> package com.ip6networks.struts_redirect.portlet;
>
> import com.liferay.portal.struts.PortletAction;
>
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
> import javax.portlet.ActionRequest;
> import javax.portlet.ActionResponse;
> import javax.portlet.PortletConfig;
> import javax.por

Re: Update to Struts 2.1.7

2009-06-23 Thread Pro1712

Thanks for your quick answer!

There is no test1-validation.xml.
test1 does not have a "validate" method ".

I have implemented the "execute" method to see if it is called because
"input" does not get called any more...
I also implemented "validateExecute" method for testing. And it get's called
also.

-- 
View this message in context: 
http://www.nabble.com/Update-to-Struts-2.1.7-tp24166101p24167035.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: Update to Struts 2.1.7

2009-06-23 Thread Musachy Barroso
If you can use "*" in a result, that's news for me.

musachy

On Tue, Jun 23, 2009 at 7:28 AM, Pro1712 wrote:
>
> Thanks for your quick answer!
>
> There is no test1-validation.xml.
> test1 does not have a "validate" method ".
>
> I have implemented the "execute" method to see if it is called because
> "input" does not get called any more...
> I also implemented "validateExecute" method for testing. And it get's called
> also.
>
> --
> View this message in context: 
> http://www.nabble.com/Update-to-Struts-2.1.7-tp24166101p24167035.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
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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



Struts2 Validation Annotations - Message with params

2009-06-23 Thread Robson

Hi all!

I have my validation:
@RequiredStringValidator(key="erro.required")

And in my package.properties:
erro.required={0} is required

How can i use this param ??? 

I tried:
@RequiredStringValidator(message="%{getText('erro.required', new String[]
{'Login'})}")

But it's not working.

Thanks!


-- 
View this message in context: 
http://www.nabble.com/Struts2-Validation-Annotations---Message-with-params-tp24167311p24167311.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: Struts2 static content

2009-06-23 Thread rtd


Musachy Barroso wrote:
> 
> serving static content with struts 2 is probably not a good idea
> (performance and security wise)
> 
Can you expand upon that thought?  At first blush, it strikes me as an
over-generalization, but I'm always interested in learning.
-- 
View this message in context: 
http://www.nabble.com/Struts2-static-content-tp19784601p24167320.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: Struts2 static content

2009-06-23 Thread rtd


Musachy Barroso wrote:
> 
> serving static content with struts 2 is probably not a good idea
> (performance and security wise)
> 
Can you expand upon that thought?  At first blush, it strikes me as an
over-generalization, but I'm always interested in learning.
-- 
View this message in context: 
http://www.nabble.com/Struts2-static-content-tp19784601p24167321.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: Update to Struts 2.1.7

2009-06-23 Thread Martin Gainty

possible he is alluding to wildcard mapping?

The "*" in the path attribute allows the mapping to match the request URIs 
/editSubscription, editRegistration





http://struts.apache.org/2.0.6/docs/wildcard-mappings.html

a definite maybe?
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Tue, 23 Jun 2009 07:52:46 -0700
> Subject: Re: Update to Struts 2.1.7
> From: musa...@gmail.com
> To: user@struts.apache.org
> 
> If you can use "*" in a result, that's news for me.
> 
> musachy
> 
> On Tue, Jun 23, 2009 at 7:28 AM, Pro1712 wrote:
> >
> > Thanks for your quick answer!
> >
> > There is no test1-validation.xml.
> > test1 does not have a "validate" method ".
> >
> > I have implemented the "execute" method to see if it is called because
> > "input" does not get called any more...
> > I also implemented "validateExecute" method for testing. And it get's called
> > also.
> >
> > --
> > View this message in context: 
> > http://www.nabble.com/Update-to-Struts-2.1.7-tp24166101p24167035.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
> >
> >
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 

_
Bing™  brings you maps, menus, and reviews organized in one place.   Try it now.
http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TEXT_MLOGEN_Core_tagline_local_1x1

Re: Struts2 static content

2009-06-23 Thread Musachy Barroso
Struts adds overhead for serving static content. Not that I have ever
done any benchmarking on it, but I know that at my company(large
online retailer), just suggesting to serve static content thru tomcat
instead of apache is a big offense.

musachy

On Tue, Jun 23, 2009 at 8:25 AM, rtd wrote:
>
>
> Musachy Barroso wrote:
>>
>> serving static content with struts 2 is probably not a good idea
>> (performance and security wise)
>>
> Can you expand upon that thought?  At first blush, it strikes me as an
> over-generalization, but I'm always interested in learning.
> --
> View this message in context: 
> http://www.nabble.com/Struts2-static-content-tp19784601p24167321.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
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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



Re: Update to Struts 2.1.7

2009-06-23 Thread Wes Wannemacher
Yea, it works for actions, but it doesn't seem to make sense for result names.

-W

On Tue, Jun 23, 2009 at 11:41 AM, Martin Gainty wrote:
>
> possible he is alluding to wildcard mapping?
>
> The "*" in the path attribute allows the mapping to match the request URIs 
> /editSubscription, editRegistration
>     name="/edit*"
>    class="org.apache.struts.webapp.example.Edit{1}Action">
>            name="failure"
>        path="/mainMenu.jsp"/>
>            path="/\{1\}.jsp"/>
> 
>
> http://struts.apache.org/2.0.6/docs/wildcard-mappings.html
>
> a definite maybe?
> Martin
> __
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
> sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
> oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich 
> dem Austausch von Informationen und entfaltet keine rechtliche 
> Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen 
> wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
> destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
> l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci 
> est interdite. Ce message sert à l'information seulement et n'aura pas 
> n'importe quel effet légalement obligatoire. Étant donné que les email 
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter 
> aucune responsabilité pour le contenu fourni.
>
>
>
>
>> Date: Tue, 23 Jun 2009 07:52:46 -0700
>> Subject: Re: Update to Struts 2.1.7
>> From: musa...@gmail.com
>> To: user@struts.apache.org
>>
>> If you can use "*" in a result, that's news for me.
>>
>> musachy
>>
>> On Tue, Jun 23, 2009 at 7:28 AM, Pro1712 wrote:
>> >
>> > Thanks for your quick answer!
>> >
>> > There is no test1-validation.xml.
>> > test1 does not have a "validate" method ".
>> >
>> > I have implemented the "execute" method to see if it is called because
>> > "input" does not get called any more...
>> > I also implemented "validateExecute" method for testing. And it get's 
>> > called
>> > also.
>> >
>> > --
>> > View this message in context: 
>> > http://www.nabble.com/Update-to-Struts-2.1.7-tp24166101p24167035.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
>> >
>> >
>>
>>
>>
>> --
>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>
>> -
>> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
>> For additional commands, e-mail: user-h...@struts.apache.org
>>
>
> _
> Bing™  brings you maps, menus, and reviews organized in one place.   Try it 
> now.
> http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TEXT_MLOGEN_Core_tagline_local_1x1



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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



Re: Struts2 static content

2009-06-23 Thread Wes Wannemacher
On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso wrote:
> Struts adds overhead for serving static content. Not that I have ever
> done any benchmarking on it, but I know that at my company(large
> online retailer), just suggesting to serve static content thru tomcat
> instead of apache is a big offense.
>
> musachy
>

I had a similar experience at a large online content provider. At the
time, we were bouncing back and forth between tomcat and resin. We
used mod_jk and mod_caucho for integration between httpd and the app
servers. I hate it when rules exist, but there is no data to backup
the rule's existence.

A SysAdmin that I was good friends with and I sat down and performed a
series of benchmarks in our dev lab. The results were not something
that can easily be generalized (we were testing many different
parameters, not just serving static content, things like "hello world"
through SSI vs JSP), but we found that even under heavy load, Tomcat
and Resin were capable of keeping up with httpd. The biggest factor
was JSP compilation (obviously). In our case, we solved that by
crawling sites as part of deployment. On particularly heavy traffic
sites, we would deploy to the app server, crawl it, then open up
traffic from the load balancers.

Even after the benchmarks, we never changed the way sites were
deployed. I think the argument went something like the following -
protagonist - "I don't see any reason to put httpd out in front of
that app, it will only add unnecessary configuration overhead."
antagonist - "Well, we always put httpd out front because it is highly
optimized and fast at serving static content."
protagonist - "That's not necessarily true, we have data that
indicates that tomcat/resin are just as fast with static content,
which sort of makes sense considering how easy it is to find a
resource then serve it, I mean, what advanced techniques do you think
httpd employs?"
antagonist - "Well, we always put httpd out front because it is highly
optimized and fast at serving static content."

That being said, I generally put the app servers behind a copy of
httpd for configuration not performance. I can't say whether httpd has
more options than Tomcat or vice versa. I have been using httpd so
long, and writing CGI long before writing JSP, so I am just more
familiar with httpd's advanced configuration options (host header
based vhosting, bandwidth throttling, etc.).

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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



Re: Struts2 static content

2009-06-23 Thread Wes Wannemacher
On Tue, Jun 23, 2009 at 12:11 PM, Wes Wannemacher wrote:
> On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso wrote:
>> Struts adds overhead for serving static content. Not that I have ever
>> done any benchmarking on it, but I know that at my company(large
>> online retailer), just suggesting to serve static content thru tomcat
>> instead of apache is a big offense.
>>
>> musachy
>>
>
> I had a similar experience at a large online content provider. At the
> time, we were bouncing back and forth between tomcat and resin. We
> used mod_jk and mod_caucho for integration between httpd and the app
> servers. I hate it when rules exist, but there is no data to backup
> the rule's existence.
>

To follow that up, check out Chapter 4 of Tomcat: The Definitive
Guide, the author goes into detail load testing Tomcat and HTTPD -

http://oreilly.com/catalog/9780596101060/chapter/index.html

The author does a good job of covering the tools, which I think is
important since everyone should test for themselves.

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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



Re: Struts2 static content

2009-06-23 Thread Musachy Barroso
this sounds like a good topic for Myth Buster

/geek_out

On Tue, Jun 23, 2009 at 9:25 AM, Wes Wannemacher wrote:
> On Tue, Jun 23, 2009 at 12:11 PM, Wes Wannemacher wrote:
>> On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso wrote:
>>> Struts adds overhead for serving static content. Not that I have ever
>>> done any benchmarking on it, but I know that at my company(large
>>> online retailer), just suggesting to serve static content thru tomcat
>>> instead of apache is a big offense.
>>>
>>> musachy
>>>
>>
>> I had a similar experience at a large online content provider. At the
>> time, we were bouncing back and forth between tomcat and resin. We
>> used mod_jk and mod_caucho for integration between httpd and the app
>> servers. I hate it when rules exist, but there is no data to backup
>> the rule's existence.
>>
>
> To follow that up, check out Chapter 4 of Tomcat: The Definitive
> Guide, the author goes into detail load testing Tomcat and HTTPD -
>
> http://oreilly.com/catalog/9780596101060/chapter/index.html
>
> The author does a good job of covering the tools, which I think is
> important since everyone should test for themselves.
>
> -Wes
>
> --
> Wes Wannemacher
> Author - Struts 2 In Practice
> Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> http://www.manning.com/wannemacher
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

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



Re: Struts2 static content

2009-06-23 Thread Wes Wannemacher
On Tue, Jun 23, 2009 at 12:29 PM, Musachy Barroso wrote:
> this sounds like a good topic for Myth Buster
>
> /geek_out
>

Only if they do it in true MythBuster form and the servers blow up.

-Wes

-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

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



Cannot find bean - Please HELP.

2009-06-23 Thread Sam Wun
Dear all,

I was trying to going from one JSP page to another, where each JSP
page has a submit button... and a Form bean as well.
But when I click a submit button on the first JSP page, it said that
the second Form bean is not found in the second JSP page.
The workflow is supposed to be:
RedirectForm -> RedirectHelpForm
Can anyone please shed some light on me to resolve this issue?
Thank you very much in advance.

Here is the error:
02:26:27,748 ERROR [PortletRequestDispatcherImpl:316]
org.apache.jasper.JasperException: javax.servlet.ServletException:
javax.servlet.jsp.JspException: Cannot find bean: "RedirectHelpForm"
in any scope
org.apache.jasper.JasperException: javax.servlet.ServletException:
javax.servlet.jsp.JspException: Cannot find bean: "RedirectHelpForm"
in any scope
at 
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)

Here are all the codes:
--- struts-config.xml:
===
# cat docroot/WEB-INF/struts-config.xml

http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd";>





















--- input.jsp:
===
# cat input.jsp
<%@ include file="/html/portlet/struts_redirect_portlet/init.jsp" %>


Hello the hell.














  
  





   
   


--- help.jsp:
===
# cat help.jsp
<%@ include file="/html/portlet/struts_redirect_portlet/init.jsp" %>


Hello the HelP FORM ??.














  
  





   
   



--- RedirectAction.java:
=
public class RedirectAction extends PortletAction {

public ActionForward execute(
ActionMapping mapping, ActionForm form,
HttpServletRequest req,
HttpServletResponse res)
throws Exception {

RedirectForm redirectForm = (RedirectForm) form;

String comment = redirectForm.getComment().trim();
   if ( comment.length() > 0) {
  return mapping.findForward("help");
}

  return mapping.findForward("input");

}

public ActionForward render(
ActionMapping mapping, ActionForm form,
PortletConfig config,
RenderRequest req, RenderResponse res)
throws Exception {

return mapping.findForward("input");
}

}


--- RedirectHelpAction.java:
===
public class RedirectHelpAction extends PortletAction {

public ActionForward execute(
ActionMapping mapping, ActionForm form,
HttpServletRequest req,
HttpServletResponse res)
throws Exception {

   return mapping.findForward("help");
}

public ActionForward render(
ActionMapping mapping, ActionForm form,
PortletConfig config,
RenderRequest req, RenderResponse res)
throws Exception {

return mapping.findForward("help");
}
}


-- RedirectForm.java:
===
public class RedirectForm extends ValidatorForm {
private String comment="";

public String getComment() {return this.comment;}

/**
 * @struts.validator type="required" msgkey="error.comment.required"
*/
public void setComment(String c) {this.comment = c;}

public void reset(ActionMapping mapping, HttpServletRequest req) {
this.comment = "";
}

public ActionErrors validate(ActionMapping mapping,
HttpServletRequest req) {

ActionErrors errors = new ActionErrors();
try{
  if (this.comment == null || this.comment.length() < 1)
   {
errors.add("comment", new
ActionMessage("error.comment.required"));
   }
}
catch(NullPointerException npe){}

return errors;
}

}


--- RedirectHelpForm.java
==
public class RedirectHelpForm extends ValidatorForm {
private String name="";

public String getName() {return this.name;}

/**
 * @struts.validator type="required" msgkey="error.name.required"
*/
public void setName(String c) {this.name = c;}

public void reset(ActionMapping mapping, HttpServletRequest req) {
  

What is Struts 2 equivalent of PlugIn?

2009-06-23 Thread laredotornado

Hi,

I'm migrating my app from struts 1 to Struts 2.  In my Struts 1 app, I had
this class ...

public class RefreshAction extends Action implements PlugIn  {
   ...
}

and this in my struts-config.xml file ...



So how do I convert this to Struts 2?  There doesn't seem to be a support
for "plug-in".  My goal is to develop an action class that I can also invoke
automatically upon application startup.

Thanks, - Dave
-- 
View this message in context: 
http://www.nabble.com/What-is-Struts-2-equivalent-of-PlugIn--tp24167571p24167571.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: Struts2 static content

2009-06-23 Thread Martin Gainty

ive heard that too
TC supports Cache-Control, Expires and Last-Modified for cache control
// Required Cache Control Headers
String maxage = "86400"; // One day in Seconds
response.setHeader("Cache-Control", "max-age="+ maxage);

long relExpiresInMillis = System.currentTimeMillis() + (1000 * 
Long.parseLong(maxage));
response.setHeader("Expires", getGMTTimeString(relExpiresInMillis));

response.setHeader("Last-Modified", getGMTTimeString(file.lastModified()));but 
Apache seems to implement caching primarily thru the expires module (except 
what the browser caches)
http://httpd.apache.org/docs/2.0/mod/mod_expires.html
http://www.websiteoptimization.com/speed/tweak/cache

Options FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
Allow from all
ExpiresDefault A300

Expires A86400


Expires A2592000


300 second is default caching for all files...1 day caching for html files...30 
days for pics and js

the question i have is what happens with bascially static JS files (such as 
Dojo)
typical Apache Server happily downloads untouched static JS files for each and 
every access (except for FilesMatch excps)
i think component plugins such as Struts-dojo plugin a better option to cache 
static JS files on the TC side 

thanks,
Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Tue, 23 Jun 2009 09:29:11 -0700
> Subject: Re: Struts2 static content
> From: musa...@gmail.com
> To: user@struts.apache.org
> 
> this sounds like a good topic for Myth Buster
> 
> /geek_out
> 
> On Tue, Jun 23, 2009 at 9:25 AM, Wes Wannemacher wrote:
> > On Tue, Jun 23, 2009 at 12:11 PM, Wes Wannemacher wrote:
> >> On Tue, Jun 23, 2009 at 11:45 AM, Musachy Barroso wrote:
> >>> Struts adds overhead for serving static content. Not that I have ever
> >>> done any benchmarking on it, but I know that at my company(large
> >>> online retailer), just suggesting to serve static content thru tomcat
> >>> instead of apache is a big offense.
> >>>
> >>> musachy
> >>>
> >>
> >> I had a similar experience at a large online content provider. At the
> >> time, we were bouncing back and forth between tomcat and resin. We
> >> used mod_jk and mod_caucho for integration between httpd and the app
> >> servers. I hate it when rules exist, but there is no data to backup
> >> the rule's existence.
> >>
> >
> > To follow that up, check out Chapter 4 of Tomcat: The Definitive
> > Guide, the author goes into detail load testing Tomcat and HTTPD -
> >
> > http://oreilly.com/catalog/9780596101060/chapter/index.html
> >
> > The author does a good job of covering the tools, which I think is
> > important since everyone should test for themselves.
> >
> > -Wes
> >
> > --
> > Wes Wannemacher
> > Author - Struts 2 In Practice
> > Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
> > http://www.manning.com/wannemacher
> >
> > -
> > To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> > For additional commands, e-mail: user-h...@struts.apache.org
> >
> >
> 
> 
> 
> -- 
> "Hey you! Would you help me to carry the stone?" Pink Floyd
> 
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
> 

_
Bing™  brings you maps, menus, and reviews organized in one place.   Try it now.
http://www.bing.com/search?q=restaurants&form=MLOGEN&publ=WLHMTAG&crea=TEXT_MLOGEN_Core_tagline_local_1x1

Struts FilterDispatcher issue with regard to specification 2.4

2009-06-23 Thread Struts Two

Hello All:

In Servlet specification 2.4 filters are not supposed to be accessed directly 
as a resource. And anything other than a jsp page need to have a Servlet 
mapping in order to make it accessible (as per specification).

Struts 1 had ActionServlet which allowed for servlet mapping of *.action or 
*.do which could in turn be picked up by Websphere Applicton Server duing 
plugin generation to be used for http webserver.

However, in struts 2 filter mapping for *.action or *.do will not work anymore 
during plugin generation as it is not supported per 2.4 specification. This 
would make the application unaccessible though Http server.

I was wondering if someone can explain to me the rational to use DispatchFilter 
as opposed to a DispatchServlet in struts 2.


  __
Looking for the perfect gift? Give the gift of Flickr! 

http://www.flickr.com/gift/

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



Getting method or action from within prepare() method

2009-06-23 Thread Greg Lindholm
I started writing this as a question then I discovered the answer so thought
I would share it as FYI.

Question:
I have Preparable CRUD actions that have multiple action methods like
doNew(), doCreate(), doEdit(), doUpdate(), doDelete().

I have found at least one case where I need to know, in the prepare()
method, which action method is going to be called.
How do you find out?

Answer:
You can add multiple  prepare{METHOD}() methods like prepareDoDelete(),
prepareDoUpdate() and the one matching the action method will be called
first before the prepare() method.


Selection of s:optgroup on page load

2009-06-23 Thread Rubbinio

Hi,

i have the select below which uses s:optgroup to group my values. The
soCustomerFiltration is TreeMap, while the
customerFilter is an String[].

All work well in terms of rendering except that once I select something and
press a button to update the page my selection is not persisted. I can see
the getCustomerFilter being called on the action and the values returned are
the correct id's but I can not understand why my values are not selected
anymore. Any help is appreciated. 







Thanks
Radu
-- 
View this message in context: 
http://www.nabble.com/Selection-of-s%3Aoptgroup-on-page-load-tp24175975p24175975.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



Could not find property

2009-06-23 Thread Gustavo Straube

Hi all!

I've been reading in this mailing list and other discussions about messages
like this:

Could not find property [org.apache.catalina.jsp_file]

Everybody talks about turn the debug mode (struts.devMode) off. But I want
to know if it's the best solution. What are you think about it? There is a
way to fix this warnings?

Thanks in advance!

Gustavo
-- 
View this message in context: 
http://www.nabble.com/Could-not-find-property-tp24176580p24176580.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: Getting method or action from within prepare() method

2009-06-23 Thread Martin Gainty

this is good information

can someone update the doc @
http://struts.apache.org/2.0.11/docs/prepare-interceptor.html

Martin 
__ 
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger 
sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung 
oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem 
Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. 
Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung 
fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le 
destinataire prévu, nous te demandons avec bonté que pour satisfaire informez 
l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est 
interdite. Ce message sert à l'information seulement et n'aura pas n'importe 
quel effet légalement obligatoire. Étant donné que les email peuvent facilement 
être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité 
pour le contenu fourni.




> Date: Tue, 23 Jun 2009 18:25:10 -0400
> Subject: Getting method or action from within prepare() method
> From: greg.lindh...@gmail.com
> To: user@struts.apache.org
> 
> I started writing this as a question then I discovered the answer so thought
> I would share it as FYI.
> 
> Question:
> I have Preparable CRUD actions that have multiple action methods like
> doNew(), doCreate(), doEdit(), doUpdate(), doDelete().
> 
> I have found at least one case where I need to know, in the prepare()
> method, which action method is going to be called.
> How do you find out?
> 
> Answer:
> You can add multiple  prepare{METHOD}() methods like prepareDoDelete(),
> prepareDoUpdate() and the one matching the action method will be called
> first before the prepare() method.

_
Hotmail® has ever-growing storage! Don’t worry about storage limits.
http://windowslive.com/Tutorial/Hotmail/Storage?ocid=TXT_TAGLM_WL_HM_Tutorial_Storage_062009

Re: Getting method or action from within prepare() method

2009-06-23 Thread Dave Newton

Martin Gainty wrote:

this is good information

can someone update the doc @
http://struts.apache.org/2.0.11/docs/prepare-interceptor.html


Update it to say what?

It already states:

1. if the action class have prepare{MethodName}(), it will be invoked
2. else if the action class have prepareDo(MethodName()}(), it will be 
invoked


That the documentation already contained the information you're asking 
be added aside, we can't update already-released docs.


Dave

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



Re: Exceptions thrown by constructor different from those thown by execute() ?

2009-06-23 Thread Dave Newton

Wes Wannemacher wrote:

On Tue, Jun 23, 2009 at 8:50 AM, Jim Kiley wrote:
[...]

From a philosophical perspective, though -- no clue, I don't have a lot of
insight into why the devs make all the decisions they make.


[...]

The decisions I make are usually heavily weighted by how impressed
girls will be :)


Hey, wait, that works for you?!

I've been following that strategy for years and so far it hasn't paid 
off. Maybe now that I can do really sexy byte-code manipulation I'll 
finally get that happy ending.


Dave

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



Re: Struts2 and Security

2009-06-23 Thread aum strut
Thanks Dave for the details, as my self also not very much known about the
spring so may be we have to look in to this and in the draft in more
details.



On Tue, Jun 23, 2009 at 5:54 PM, Dave Newton  wrote:

> aum strut wrote:
>
>> Our requirement is to use good authentication framework for our
>> application
>> and as per the initial application draft we are not going to use spring in
>> our application.
>>
>> as we have found that Spring Security is quite a matured framework so we
>> are
>> just investigating the option, if we can use it without using spring at
>> all,
>> but as suggested if we can use it by including only some libraries than
>> this
>> is not a bad choice at all.
>>
>
> I'm pretty sure that Spring Security requires the use of Spring--I'm not
> sure how this fact can escape you. Here's the first sentence of the first
> paragraph on the Spring Security site:
>
> "Spring Security is one of the most mature and widely used Spring
> projects."
>
> Just because Spring isn't being used by anything *else* in your app doesn't
> mean it doesn't use Spring.
>
> (It's difficult for me to understand why you'd not want to use Spring
> anywhere else in the app, unless you're using another IoC/DI solution.)
>
>
> Dave
>
> -
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>
>