Re: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2012-09-11 Thread Lukasz Lenart
2012/9/11 G.Subramanian g...@7stl.com:
 Hi, i'hv created a custom tag in Strtus 2. where, from action iam passing a
 arrayList object in the value attribute when custom tag java is calling.
 please tell me how to take that arrayList object in my custom tag java file.
 give me some exmple code.

And how do you map that arrayList to html ? It's hard to understand
your problem without a code example.


Regards
-- 
Łukasz
+ 48 606 323 122 http://www.lenart.org.pl/

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



Re: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2012-09-10 Thread G.Subramanian
Hi, i'hv created a custom tag in Strtus 2. where, from action iam passing a
arrayList object in the value attribute when custom tag java is calling.
please tell me how to take that arrayList object in my custom tag java file.
give me some exmple code.

 

Best Regards,

Subramanian.G 

 



Re: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2010-02-01 Thread Jake Vang
i found something helpful here. it works.

http://struts.apache.org/2.1.8.1/docs/access-to-valuestack-from-jsps.html



On Mon, Feb 1, 2010 at 7:34 AM, Jake Vang vangj...@googlemail.com wrote:
 i was wondering if it was possible to write a custom tag that is able
 to access objects in the ActionContext using OGNL? i'm not sure if
 this is a correct question.

 my problem is that i have a form. the form is posted to an action. the
 action has getters/setters for the form fields. i then forward to
 form-success.jsp. on this page, i can use the struts taglibs to access
 the information posted. for example, s:property value=email/.
 however, if i have a custom tag, how do i access email from the
 ActionContext? for example, customTabLib:showEmail value=email/,
 doesn't work. the tag displays the value, email. i also tried a
 couple of things too that didn't work.

 customTagLib:showEmail value=#email/
 customTagLib:showEmail value=%{#email}/

 is there a class/interface that i can extend/implement in struts 2
 that would easily help me get the value of email from the
 ActionContext in my custom tag?

 thanks.


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



Re: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2010-02-01 Thread Bill Bohnenberger
Hi Jake,

I have a custom table tag that needs Value Stack access, too.
Here's how I do it:

package...

import org.apache.struts2.views.jsp.TagUtils;
import org.apache.struts2.util.MakeIterator;

public class TableTag extends SimpleTagSupport
{
private String list;

public void doTag() throws JspException
{
ValueStack stack = TagUtils.getStack((PageContext)getJspContext());
Iterator iterator = MakeIterator.convert(stack.findValue(list));
while (iterator.hasNext())
{
...
}
}

public void setList(String list)
{
this.list = list;
}
}

Of course list is one of my custom tag's attributes and appropriately
defined in my TLD.

Cheers,
Bill


On Mon, Feb 1, 2010 at 5:04 AM, Jake Vang vangj...@googlemail.com wrote:

 i found something helpful here. it works.

 http://struts.apache.org/2.1.8.1/docs/access-to-valuestack-from-jsps.html



 On Mon, Feb 1, 2010 at 7:34 AM, Jake Vang vangj...@googlemail.com wrote:
  i was wondering if it was possible to write a custom tag that is able
  to access objects in the ActionContext using OGNL? i'm not sure if
  this is a correct question.
 
  my problem is that i have a form. the form is posted to an action. the
  action has getters/setters for the form fields. i then forward to
  form-success.jsp. on this page, i can use the struts taglibs to access
  the information posted. for example, s:property value=email/.
  however, if i have a custom tag, how do i access email from the
  ActionContext? for example, customTabLib:showEmail value=email/,
  doesn't work. the tag displays the value, email. i also tried a
  couple of things too that didn't work.
 
  customTagLib:showEmail value=#email/
  customTagLib:showEmail value=%{#email}/
 
  is there a class/interface that i can extend/implement in struts 2
  that would easily help me get the value of email from the
  ActionContext in my custom tag?
 
  thanks.
 

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




Re: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2010-02-01 Thread Jake Vang
bill, thanks for including the code (especially the import statements
so i will know where these objects/classes are coming from).

On Mon, Feb 1, 2010 at 11:09 AM, Bill Bohnenberger bill98...@gmail.com wrote:
 Hi Jake,

 I have a custom table tag that needs Value Stack access, too.
 Here's how I do it:

 package...

 import org.apache.struts2.views.jsp.TagUtils;
 import org.apache.struts2.util.MakeIterator;

 public class TableTag extends SimpleTagSupport
 {
    private String list;

    public void doTag() throws JspException
    {
        ValueStack stack = TagUtils.getStack((PageContext)getJspContext());
        Iterator iterator = MakeIterator.convert(stack.findValue(list));
            while (iterator.hasNext())
            {
                ...
            }
    }

    public void setList(String list)
    {
        this.list = list;
    }
 }

 Of course list is one of my custom tag's attributes and appropriately
 defined in my TLD.

 Cheers,
 Bill


 On Mon, Feb 1, 2010 at 5:04 AM, Jake Vang vangj...@googlemail.com wrote:

 i found something helpful here. it works.

 http://struts.apache.org/2.1.8.1/docs/access-to-valuestack-from-jsps.html



 On Mon, Feb 1, 2010 at 7:34 AM, Jake Vang vangj...@googlemail.com wrote:
  i was wondering if it was possible to write a custom tag that is able
  to access objects in the ActionContext using OGNL? i'm not sure if
  this is a correct question.
 
  my problem is that i have a form. the form is posted to an action. the
  action has getters/setters for the form fields. i then forward to
  form-success.jsp. on this page, i can use the struts taglibs to access
  the information posted. for example, s:property value=email/.
  however, if i have a custom tag, how do i access email from the
  ActionContext? for example, customTabLib:showEmail value=email/,
  doesn't work. the tag displays the value, email. i also tried a
  couple of things too that didn't work.
 
  customTagLib:showEmail value=#email/
  customTagLib:showEmail value=%{#email}/
 
  is there a class/interface that i can extend/implement in struts 2
  that would easily help me get the value of email from the
  ActionContext in my custom tag?
 
  thanks.
 

 -
 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: struts 2, writing a custom tag that is able to access objects in ActionContext using OGNL

2010-02-01 Thread Bill Bohnenberger
Aye, but whoops, I forgot this one :)

import com.opensymphony.xwork2.util.ValueStack;

Cheers,
Bill

On Mon, Feb 1, 2010 at 2:18 PM, Jake Vang vangj...@googlemail.com wrote:

 bill, thanks for including the code (especially the import statements
 so i will know where these objects/classes are coming from).

 On Mon, Feb 1, 2010 at 11:09 AM, Bill Bohnenberger bill98...@gmail.com
 wrote:
  Hi Jake,
 
  I have a custom table tag that needs Value Stack access, too.
  Here's how I do it:
 
  package...
 
  import org.apache.struts2.views.jsp.TagUtils;
  import org.apache.struts2.util.MakeIterator;
 
  public class TableTag extends SimpleTagSupport
  {
 private String list;
 
 public void doTag() throws JspException
 {
 ValueStack stack =
 TagUtils.getStack((PageContext)getJspContext());
 Iterator iterator = MakeIterator.convert(stack.findValue(list));
 while (iterator.hasNext())
 {
 ...
 }
 }
 
 public void setList(String list)
 {
 this.list = list;
 }
  }
 
  Of course list is one of my custom tag's attributes and appropriately
  defined in my TLD.
 
  Cheers,
  Bill
 
 
  On Mon, Feb 1, 2010 at 5:04 AM, Jake Vang vangj...@googlemail.com
 wrote:
 
  i found something helpful here. it works.
 
 
 http://struts.apache.org/2.1.8.1/docs/access-to-valuestack-from-jsps.html
 
 
 
  On Mon, Feb 1, 2010 at 7:34 AM, Jake Vang vangj...@googlemail.com
 wrote:
   i was wondering if it was possible to write a custom tag that is able
   to access objects in the ActionContext using OGNL? i'm not sure if
   this is a correct question.
  
   my problem is that i have a form. the form is posted to an action. the
   action has getters/setters for the form fields. i then forward to
   form-success.jsp. on this page, i can use the struts taglibs to access
   the information posted. for example, s:property value=email/.
   however, if i have a custom tag, how do i access email from the
   ActionContext? for example, customTabLib:showEmail value=email/,
   doesn't work. the tag displays the value, email. i also tried a
   couple of things too that didn't work.
  
   customTagLib:showEmail value=#email/
   customTagLib:showEmail value=%{#email}/
  
   is there a class/interface that i can extend/implement in struts 2
   that would easily help me get the value of email from the
   ActionContext in my custom tag?
  
   thanks.
  
 
  -
  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