Re: OGNL in struts tag

2020-02-18 Thread Lukasz Lenart
wt., 18 lut 2020 o 05:22 M Huzaifah  napisał(a):
> I've looking for solution how to create struts2 tag could generate
> dynamically. This is my code:
>
> 
>  
> 

You shouldn't mix Struts and non-Struts tags, this is a bad idea. Why
don't you use  here?
https://struts.apache.org/tag-developers/iterator-tag.html

And I'm not sure what do you want achieve with this strange syntax
"name:${column.columnName}"?


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: OGNL in struts tag

2020-02-18 Thread Prasanth
Guessing you are trying to create dynamic names for the text fields. If you 
have dynamic names how are you going to get the values into your action? You 
could probably have an array of text fields
where the names of text fields are like mytext[columnName1], 
mytext[columnName2]  etc.

You can then use a map in the action to collect the values from the jsp. In the 
below example you would use a map named mycolumns.


    


I think Struts2 tags don't allow EL so you have to use OGNL expression to 
create dynamic names.

On 2/18/20 7:09 AM, Lukasz Lenart wrote:
> wt., 18 lut 2020 o 05:22 M Huzaifah  napisał(a):
>> I've looking for solution how to create struts2 tag could generate
>> dynamically. This is my code:
>>
>> 
>>  
>> 
> You shouldn't mix Struts and non-Struts tags, this is a bad idea. Why
> don't you use  here?
> https://struts.apache.org/tag-developers/iterator-tag.html
>
> And I'm not sure what do you want achieve with this strange syntax
> "name:${column.columnName}"?
>
>
> Regards



Re: OGNL in struts tag

2020-02-18 Thread M Huzaifah
Dear Lucas,

Thank you Lucas, my goal is render the struts tag based on list of column
name that i've set before. So i have to iterate the list of column using
jstl than put the "name" on attribut name in struts tag. From here,  i
think i miss understanding about struts tag. I use struts 2.5x that not
support for expressions anymore.

Dear Prasanth,

Yes thank you for your advise.

I have done my little work for dynamic field by generate html code (include
attribut name, id, value, class) in action class, then render the code into
JSP using ${htmlComponen} syntaks. I know this is temporary solution, for
next i have to improve.


On Tue, Feb 18, 2020, 21:28 Prasanth  wrote:

> Guessing you are trying to create dynamic names for the text fields. If
> you have dynamic names how are you going to get the values into your
> action? You could probably have an array of text fields
> where the names of text fields are like mytext[columnName1],
> mytext[columnName2]  etc.
>
> You can then use a map in the action to collect the values from the jsp.
> In the below example you would use a map named mycolumns.
>
> 
> 
> 
>
> I think Struts2 tags don't allow EL so you have to use OGNL expression to
> create dynamic names.
>
> On 2/18/20 7:09 AM, Lukasz Lenart wrote:
> > wt., 18 lut 2020 o 05:22 M Huzaifah 
> napisał(a):
> >> I've looking for solution how to create struts2 tag could generate
> >> dynamically. This is my code:
> >>
> >> 
> >>  
> >> 
> > You shouldn't mix Struts and non-Struts tags, this is a bad idea. Why
> > don't you use  here?
> > https://struts.apache.org/tag-developers/iterator-tag.html
> >
> > And I'm not sure what do you want achieve with this strange syntax
> > "name:${column.columnName}"?
> >
> >
> > Regards
>
>