Re: calling method of a bean from JSP
I only used String as key. public Object getStringMapped(String key) { return map.get(key); } public void setStringMapped(String key, Object value) { map.put(key, value); } Regards On 9/18/06, Lixin Chu <[EMAIL PROTECTED]> wrote: On 9/17/06, Yujun Liang <[EMAIL PROTECTED]> wrote: > > Have you tried "Mapped Properties"? > http://struts.apache.org/1.2.9/faqs/indexedprops.html > > Regards this is a good point. I have not tried it. Is it ok (in terms of performance) to use a custom class as the key, not using Java primitives like Long ? -- Yujun Liang [EMAIL PROTECTED]
Re: calling method of a bean from JSP
On 9/17/06, Yujun Liang <[EMAIL PROTECTED]> wrote: Have you tried "Mapped Properties"? http://struts.apache.org/1.2.9/faqs/indexedprops.html Regards this is a good point. I have not tried it. Is it ok (in terms of performance) to use a custom class as the key, not using Java primitives like Long ?
Re: calling method of a bean from JSP
this should work. thanks ! On 9/16/06, Strachan, Paul <[EMAIL PROTECTED]> wrote: you could move the logic into the view/jsp layer...something like: or maybe a custom tag library... From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Sat 16/09/2006 1:25 PM To: Struts Users Mailing List Subject: Re: calling method of a bean from JSP i do not think it works. ** This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: calling method of a bean from JSP
Have you tried "Mapped Properties"? http://struts.apache.org/1.2.9/faqs/indexedprops.html Regards On 9/16/06, Strachan, Paul <[EMAIL PROTECTED]> wrote: you could move the logic into the view/jsp layer...something like: or maybe a custom tag library... From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Sat 16/09/2006 1:25 PM To: Struts Users Mailing List Subject: Re: calling method of a bean from JSP i do not think it works. ** This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Yujun Liang [EMAIL PROTECTED]
RE: calling method of a bean from JSP
you could move the logic into the view/jsp layer...something like: or maybe a custom tag library... From: Lixin Chu [mailto:[EMAIL PROTECTED] Sent: Sat 16/09/2006 1:25 PM To: Struts Users Mailing List Subject: Re: calling method of a bean from JSP i do not think it works. ** This message is intended for the addressee named and may contain privileged information or confidential information or both. If you are not the intended recipient please delete it and notify the sender. ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: calling method of a bean from JSP
i do not think it works.
Re: calling method of a bean from JSP
Lixin Chu wrote: What are you trying to achieve? Maybe you're trying to put logic in your JSPs that more properly belongs in an action. thanks. what i am trying to do is to get the value of a field. Say I get a list of items: class item { Set values; } The item has a set of Values: class Value { Attribute attribute; String value; } What I wanted to do is to get one particular value based on attribute ID. in this case I have to add a method in the Item class, someting like this: String getValue (String id) { while (it.hasNext()) { Value value = (value) it.next(); if (value.attribute.getId().toString().equals (id) return value.value; } So from JSP, I would like to call this method ? L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: calling method of a bean from JSP
What are you trying to achieve? Maybe you're trying to put logic in your JSPs that more properly belongs in an action. thanks. what i am trying to do is to get the value of a field. Say I get a list of items: class item { Set values; ... } The item has a set of Values: class Value { Attribute attribute; String value; } What I wanted to do is to get one particular value based on attribute ID. in this case I have to add a method in the Item class, someting like this: String getValue (String id) { while (it.hasNext()) { Value value = (value) it.next(); if (value.attribute.getId().toString().equals (id) return value.value; } So from JSP, I would like to call this method
Re: calling method of a bean from JSP
Lixin Chu wrote: I thought this is for getting the value of a property ? and how to pass a Yes. parameter to the method ? I think I have tried that but does not work. You can't invoke arbitrary bean methods with EL; it's designed for accessing properties, not calling arbitrary methods. The closest you can come is to 'fake' a map-type Foo.getBar(String key) property so you could write ${foo.bar[param]}, but that's a bit limitted. What are you trying to achieve? Maybe you're trying to put logic in your JSPs that more properly belongs in an action. L. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: calling method of a bean from JSP
I thought this is for getting the value of a property ? and how to pass a parameter to the method ? I think I have tried that but does not work.
Re: calling method of a bean from JSP
or On 9/12/06, Lixin Chu <[EMAIL PROTECTED]> wrote: Hi, would like to check if there is existing tag available to allow method invocation from JSP directly, something similar to this : "Call JavaBean methods from JSP 2.0 pages " http://www.javaworld.com/javaworld/jw-05-2003/jw-0523-calltag.html thanks lx
calling method of a bean from JSP
Hi, would like to check if there is existing tag available to allow method invocation from JSP directly, something similar to this : "Call JavaBean methods from JSP 2.0 pages " http://www.javaworld.com/javaworld/jw-05-2003/jw-0523-calltag.html thanks lx