Re: where to set 'struts.multipart.parser' property in struts2?

2010-01-12 Thread Lukasz Lenart
2010/1/13 Stephen Ince :
> WEB-INF/classes/struts.xml
>     value="org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequestx"
> />

Take a look on struts-default.xml, you have to define bean and then constant






Regards
-- 
Lukasz
Kapituła Javarsovia 2010
http://javarsovia.pl

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



where to set 'struts.multipart.parser' property in struts2?

2010-01-12 Thread Stephen Ince
Hi,
  I am using struts2 version 2.1.8.1 and I am trying to set the
struts.multipart.parser property. I can't seem to set it. I have tried
every where, one place at a time.
This is what I have tried.

WEB-INF/classes/struts.xml


WEB-INF/classes/struts.properties

struts.multipart.parser=org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequestx

WEB-INF/classes/loadgeneral.xml 

10240
org.apache.struts2.dispatcher.multipart.JakartaMultiPartRequestx
/.deleted


I have also tried setting 'struts.multipart.saveDir' but that is not
being set either.
I am getting the follwing warning:
INFO: Unable to find 'struts.multipart.saveDir' property setting. Defaulting to
javax.servlet.context.tempdir

Question:
  Does any have an idea of what could be the problem or where I should
set the 'struts.multipart.parser' property?
  Any help would be greatly appreciated?

Steve

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



Struts 1.1 EL error moving to Servlet 2.4

2010-01-12 Thread Jim Kennedy
I've had quite a few issues with EL moving from Servlet 2.3 to 2.4 (JBOSS
4.0 to 4.2).  I have worked out my straight JSTL issues by changing my
taglib definitions, but my struts tags that use EL are not working
correctly.  This project started out using Struts 1.1 then I added the
struts-el.jar to allow for EL in my struts tags.  This all worked great
until my recent upgrade.  I get the infamous message:
 
According to TLD or attribute directive in tag file, attribute value does
not accept any expressions.
 
More specifically I get:
 
According to TLD or attribute directive in tag file, attribute arg0 does not
accept any expressions.  I get this for the following code:


The details of the above don't really matter, but it is obvious that the new
version of the servlet spec I am running does not like the use of
expressions.

The old version ran under Servlet 2.3, JSTL 1.0 and JSP 1.2

The new version runs under Servlet 2.4, JSTL 1.1 and JSP 2.0

Any advice would be great.  I'm hoping not to have to change my struts libs
as I am concerned about moving from 1.1 to 1.3.

Thanks

 

Jim Kennedy

 


Re: Distinguish between request parameters and struts.xml parameters in Struts2

2010-01-12 Thread Gabriel Belingueres
Implement interface ParameterAware: if the "resource" key is not in
the parameter map, then the variable was set by other means than input
parameters.

2010/1/12 JOSE L MARTINEZ-AVIAL :
>  Distinguish between request parameters and struts.xml parameters in Struts2
>
> Hi all,
>  I'm trying to distinguish the parameters that come from the request from
> those that come from the params defined in the struts.xml. For example, I
> have the following mapping in my struts.xml
>
>        
>            my resource
>            /example/Login.jsp
>            Menu
>        
>
> The call to that action will have a variable number of parameters, so I want
> to distinguish between them and the parameter defined in the struts.xml. How
> can I do that? In Struts 1 I was able to use the tag , and
> since the action was separated from the form, there was no problem, but in
> Struts2 that is no longer possible. Any ideas?
>
> Thanks
>
> Jose Luis
>

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



Distinguish between request parameters and struts.xml parameters in Struts2

2010-01-12 Thread JOSE L MARTINEZ-AVIAL
 Distinguish between request parameters and struts.xml parameters in Struts2

Hi all,
  I'm trying to distinguish the parameters that come from the request from
those that come from the params defined in the struts.xml. For example, I
have the following mapping in my struts.xml


my resource
/example/Login.jsp
Menu


The call to that action will have a variable number of parameters, so I want
to distinguish between them and the parameter defined in the struts.xml. How
can I do that? In Struts 1 I was able to use the tag , and
since the action was separated from the form, there was no problem, but in
Struts2 that is no longer possible. Any ideas?

Thanks

Jose Luis


Re: How struts2 supports "optgroup"?

2010-01-12 Thread Gabriel Belingueres
http://struts.apache.org/2.1.8.1/docs/optgroup.html

2010/1/12 Emi Lu :
> Good afternoon,
>
> Could someone tell me how struts2 support "optgroup" please?
>
> Thanks a lot!
> --
> Lu Ying
>
>
> 
> 
> Sydney
> Melbourne
> 
> 
> Cromwell
> Queenstown
> 
> 
>
> -
> 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: Can I implement interface of another project in a struts 2 project?

2010-01-12 Thread Gabriel Belingueres
Seems it is not S2 related. This exception is raised when some
dependency is not found by the JVM. Note that in addition to be
available in your build path, the dependency must be available at
runtime too (usually inside the WEB-INF/lib folder)

2010/1/12 fireapple :
>
> In project1, I include project2 in order to use interfaces (interface A, B,
> C, D.) of project2.
> However, the system always claim java.lang.NoClassDefFoundError for
> interface of project2.
>
> I also exported project2 to a JAR and include it in project1's build path,
> still no luck.
>
> I tried 3 of my projects, all fail with the same error. I was wondering if
> it's a struts 2 issue of my configuration problem.
>
> Thanks
> --
> View this message in context: 
> http://old.nabble.com/Can-I-implement-interface-of-another-project-in-a-struts-2-project--tp27131976p27131976.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



Integrating with ZK

2010-01-12 Thread Rafael Taboada
Hi folks,

I'm just having a review of ZK framework and I want to know if there is a
tip, tutorial, etc about how to integrate Struts 2 with ZK.

Thanks in advance

-- 
Rafael Taboada
Software Engineer

Cell : +511-992741026

"No creo en el destino pues no me gusta tener la idea de controlar mi vida"


How struts2 supports "optgroup"?

2010-01-12 Thread Emi Lu

Good afternoon,

Could someone tell me how struts2 support "optgroup" please?

Thanks a lot!
--
Lu Ying




Sydney
Melbourne


Cromwell
Queenstown



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



Re: How to use tag

2010-01-12 Thread Aruna Ponaka

I am retrieving images from Action class onto jsp using
img src=">

I have to pass imageid, which should be used in the Action class to return a
particular book. I am able to retrieve images but not able to pass this
value to Action class. How can I achieve this?I do not have any forms in my
JSP.
-- 
View this message in context: 
http://old.nabble.com/How-to-use-%3Cs%3Aparam%3E-tag-tp27117122p27131980.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



Can I implement interface of another project in a struts 2 project?

2010-01-12 Thread fireapple

In project1, I include project2 in order to use interfaces (interface A, B,
C, D.) of project2.
However, the system always claim java.lang.NoClassDefFoundError for
interface of project2.

I also exported project2 to a JAR and include it in project1's build path,
still no luck.

I tried 3 of my projects, all fail with the same error. I was wondering if
it's a struts 2 issue of my configuration problem. 

Thanks
-- 
View this message in context: 
http://old.nabble.com/Can-I-implement-interface-of-another-project-in-a-struts-2-project--tp27131976p27131976.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: [S2] Does global exception mapping work with interceptor?

2010-01-12 Thread Gabriel Belingueres
Is your custom interceptor _before_ the exception interceptor in your
interceptor stack? If that's the case, then the exception interceptor
is not "catching" exceptions from your interceptor because it executes
after.

2010/1/12  :
> Hello,
>
> I've defined a global exception mapping and global result, when Exception 
> happen it will go to my custom error page. It work fine in Action if Action 
> throw any exception. But if my interceptor throw exception, it won't go to my 
> error page.
>
> Is there anyway to make it work?
>
> Thanks
> LV

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



[S2] Does global exception mapping work with interceptor?

2010-01-12 Thread mailtolouis2020-struts
Hello,

I've defined a global exception mapping and global result, when Exception 
happen it will go to my custom error page. It work fine in Action if Action 
throw any exception. But if my interceptor throw exception, it won't go to my 
error page.

Is there anyway to make it work? 

Thanks
LV

Re: [S2] Iterate over sessions

2010-01-12 Thread Lukasz Lenart
You can create a class that implements HttpSessionListener [1] and
there register active user session in some global variable (bad idea).
Or create custom interceptor that will all the time verify if given
user is locked and forward him to appropriated page.

[1] 
http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/http/HttpSessionListener.html


Regards
-- 
Lukasz
Kapituła Javarsovia 2010
http://javarsovia.pl

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



[S2] Iterate over sessions

2010-01-12 Thread Gustavo Felisberto
Hello All,

 

I have a Web application where I handle the logged in status with some
variable in the session. I have some actions for the Administrator where we
can control if a particular user account is locked or not. My problem is
that if a user loges in and after that the admin locks the account the user
can continue to use the application until he logs out and tries to login
again.

 

I did not want to have to go to the database each time the user performs an
action. So when the Admin locks a user I would like to iterate over all
sessions to see if that user is logged in and force a logout.

 

So my question is how can I access all created sessions?

 

-- 

Gustavo Felisberto.

WIT-Software S.A.

Coimbra (Portugal), San Jose (California)

Phone: +351239801030

Web:   http://www.wit-software.com 

 



Re: Define Global Timeout [S2]

2010-01-12 Thread Gabriel Belingueres
I don't know if you can make this work.

IIRC, interceptor instances are created one by interceptor stack, so
the same instance is shared by all requests that go through that
stack. This makes the interceptor (at best) serialize all requests in
its wait-notify cycle. However, I think it is buggy since the notify()
can wake up any other waiting thread, not the one that created the 2
worker threads: you may assign a unique value to each interceptor call
to associate to the 2 workers for identifying who need to wake and who
need to go to sleep again.

Java monitors uses signal and continue semantics, so you need to
precede the wait with a while loop:
while (justAwakedThreadId != currentId) { wait() }

Also, I think you can safely replace the watchdog thread with just a
call to wait(milliseconds).

One last point to consider is what to do with the generated response,
you may want to implement certain logic inside a PreResultListener to
determine what to do?

HTH

2010/1/11 Jorge Sousa :
> Hi,
>
> First of all sorry for my bad english :)
> I need to implement a feature in my application, that will enable me to
> define the timeout of every request.
> I tried to create a Interceptor and put the main thread on wait, while other
> 2 threads, one will handle the time, and the other will make the
> invocation.invoke(). The first of this two threads to complete, will call
> the notify of the main thread and the correspondent result is returned.
>
> I tried this approach, but i get a null pointer exception in the thread that
> tried to execute the invocation.invoke().
>
> Is there any suggestions?
>
> If some one need more explanations, please let me know.
> You can find the code bellow.
>
> Thanks in advance,
> Jorge Sousa from Portugal
>
> Code:
>
> public class TimeoutInterceptor extends AbstractInterceptor {
>
>    private static final ExecutorService threadPool =
> Executors.newCachedThreadPool();
>
>   �...@override
>    public String intercept(ActionInvocation invocation) throws Exception {
>        Invocator invocator = new Invocator(invocation, this);
>        TimeoutWatcher timeoutWatcher = new TimeoutWatcher(this);
>
>        threadPool.execute(invocator);
>        threadPool.execute(timeoutWatcher);
>
>        this.wait();
>        if (invocator.getResult().equalsIgnoreCase("running")) {
>            throw new TimeOutException();
>        } else {
>            return invocator.getResult();
>        }
>
>    }
>
>    private class TimeoutWatcher implements Runnable {
>
>        private AbstractInterceptor abstractInterceptor;
>
>        public TimeoutWatcher(AbstractInterceptor abstractInterceptor) {
>            this.abstractInterceptor = abstractInterceptor;
>        }
>
>       �...@override
>        public void run() {
>            try {
>                Thread.sleep(1);
>            } catch (InterruptedException e) {
>            }
>            synchronized (abstractInterceptor) {
>                abstractInterceptor.notify();
>            }
>        }
>    }
>
>    private class Invocator implements Runnable {
>
>        private ActionInvocation invocation;
>        private String result = "running";
>        private AbstractInterceptor abstractInterceptor;
>
>        public Invocator(ActionInvocation invocation, AbstractInterceptor
> abstractInterceptor) {
>            this.invocation = invocation;
>            this.abstractInterceptor = abstractInterceptor;
>        }
>
>       �...@override
>        public void run() {
>            try {
>                result = invocation.invoke();
>                synchronized (abstractInterceptor) {
>                    abstractInterceptor.notify();
>                }
>            } catch (Exception e) {
>                result = "error";
>            }
>        }
>
>        public String getResult() {
>            return result;
>        }
>    }
>
> }
>
>
>
>
>
>

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



Re: How to use tag

2010-01-12 Thread Aruna Ponaka


I have seen this syntax, I am not sure how to use it for my purpose. I get
id's from an sql query. I am retrieving them in a list and need to pass them
one by one to the action class. How to set them so that I can pass them as
params to the Action class? Also my code is like
"
style="margin-right:20px;"  />..
If i provide 
, it is not going to the Action class.


-- 
View this message in context: 
http://old.nabble.com/How-to-use-%3Cs%3Aparam%3E-tag-tp27117122p27127855.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: Define Global Timeout [S2]

2010-01-12 Thread Jorge Sousa

Hi,

I can´t change the Tomcat, and i don´t think that change the Tomcat will 
help me to accomplish the feature that i want.


My action does several call's to a external API, and i want to ensure 
that all the call's won't exceed the time that i defined in the timeout.
Changing the Tomcat, will only works for each request, instead of the 
total time of the execution of the action.


I hope this extra information is usefull to help everyone helping me :)

Thanks.

Jorge

On 11-01-2010 19:54, Brian Thompson wrote:

Honestly, this sounds like something that should be handled at the
application server level.  What server are you using?

If you're using Tomcat via the Tomcat connector, take a look at reply
timeouts on [1].

If you're not using Tomcat, I'm sure there are similar options in other app
servers.

-Brian

[1] - http://tomcat.apache.org/connectors-doc/generic_howto/timeouts.html


On Mon, Jan 11, 2010 at 12:48 PM, Jorge Sousa
wrote:

   

Hi,

First of all sorry for my bad english :)
I need to implement a feature in my application, that will enable me to
define the timeout of every request.
I tried to create a Interceptor and put the main thread on wait, while
other 2 threads, one will handle the time, and the other will make the
invocation.invoke(). The first of this two threads to complete, will call
the notify of the main thread and the correspondent result is returned.

I tried this approach, but i get a null pointer exception in the thread
that tried to execute the invocation.invoke().

Is there any suggestions?

If some one need more explanations, please let me know.
You can find the code bellow.

Thanks in advance,
Jorge Sousa from Portugal

Code:

public class TimeoutInterceptor extends AbstractInterceptor {

private static final ExecutorService threadPool =
Executors.newCachedThreadPool();

@Override
public String intercept(ActionInvocation invocation) throws Exception {
Invocator invocator = new Invocator(invocation, this);
TimeoutWatcher timeoutWatcher = new TimeoutWatcher(this);

threadPool.execute(invocator);
threadPool.execute(timeoutWatcher);

this.wait();
if (invocator.getResult().equalsIgnoreCase("running")) {
throw new TimeOutException();
} else {
return invocator.getResult();
}

}

private class TimeoutWatcher implements Runnable {

private AbstractInterceptor abstractInterceptor;

public TimeoutWatcher(AbstractInterceptor abstractInterceptor) {
this.abstractInterceptor = abstractInterceptor;
}

@Override
public void run() {
try {
Thread.sleep(1);
} catch (InterruptedException e) {
}
synchronized (abstractInterceptor) {
abstractInterceptor.notify();
}
}
}

private class Invocator implements Runnable {

private ActionInvocation invocation;
private String result = "running";
private AbstractInterceptor abstractInterceptor;

public Invocator(ActionInvocation invocation, AbstractInterceptor
abstractInterceptor) {
this.invocation = invocation;
this.abstractInterceptor = abstractInterceptor;
}

@Override
public void run() {
try {
result = invocation.invoke();
synchronized (abstractInterceptor) {
abstractInterceptor.notify();
}
} catch (Exception e) {
result = "error";
}
}

public String getResult() {
return result;
}
}

}






 
   



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



Re: How to use tag

2010-01-12 Thread wild_oscar


en

English

Aruna Ponaka wrote:
> 
> what is the correct syntax to provide in the VALUE?
> 
> 
> 

-- 
View this message in context: 
http://old.nabble.com/How-to-use-%3Cs%3Aparam%3E-tag-tp27117122p27125733.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