You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Kiesewetter S., ITSC Bonn, RV, EF, extern" <Sv...@dp-itsolutions.de> on 2008/06/11 11:47:45 UTC

Determining an Action's class

Hello there,

i want to determine an action's class and method using the action's
namespace and name. I found nothing using the documentation :-(

How may i to this?

Thx, Sven

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


Re: How to debug Struts2 tag runtime problems ?

Posted by Ralf Fischer <th...@googlemail.com>.
Hi,

On Wed, Jun 11, 2008 at 12:55 PM, Eddie Lau TO <ta...@yahoo.com.hk> wrote:
> For example,
> using <s:select list="" ...
>
> if the value supplied into list attribute is wrong,
> the translated page start from the position of <s:select> tag will be blank.
>
> How to get more information of tag-related problem for troubleshooting ?

Is the box "really" empty or did just the listKey/listValue
expressions on each item of the list fail?

When the select box is "really" empty and you (want) fill it with a
value from either your action or your model, most likely the OGNL
expression is wrong. Thus it would help to increase the log level of
OGNL, as it evaluates the expression handed as list and will then
report the error. IIRC this can be done by configuring some log4j
log4j appenders, but you'll have to look up the correct
categories/loggers which will do the trick.

If this gives no viable insights you always can get the
struts/xwork/ognl code involed, attatch it to your project and debug
the code directly in your container using the shared memory or remote
debugging interface of your JVM. Most likely it will suffice to break
in the struts component class which is invoked by the tag, then check
the list expression which was set into it and try to find the object
yourself by hand by inspecting the ValueStack object in the struts
component. The errorrous part of the expression should become obvious
then.

My 2 cents, hope they help.

Bye,
-Ralf

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


Re: AW: Determining an Action's class

Posted by suprie <su...@gmail.com>.
how about <s:action/>  tag ??  you can define namespace, action , and
the method also

On Wed, 2008-06-11 at 12:50 +0200, Kiesewetter S., ITSC Bonn, RV, EF,
extern wrote:

> > yes you can,
> >  <action name="action_name" method="method" class="class"/>
> > you can even define different actions for each method in class 
> 
> Thx for the answer, but you didn't understand the question. I defined
> several actions. Now i want to determine the class+method of an action
> inside of a jsp page or inside of one of the tags of my own taglib.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 

Re: AW: Determining an Action's class

Posted by David Evans <ds...@berndtgroup.net>.
If I understand your question correctly, what you are looking for is in
the ActionProxy:
http://struts.apache.org/2.0.11.1/struts2-core/apidocs/com/opensymphony/xwork2/ActionProxy.html

It has getAction and getMethod methods.

I'm not sure how to easily get ahold of the ActionProxy within a jsp.
this works on my tomcat set up, using the jsp expression language:
${requestScope['struts.valueStack'].context['com.opensymphony.xwork2.ActionContext.actionInvocation'].proxy}

Not very pretty, I'd guess there is a more graceful way, anyone know?

Dave



On Wed, 2008-06-11 at 12:50 +0200, Kiesewetter S., ITSC Bonn, RV, EF,
extern wrote:
> > yes you can,
> >  <action name="action_name" method="method" class="class"/>
> > you can even define different actions for each method in class 
> 
> Thx for the answer, but you didn't understand the question. I defined
> several actions. Now i want to determine the class+method of an action
> inside of a jsp page or inside of one of the tags of my own taglib.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 


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


Re: AW: Determining an Action's class

Posted by Joakim von Brandis <jo...@mnemonic.no>.
Kiesewetter S., ITSC Bonn, RV, EF, extern wrote:
>> yes you can,
>>  <action name="action_name" method="method" class="class"/>
>> you can even define different actions for each method in class 
>>     
>
> Thx for the answer, but you didn't understand the question. I defined
> several actions. Now i want to determine the class+method of an action
> inside of a jsp page or inside of one of the tags of my own taglib.
>   
I guess you mean you want to dynamically determine the action to go to next?

In that case, how about going to one action, and in that action
determine next-step.
Then, in the struts.xml, define a chain to the correct action based on
the output.


<action name="distrib" ...>
    <result name="result1" type="chain">
       <param name="actionName">action1</param>
    </result>
    <result name="result2" type="chain">
       <param name="actionName">action2</param>
    </result>
    ...
</action>


(sorry for typos in xml example here, I just outline my suggestion)

Joakim


Re: Determining an Action's class

Posted by Onur Idrisoglu <on...@gmail.com>.
yep, it took me hours to learn how to turn it on:)

On Wed, Jun 11, 2008 at 4:02 PM, Dave Newton <ne...@yahoo.com> wrote:
> Unless dynamic method invocation is turned off.
>
>
> --- On Wed, 6/11/08, Onur Idrisoglu <on...@gmail.com> wrote:
>
>> From: Onur Idrisoglu <on...@gmail.com>
>> Subject: Re: Determining an Action's class
>> To: "Struts Users Mailing List" <us...@struts.apache.org>
>> Date: Wednesday, June 11, 2008, 7:28 AM
>> while calling the action in for,
>> use this format : action!method
>>
>>
>> On Wed, Jun 11, 2008 at 1:50 PM, Kiesewetter S., ITSC Bonn,
>> RV, EF,
>> extern <Sv...@dp-itsolutions.de> wrote:
>> >> yes you can,
>> >>  <action name="action_name"
>> method="method" class="class"/>
>> >> you can even define different actions for each
>> method in class
>> >
>> > Thx for the answer, but you didn't understand the
>> question. I defined
>> > several actions. Now i want to determine the
>> class+method of an action
>> > inside of a jsp page or inside of one of the tags of
>> my own taglib.
>> >
>> >
>> ---------------------------------------------------------------------
>> > To unsubscribe, e-mail:
>> user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail:
>> user-help@struts.apache.org
>> >
>> >
>>
>>
>>
>> --
>> -- --
>> Onur Idrisoglu
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail:
>> user-help@struts.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
-- --
Onur Idrisoglu

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


Re: Determining an Action's class

Posted by Dave Newton <ne...@yahoo.com>.
Unless dynamic method invocation is turned off.


--- On Wed, 6/11/08, Onur Idrisoglu <on...@gmail.com> wrote:

> From: Onur Idrisoglu <on...@gmail.com>
> Subject: Re: Determining an Action's class
> To: "Struts Users Mailing List" <us...@struts.apache.org>
> Date: Wednesday, June 11, 2008, 7:28 AM
> while calling the action in for,
> use this format : action!method
> 
> 
> On Wed, Jun 11, 2008 at 1:50 PM, Kiesewetter S., ITSC Bonn,
> RV, EF,
> extern <Sv...@dp-itsolutions.de> wrote:
> >> yes you can,
> >>  <action name="action_name"
> method="method" class="class"/>
> >> you can even define different actions for each
> method in class
> >
> > Thx for the answer, but you didn't understand the
> question. I defined
> > several actions. Now i want to determine the
> class+method of an action
> > inside of a jsp page or inside of one of the tags of
> my own taglib.
> >
> >
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@struts.apache.org
> > For additional commands, e-mail:
> user-help@struts.apache.org
> >
> >
> 
> 
> 
> -- 
> -- --
> Onur Idrisoglu
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail:
> user-help@struts.apache.org

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


Re: Determining an Action's class

Posted by Onur Idrisoglu <on...@gmail.com>.
while calling the action in for,
use this format : action!method


On Wed, Jun 11, 2008 at 1:50 PM, Kiesewetter S., ITSC Bonn, RV, EF,
extern <Sv...@dp-itsolutions.de> wrote:
>> yes you can,
>>  <action name="action_name" method="method" class="class"/>
>> you can even define different actions for each method in class
>
> Thx for the answer, but you didn't understand the question. I defined
> several actions. Now i want to determine the class+method of an action
> inside of a jsp page or inside of one of the tags of my own taglib.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
-- --
Onur Idrisoglu

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


AW: Determining an Action's class

Posted by "Kiesewetter S., ITSC Bonn, RV, EF, extern" <Sv...@dp-itsolutions.de>.
> yes you can,
>  <action name="action_name" method="method" class="class"/>
> you can even define different actions for each method in class 

Thx for the answer, but you didn't understand the question. I defined
several actions. Now i want to determine the class+method of an action
inside of a jsp page or inside of one of the tags of my own taglib.

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


How to debug Struts2 tag runtime problems ?

Posted by Eddie Lau TO <ta...@yahoo.com.hk>.
For example, 
using &lt;s:select list="" ...

if the value supplied into list attribute is wrong,
the translated page start from the position of &lt;s:select&gt; tag will be blank.

How to get more information of tag-related problem for troubleshooting ?

Thanks in advance!



Regards,
Eddie Lau



      Yahoo! Mail具備一流的網上安全保護功能,請前往 http://hk.antispam.yahoo.com/ 了解更多相關資訊!

Re: Determining an Action's class

Posted by Onur Idrisoglu <on...@gmail.com>.
yes you can,
 <action name="action_name" method="method" class="class"/>
you can even define different actions for each method in class


On Wed, Jun 11, 2008 at 12:47 PM, Kiesewetter S., ITSC Bonn, RV, EF,
extern <Sv...@dp-itsolutions.de> wrote:
> Hello there,
>
> i want to determine an action's class and method using the action's
> namespace and name. I found nothing using the documentation :-(
>
> How may i to this?
>
> Thx, Sven
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>



-- 
-- --
Onur Idrisoglu

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