Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 7 Jun 2008 02:58:41 -0000 Issue 8075

user-digest-help

2008-06-06


Author LoginPost Reply

user Digest 7 Jun 2008 02:58:41 -0000 Issue 8075

Topics (messages 187320 through 187346):

Re: Extending Struts 2 controls
 187320 by: Narayana S

Re: Struts2 onchange event should do the same like submit(with ajax tag). How ?
 187321 by: zeermi

Re: [Struts 2] webapp on internet, clients behind a proxy --> session clash
 187322 by: Al Sutton

Re: Simplified usage of:@(protected)
 187323 by: Maxx

Invoking action methods from jsp: parameter types
 187324 by: Jukka Välimaa
 187328 by: Jukka Välimaa

Re: Are sessions confused?
 187325 by: Julien ROTT
 187329 by: Juan Pablo Pizarro
 187333 by: Julien ROTT
 187334 by: Juan Pablo Pizarro

s2 : custom expression validator - evaluates null properties
 187326 by: Shannon, Andrew

Re: Move query to interceptor
 187327 by: Gabriel Belingueres
 187330 by: Frans Thamura
 187331 by: Dave Newton
 187332 by: Frans Thamura

How to pass dynamic value to the logic:equal tag?
 187335 by: VenkatBabu
 187346 by: Jim Kiley

Re: [Struts2] Convention Plugin
 187336 by: vikofvan

s2 + spring, how to access spring defined bean in jsp
 187337 by: Tomislav Stojcevich
 187339 by: Bob Tiernay
 187340 by: Chris Pratt
 187341 by: Dave Newton
 187342 by: Tomislav Stojcevich

Re: [Struts 2] Iterator usage
 187338 by: Laurie Harper

[Struts 2] Session Action / Form?
 187343 by: claym
 187345 by: stanlick.gmail.com

[Struts2] Help please!!! how to map select tag with listkey and listvalue into a java object with his ids and names?
 187344 by: Eduardo Solanas

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------

Attachment: user_187320.ezm (zipped)
Hi Dave,

      Thanks for reply, let me give more details. i need to apply field
level security to all the form controls. to apply the field customization i
want to extends the custom components provided by struts. for example to
extend i am planning to text field tag *
org.apache.struts2.views.jsp.ui.TextFieldTag*, i want to add a new attribute
to the text field tag.

can you tell me, how i can implement this?

Thanks in advance.
On Thu, Jun 5, 2008 at 6:45 PM, Dave Newton <newton.dave@(protected):

> --- On Thu, 6/5/08, Narayana S <narayanasgs1@(protected):
> > in my application, i have a requirement of implementing field
> > level customization, like locking the field, hiding the field
> > etc.. to achieve this i am planning to extends "struts-tags"
> > tag library functionality. can any one give any idea of how
> > to do this?
>
> I'm not sure what you're asking.
>
> To extend the S2 tags themselves you might need to do any or all of the
> following, depending on your needs:
>
> * add tag attributes to the component and tag classes
> * add additional Java code
> * regenerate TLD
> * modify FreeMarker templates
>
> Some might be easier to extend than others.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_187321.ezm (zipped)

nobody can help me ? :/



zeermi wrote:
>
> Hi,
>
> with onchange="submit() I loose the ajax functionality -> website gets
> completely refreshed
>
>
>
> Jim Kiley wrote:
>>
>> onchange="submit();"
>>
>> On Fri, May 30, 2008 at 6:26 AM, zeermi <kutzi@(protected):
>>
>>>
>>> Hi,
>>>
>>> I think this is an easy question to struts2 insiders ... but I wasted
>>> serveral hours and could not solve the problem.
>>>
>>> I have one div and one form
>>>
>>> I refresh the div with the forms content by clicking submit:
>>>
>>> <s:submit value="submit" theme="ajax" targets="divid"/>
>>>
>>> This works fine . But I dont want to click the submit button,I want this
>>> after an onchange event like:
>>>
>>> <s:textfield theme="ajax" name='data' onchange="?????"></s:textfield>
>>>
>>>
>>> I hope anybody can help me ;/
>>> thank you
>>> zeermi
>>>
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Struts2-onchange-event-should-do-the-same-like-submit%28with-ajax-tag%29.-How---tp17555869p17555869.html
>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>
>>
>> --
>> Jim Kiley
>> Technical Consultant | Summa
>> [p] 412.258.3346 [m] 412.445.1729
>> http://www.summa-tech.com
>>
>>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_187322.ezm (zipped)
Not in your struts app.

I've seen this in a production situation and it's usually a bug in the
proxy. If you can try setting up a NAT environment without the proxy and
then with the proxy, if the bug only occurs when the proxy is in place
then you know where the problem is.

Al.

P.S. The buggy proxy I encountered was Novell iChain, I don't know the
version, but after the customer put in a rule that the site the struts
app was on was not to be proxied everything worked and they were
satisfied they should be talking to Novell about the problem.

Julien ROTT wrote:
> So there is no solution to avoid the sessions clash in this situation ?
>
>
> 2008/6/5 Dave Newton <newton.dave@(protected)>:
>
>  
>> --- On Thu, 6/5/08, Julien ROTT <julien.rott@(protected):
>>  
>>> I guess the server is a bit confused because the clients
>>> have the same IP address (I tried jboss and jetty).
>>>    
>> Session management isn't really handled by Struts, it's handled via the app
>> server and browser (by sending the session id cookie).
>>
>> AFAIK the requesting IP address doesn't (shouldn't?) have anything to do
>> with it, it's all about what the browser sends to identify the session.
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>  
>
>  


Attachment: user_187323.ezm (zipped)
On Thu, May 1, 2008 at 5:21 PM, Jeromy Evans
<jeromy.evans@(protected):
>
> I have a solution, but first...
> OGNL only provides access to static fields and static methods. It cannot
> reference a static class, nor even an inner static class.
>
> http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/apa.html

Strange... because I succeeded in reading Enum values from an inner
enum class, like:

public interface MyInterface {
enum MyEnum {
  MY_ENUM_VALUE;
}
}

Using
<s:property value="@com.mycompany.some.package.MyInterface$MyEnum@(protected)"
/>
prints:
MY_ENUM_VALUE
(value returned by the .toString() from the Enum class)

Note: it might be dumb to do this, BUT if you use a specific Struts2
(or XWork?) converter to "translate" your enum value into something
different (e.g. introducing a label or something similar that would
returns "My Enum Value" in our example) then it's useful when not only
dealing with the Enum name (i.e. here MY_ENUM_VALUE).

I also succeeded using
<s:property value="@java.lang.Math@(protected)" />
that prints:
2.718281828459045

But strangely, some:
<s:property value="@com.mycompany.some.package.MyInterface@(protected)"
/>
does not work... why?!

... all this with Struts 2.0.11.1


> However, there is a bearable solution / hack:
>
> 1. In your Constants *class*, create a public static singleton instance of
> itself. Lets call it C. (Remember, OGNL can reference static fields)
> public static final Constants C = new Constants();
>
> 2. [...]

And what if, as from my above explained example, you have an
*interface*, not a class...?

Maxx

Attachment: user_187324.ezm (zipped)
Hi all,

I'm trying to format a certain string property of an object differently
depending on the object state. For this, I'm trying to call an action method
from the jsp, like this:
<s:property value="%{ getFormattedIfDeleted( [0], [0].name ) }" />

My problem is the following: if I use my class type as the parameter type of
the first argument of the method, the jsp code never calls the action
method.

This version of method is called:
  public String getFormattedIfDeleted( Object modelObject, String
objectText ) {...}

This is not called:
  public String getFormattedIfDeleted( AbstractBaseObject modelObject,
String objectText ) {...}

The actual object I use as the parameter extends AbstractBaseObject. So it
should qualify just as well for both. I've confirmed that the object type is
the right one by printing it out in jsp.

What's more, if I use the first method, the object is no longer recognized
as its own type by instanceof, modelObject instanceof AbstractBaseObject
evaluates as false.

I' quessing there is something esoteric in OGNL playing havoc here, but
that's about it. Any idea what's wrong? Thanks in advance.

Attachment: user_187328.ezm (zipped)
Well, I managed to solve this one. Ognl didn't actually pass the object
itself to the method, but rather an instance of
com.opensymphony.xwork2.util.CompoundRoot. I managed to get the object I
needed by using its peek() method.

On Fri, Jun 6, 2008 at 2:47 PM, Jukka Välimaa <valimaa.jukka@(protected)>
wrote:

> Hi all,
>
> I'm trying to format a certain string property of an object differently
> depending on the object state. For this, I'm trying to call an action method
> from the jsp, like this:
> <s:property value="%{ getFormattedIfDeleted( [0], [0].name ) }" />
>
> My problem is the following: if I use my class type as the parameter type
> of the first argument of the method, the jsp code never calls the action
> method.
>
> This version of method is called:
>   public String getFormattedIfDeleted( Object modelObject, String
> objectText ) {...}
>
> This is not called:
>   public String getFormattedIfDeleted( AbstractBaseObject modelObject,
> String objectText ) {...}
>
> The actual object I use as the parameter extends AbstractBaseObject. So it
> should qualify just as well for both. I've confirmed that the object type is
> the right one by printing it out in jsp.
>
> What's more, if I use the first method, the object is no longer recognized
> as its own type by instanceof, modelObject instanceof AbstractBaseObject
> evaluates as false.
>
> I' quessing there is something esoteric in OGNL playing havoc here, but
> that's about it. Any idea what's wrong? Thanks in advance.
>
>

Attachment: user_187325.ezm (zipped)
Hi Juan Pablo,

did you find a solution to your problem ?

I have the same: my application is on the internet, and the clients access
to the application from behind a proxy. When client "A" logs in, and then a
client "B" logs in, Client "B" sees the data which is stored in client "A"
session.

Is it possible to avoid this problem by forcing the urlRewriting with the
jsessionid for each request ?

jr.


2008/6/2 Juan Pablo Pizarro <juanpablo.pizarro@(protected)>:

> No, I haven't. Now my application is working, then, i suspect that the
> problem was external and maybe the networking personel had a proxy or
> something like that. I'm asking them. In my pc, I haven't.
>
> I'll download tomcat again to test in my house.
>
>
>

Attachment: user_187329.ezm (zipped)
Hi Julien,

I had two problems, the first was my app, where the problem was
hibernate. The other, on my pc at home, the struts-blank, I don't know
(I abandoned that when I solved the problem of my app).

In my application, I put

          response.setHeader("Cache-Control", "no-cache");
 response.setHeader("Pragma", "no-cache");
 response.setDateHeader("Expires", 0);

http://www.jguru.com/faq/view.jsp?EID=377

Regards,

JP


2008/6/6, Julien ROTT <julien.rott@(protected)>:
> Hi Juan Pablo,
>
> did you find a solution to your problem ?
>
> I have the same: my application is on the internet, and the clients access
> to the application from behind a proxy. When client "A" logs in, and then a
> client "B" logs in, Client "B" sees the data which is stored in client "A"
> session.
>
> Is it possible to avoid this problem by forcing the urlRewriting with the
> jsessionid for each request ?
>
> jr.
>
>
> 2008/6/2 Juan Pablo Pizarro <juanpablo.pizarro@(protected)>:
>
> > No, I haven't. Now my application is working, then, i suspect that the
> > problem was external and maybe the networking personel had a proxy or
> > something like that. I'm asking them. In my pc, I haven't.
> >
> > I'll download tomcat again to test in my house.
> >
> >
> >
>

Attachment: user_187333.ezm (zipped)
this seems to work, the sessions aren't overlaping anymore.
I'll test deeper on monday ;-)
Thanks !

2008/6/6 Juan Pablo Pizarro <juanpablo.pizarro@(protected)>:

> Hi Julien,
>
> I had two problems, the first was my app, where the problem was
> hibernate. The other, on my pc at home, the struts-blank, I don't know
> (I abandoned that when I solved the problem of my app).
>
> In my application, I put
>
>           response.setHeader("Cache-Control", "no-cache");
>     response.setHeader("Pragma", "no-cache");
>     response.setDateHeader("Expires", 0);
>
> http://www.jguru.com/faq/view.jsp?EID=377
>
> Regards,
>
> JP
>
>
>

Attachment: user_187334.ezm (zipped)
You are welcome. Martin told me that.

Regards,

JP

2008/6/6, Julien ROTT <julien.rott@(protected)>:
> this seems to work, the sessions aren't overlaping anymore.
> I'll test deeper on monday ;-)
> Thanks !
>
> 2008/6/6 Juan Pablo Pizarro <juanpablo.pizarro@(protected)>:
>
> > Hi Julien,
> >
> > I had two problems, the first was my app, where the problem was
> > hibernate. The other, on my pc at home, the struts-blank, I don't know
> > (I abandoned that when I solved the problem of my app).
> >
> > In my application, I put
> >
> >           response.setHeader("Cache-Control", "no-cache");
> >     response.setHeader("Pragma", "no-cache");
> >     response.setDateHeader("Expires", 0);
> >
> > http://www.jguru.com/faq/view.jsp?EID=377
> >
> > Regards,
> >
> > JP
> >
> >
> >
>

Attachment: user_187326.ezm (zipped)
After doing some research on how the struts2 ognl stack implementation
works when attempting to find a null
value on the value stack (essentially it returns nothing when evaluating
an expression), I had to figure out a work
around for a special case to handle some Long type properties. I saw a
few posts from a while back where others
seem to have wrestled with the same issue. I believe the stack
implementation is just fine, so I came up with this
validator to solve my problem. Maybe this can help someone else out
too.

------------------------------------------------------------------------
-------------------------------

package x.y.z.web.validator;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.util.TextParseUtil;
import com.opensymphony.xwork2.util.ValueStack;
import com.opensymphony.xwork2.validator.ValidationException;
import com.opensymphony.xwork2.validator.validators.ValidatorSupport;

/**
* CustomExpressionValidator
* <p/>
* The purpose for this validator is to allow us to evaluate null
properties
* on the value stack. The reason for this is that expressions are
interpreted
* to populate the properties with values in the expression string, and
if a property
* is null on the value stack, then no value is placed into the string
and the
* resulting expression is essentially useless and cannot evaluate.
* <p/>
* The tactic employed in this validator is to leverage some control
over how the
* expression is populated by introducing a ParsedValueEvaluator that
will return a
* string value of "null" into the expression when the property value is
null.
* <p/>
* The resulting string is then executed against the value stack as any
other expression.
* <p/>
* This validator will return a boolean value of true or false.
* <p/>
* This example was developed because there was a conditional pair of
query string parameters
* that needed to be validated. If it was just one param then the more
appropriate validation
* is to use the @RequiredFieldValidator.
* <p/>
* private Long requiredIdOne;
* private Long requiredIdTwo;
* <p/>
* public Long getRequiredIdOne() {
*    return requiredIdOne;
* }
*<p/>
* public void setRequiredIdOne(final Long requiredIdOne) {
*    this.requiredIdOne = requiredIdOne;
* }
*<p/>
* public Long getRequiredIdTwo() {
*    return requiredIdTwo;
* }
* <p/>
* public void setRequiredIdTwo(final Long requiredIdTwo) {
*    this.requiredIdTwo = requiredIdTwo;
* }
* <p/>
*  @Validations(
*     customValidators = {
*     @CustomValidator(
*           type = "customExpressionValidator",
*           message = "",
*           key = "validation.idQueryStringParameter.required",
*           parameters = {@(protected)(
*                name = "expression",
*                value = "((${requiredIdOne} != null) ||
(${requiredIdTwo} != null))"
*                     + "&& !((${requiredIdOne} != null) &&
(${requiredIdTwo} != null))")})
*           }
*     )
*  public String actionMethod() {
*     return Action.SUCCESS;
*  }
* <p/>
* <p/>
* You must delimit the property to be found on the stack using ${...}
notation.
* <p/>
* This notation is used by the text parser methods in TextParseUtil.
* <p/>
* Don't forget to put an entry for your validator in validators.xml.
* A JMock test was used to prove this validator works, as well as
actual implementation.
* JMock MockObjectTestCase's are very effective for testing/developing
validtors since all
* the Struts2 ingredients are easily created or mocked.
* <p/>
*/
public final class CustomExpressionValidator extends ValidatorSupport {

  private String expression;

  public void setExpression(final String expression) {
    this.expression = expression;
  }

  public String getExpression() {
    return expression;
  }

  public void validate(final Object object) throws ValidationException
{
    ValueStack stack = ActionContext.getContext().getValueStack();

    // Create the expression string by populating it with property
    // values off the stack.
    String parsedObject = TextParseUtil.translateVariables(
          expression, stack, new
TextParseUtil.ParsedValueEvaluator() {
       public Object evaluate(final Object parsedValue) {
          if (parsedValue != null) {
            return parsedValue.toString();
          }
          // This string value of null will be inserted into the
expression when
          // the saught after property defined as ${property} is
null on the stack. It
          // will indeed be evaluated as null when the expression
is executed against
          // the stack.
          return "null";
       }
    });

    // Evaluate the expression string against the stack.
    Object obj = stack.findValue(parsedObject);

    Boolean answer = Boolean.FALSE;
    if (obj != null && Boolean.valueOf(obj.toString()) instanceof
Boolean) {
       answer = Boolean.valueOf(obj.toString());
    } else {
       log.error("Got result of " + obj + " when trying to get
Boolean from CustomExpressionValidator");
    }

    if (!answer.booleanValue()) {
       addActionError(object);
    }
  }
}


Andrew Shannon
Senior Associate
Perrin Quarles Associates
andrewshannon@(protected)


Attachment: user_187327.ezm (zipped)
AFAIK, It is a very common to use an interceptor/servlet filter to
factor out authentication/authorization functionality.

2008/6/6, Frans Thamura <frans@(protected)>:
> hi all
>
> we want to move the repeated query on our apps to become a interceptor, this
> is our file
>
> anyone can give the experience to me about this mode?
>
>
> NB: the repeated query is a security purpose query, that validate every
> user/role to access certain package in struts.xml
>
>
>
> F
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment: user_187330.ezm (zipped)
On Fri, Jun 6, 2008 at 8:43 PM, Gabriel Belingueres <belingueres@(protected)>
wrote:

> AFAIK, It is a very common to use an interceptor/servlet filter to
> factor out authentication/authorization functionality.
>

my interceptor is not working

because i need to do like execute() in ActionSupport

any glue friends?

F

Attachment: user_187331.ezm (zipped)
--- On Fri, 6/6/08, Frans Thamura <frans@(protected):
> my interceptor is not working
>
> because i need to do like execute() in ActionSupport

What?

Is [1] not providing you the information necessary to write your interceptor? What's missing?

Dave

[1] http://struts.apache.org/2.x/docs/writing-interceptors.html


Attachment: user_187332.ezm (zipped)
On Fri, Jun 6, 2008 at 10:03 PM, Dave Newton <newton.dave@(protected):

> --- On Fri, 6/6/08, Frans Thamura <frans@(protected):
> > my interceptor is not working
> >
> > because i need to do like execute() in ActionSupport
>
> What?


i use spring and hibernate, , still finding out,

i want the error throw from interceptor, if the process ok, so the .acion
can be execute

F

Attachment: user_187335.ezm (zipped)

I am new to this forum...forgive me if the question that i am going to raise
is already present. I dont have time to go through all the messages which
have been raised already.

The problem is:
I have <logic:iterate id="ID1" name="formbeanname" property="VectorInBean"
indexid="index">
<logic:equal name="ID1" property="index" value="Dynamic Value from the
bean">

logic:equal tag's value attribute shoud get populated by a value from the
bean(i am storing the size of the vector in bean) which is used in the
logic:iterate. I dont want to use scriptlets.

Actually the problem is the Vector in the bean has list of strings which
needs to be shown in the JSP one by one sepeared by "commas(,)" and we need
to add "and" before the last string from the vector. So i need to check it
dynamically whether the vector is reached the last but one.

I need to solve this issue as soon as possible. Any help would be very
grateful.
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_187346.ezm (zipped)
I would compose the string from the vector in a Java function, and call that
function to get the String, instead of just accessing the Vector. Is there
a reason you couldn't do that?

jk

On Fri, Jun 6, 2008 at 12:54 PM, VenkatBabu <bs_ramana@(protected):

>
> I am new to this forum...forgive me if the question that i am going to
> raise
> is already present. I dont have time to go through all the messages which
> have been raised already.
>
> The problem is:
> I have <logic:iterate id="ID1" name="formbeanname" property="VectorInBean"
> indexid="index">
> <logic:equal name="ID1" property="index" value="Dynamic Value from the
> bean">
>
> logic:equal tag's value attribute shoud get populated by a value from the
> bean(i am storing the size of the vector in bean) which is used in the
> logic:iterate. I dont want to use scriptlets.
>
> Actually the problem is the Vector in the bean has list of strings which
> needs to be shown in the JSP one by one sepeared by "commas(,)" and we need
> to add "and" before the last string from the vector. So i need to check it
> dynamically whether the vector is reached the last but one.
>
> I need to solve this issue as soon as possible. Any help would be very
> grateful.
> --
> View this message in context:
> http://www.nabble.com/How-to-pass-dynamic-value-to-the-logic%3Aequal-tag--tp17696748p17696748.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


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

Attachment: user_187336.ezm (zipped)

How do I configure the plugin to work? I compiled the plugin and xwork using
the latest source, and am using the latest successful build of struts2
(build 825) but it does not find the action at runtime. I tried using the
plugin annotations also. The plugin looks very promising, if only I can get
it to work. Thanks.

vikram


Musachy Barroso wrote:
>
> You will have to build xwork also, those classes are new.
>
> musachy
>
> On Wed, Jun 4, 2008 at 5:18 PM, vikofvan <vikofvan@(protected):
>>
>> Thanks for providing the link to the source of convention plugin; am
>> unable
>> to compile the plugin as
>> com.opensymphony.xwork2.util.finder.*
>> is missing from xwork 2.1.1. Thanks.
>>
>> vikram
>>
>>
>> Musachy Barroso wrote:
>>>
>>> The Convention plugin has not been released yet, it is in the sandbox
>>> here:
>>>
>>> http://svn.apache.org/viewvc/struts/sandbox/trunk/struts2-convention-plugin/
>>>
>>> musachy
>>>
>>> On Wed, Jun 4, 2008 at 4:13 PM, vikofvan <vikofvan@(protected):
>>>>
>>>> Where can I get hold of the strust2 convention plugin? It seems to be
>>>> missing
>>>> from the 2.1.2 build. Thanks.
>>>>
>>>> Vikram
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/-Struts2--Convention-Plugin-tp17655614p17655614.html
>>>> Sent from the Struts - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>>> For additional commands, e-mail: user-help@(protected)
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> "Hey you! Would you help me to carry the stone?" Pink Floyd
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>>> For additional commands, e-mail: user-help@(protected)
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/-Struts2--Convention-Plugin-tp17655614p17656884.html
>> Sent from the Struts - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_187337.ezm (zipped)
I have a spring defined singleton bean that I want to access in
several jsp's. I'd like to simply do something like ${bean.property}
wherever I need it.

What's the easiest way that doesn't involve adding a getter in the
action class (I'm using the codebehind plugin and tiles plugin for
some of the jsp's so I don't have action classes defined for all
jsp's).

--tom

Attachment: user_187339.ezm (zipped)

I would recommend either of the following:

1. Use a jstl function that gets the application context and resolves the bean by name
2. Use a tagfile to wrap a scriptlet (or call to 1.) that does the lookup, using the bean name as an attribute.> Date: Fri, 6 Jun 2008 13:36:16 -0400> From: stojcevicht@(protected)>
_________________________________________________________________


Attachment: user_187340.ezm (zipped)
You can also add an Interceptor that places the bean in the context. Like:

invocation.getStack().getContext().put("user",userBean);

Then in your jsp's you can reference the value using the Struts tags as:

<s:property value="%{#user.firstname}"/>

(*Chris*)

On Fri, Jun 6, 2008 at 11:00 AM, Bob Tiernay <btiernay@(protected):
>
> I would recommend either of the following:
>
> 1. Use a jstl function that gets the application context and resolves the bean by name
> 2. Use a tagfile to wrap a scriptlet (or call to 1.) that does the lookup, using the bean name as an attribute.> Date: Fri, 6 Jun 2008 13:36:16 -0400> From: stojcevicht@(protected)>
> _________________________________________________________________
>
>

Attachment: user_187341.ezm (zipped)
Or possibly use Spring's ability to put beans into web scopes? I guess I"m not sure how the bean is named in the scope or if it's even available as a scoped attribute.

I'd kinda *like* to know, though...

kinda like...

wait for it...

A scopes trial.

Totally worth it.

Dave

--- On Fri, 6/6/08, Chris Pratt <thechrispratt@(protected):

> From: Chris Pratt <thechrispratt@(protected)>
> Subject: Re: s2 + spring, how to access spring defined bean in jsp
> To: "Struts Users Mailing List" <user@(protected)>
> Date: Friday, June 6, 2008, 2:13 PM
> You can also add an Interceptor that places the bean in the
> context. Like:
>
> invocation.getStack().getContext().put("user",userBean);
>
> Then in your jsp's you can reference the value using
> the Struts tags as:
>
> <s:property value="%{#user.firstname}"/>
>
>  (*Chris*)
>
> On Fri, Jun 6, 2008 at 11:00 AM, Bob Tiernay
> <btiernay@(protected):
> >
> > I would recommend either of the following:
> >
> > 1. Use a jstl function that gets the application
> context and resolves the bean by name
> > 2. Use a tagfile to wrap a scriptlet (or call to 1.)
> that does the lookup, using the bean name as an
> attribute.> Date: Fri, 6 Jun 2008 13:36:16 -0400>
> From: stojcevicht@(protected):
> user@(protected)
> access spring defined bean in jsp> > I have a spring
> defined singleton bean that I want to access in> several
> jsp's. I'd like to simply do something like
> ${bean.property}> wherever I need it.> >
> What's the easiest way that doesn't involve adding
> a getter in the> action class (I'm using the
> codebehind plugin and tiles plugin for> some of the
> jsp's so I don't have action classes defined for
> all> jsp's).> > --tom> >
> --------------------------------------------------------------------->
> To unsubscribe, e-mail:
> user-unsubscribe@(protected)
> commands, e-mail: user-help@(protected)>
> >
> _________________________________________________________________
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail:
> user-help@(protected)

Attachment: user_187342.ezm (zipped)
I found this interesting filter that I could apply:
http://wiki.opensymphony.com/display/ABLE/Expose+Spring+Beans+in+JSP

I'm kind of surprised that spring or struts doesn't already have
something to provide this built in.

--tom

Attachment: user_187338.ezm (zipped)
I assume 'rearding interator' means the s:iterator tag in a JSP? I doubt
there is any clean/sane way to do this from within the JSP. Instead, do
the summation logic in the action and give the JSP a data structure that
already includes this information.

L.

Milan Milanovic wrote:
> Hi,
>
> I have one question regarding iterator. I have one simple list that contain three values:
> List
> { id, value, date } and I'm iterating through this list. And I want to
> show in my list a sum for value for every day at the last row that
> contain that date, like this:
>
> id__value___date_______sum
> ----------------------------------------------------------
> 1__10_____20.5.2008
> 2__15_____20.5.2008
> 3__15_____20.5.2008___40
> 4__12_____21.5.2008
> 5__15_____21.5.2008___27
> 6__12_____22.5.2008
> ....
>
> I'm now have done all iterating except this sum column. Do you have any ideas how efficent can I do this ?
>
> --
> Thx, Milan Milanovic
>
>
> --- On Thu, 6/5/08, Milan Milanovic &lt;milanmilanovich@(protected):
> From: Milan Milanovic &lt;milanmilanovich@(protected);
> Subject: [Struts 2] Iterator usage
> To: user@(protected)
> Date: Thursday, June 5, 2008, 7:36 AM
>
> Hi,
>
> I have one question regarding iterator. I have one simple list that contain
> three values:
> List { id, value, date } and I'm iterating through this list. And I want to
> show in my list a sum for value for every day at the last row that contain that
> date, like this:
>
> id&amp;nbsp;&amp;nbsp;&amp;nbsp; value&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
> date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
> sum
> ----------------------------------------------------------
> 1&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 10&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 20.5.2008
> 2&amp;nbsp;&amp;nbsp;&amp;nbsp; 15
> &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 20.5.2008
> 3&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 20.5.2008&amp;nbsp;&amp;nbsp;&amp;nbsp; 40
> 4&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 21.5.2008
> 5&amp;nbsp;&amp;nbsp;&amp;nbsp; 15
> &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 21.5.2008&amp;nbsp;&amp;nbsp;&amp;nbsp; 27
> 6&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 12&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
> 22.5.2008
> ....
>
> I'm now have done all iterating except this sum column. Do you have any
> ideas how efficent can I do this ?
>
> --
> Thx, Milan Milanovic
>
>
>    


Attachment: user_187343.ezm (zipped)

Does Struts 2 support something similar to Spring MVC's session scope
bean/form where the form input will live across multiple requests to the
same (or even different) actions? If so, how does that work?
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_187345.ezm (zipped)
Take a look at the
ScopeInterceptor<http://struts.apache.org/2.x/docs/scope-interceptor.html>
.

Scott

On Fri, Jun 6, 2008 at 3:23 PM, claym <clay@(protected):

>
> Does Struts 2 support something similar to Spring MVC's session scope
> bean/form where the form input will live across multiple requests to the
> same (or even different) actions? If so, how does that work?
> --
> View this message in context:
> http://www.nabble.com/-Struts-2--Session-Action---Form--tp17700464p17700464.html
> Sent from the Struts - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>


--
Scott
stanlick@(protected)

Attachment: user_187344.ezm (zipped)
Hi, i have tried it, looking for the solution in books and google and i
can't do this.

i have a select tag in my jsp <s:select list="countries"
listkey="nameCountry" listValue="idCountry" multiple="true" size="11"/>

in my action i have

List countries=new ArrayList();

with getCountries()/setCountries(List countries);

I have a country.java with
String idCountry="";
String nameCountry="";
with get/setters

Can i map all the names and keys of the selected items in the list of my
action? I only get a list with the ids of the countries selected, but i cant
map the name of the countries selected... :(

I have tried List<Country> countries=new ArrayList<Country>();
and doesn't work, do i need a converter? i have tried an annotacion
converter and i doesn't work too maybe cos i don't undestand it so much, so
please can you help me??

thanks
©2008 gg3721.com - Jax Systems, LLC, U.S.A.