RE: Generating struts tags from a Java Bean

2004-08-18 Thread Victor Grazi
Not exactly; can you elaborate the step "Model Use of  logic to
generate "

-Original Message-
From: Michael McGrady [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 18, 2004 11:15 AM
To: Struts Users Mailing List
Subject: Re: Generating struts tags from a Java Bean


The JSP page is read and the tags there are used to do whatever is required
to respond to a call to that page. Usually that is writing a JSP page.
While you cannot use the struts tags between the JSP page and the ultimate
HTML page, you can do something like that with code in the background.  So,
instead of dynamically generating Struts tags as follows:

JSP page  > JSP page  -> HTML page



You could somewhat easily work up something like the following:

JSP page  > Model Use of  logic to
generate > HTML page  from 


That clear?

Michael


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Generating struts tags from a Java Bean

2004-08-18 Thread Michael McGrady
Victor Grazi wrote:
These tags are going to be reused many times throughout our application, and
I prefer to omit this type of decision logic from the jsp pages. Therefore I
think it pays to design custom tags to accomplish what I need. 

I have been looking at some of the source code for the various tag handlers
that extend BaseTagHandler, and I see there is a lot going on. I would like
to make sure to leverage all of the functionality included in
BaseTagHandler.
I was wondering if there is some documentation out there for creating new
BaseTagHandler extensions, or custom Struts HTML components in general. 

I understand how to create taglibs in general, I am asking whether there is
such specific documentation for Struts.
Much thanks/Victor Grazi
 

My experience is that the easiest, fastest and best thing to do is to 
look through the source code of the struts tags.  The tags are actually 
fairly simple coding.

Michael
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Generating struts tags from a Java Bean

2004-08-18 Thread Michael McGrady
Jim Barrows wrote:
 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 17, 2004 9:42 AM
To: Struts Users Mailing List
Subject: Generating struts tags from a Java Bean
I would like to generate struts tags from a Java bean, which 
would decide 
what tags to generate based on context.
Is there any way to configure the JSP so that it will evaluate the 
JavaBean first, before the struts tags, so that the struts 
tags can be 
generated by the beans?
   

I don't believe so.  Since struts tags only generate html, you could have beans that generate html based on context.  However, given that struts and jstl have some rather powerful logical statements, you might be able to achieve what you want without doing away with struts tags, which is what you are basically asking.
 

The JSP page is read and the tags there are used to do whatever is 
required to respond to a call to that page. Usually that is writing a 
JSP page.  While you cannot use the struts tags between the JSP page and 
the ultimate HTML page, you can do something like that with code in the 
background.  So, instead of dynamically generating Struts tags as follows:

   JSP page  > JSP page  -> HTML page
   
You could somewhat easily work up something like the following:
   JSP page  > Model Use of  logic to
   generate > HTML page  from 
That clear?
Michael
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Generating struts tags from a Java Bean

2004-08-18 Thread Victor Grazi
These tags are going to be reused many times throughout our application, and
I prefer to omit this type of decision logic from the jsp pages. Therefore I
think it pays to design custom tags to accomplish what I need. 

I have been looking at some of the source code for the various tag handlers
that extend BaseTagHandler, and I see there is a lot going on. I would like
to make sure to leverage all of the functionality included in
BaseTagHandler.

I was wondering if there is some documentation out there for creating new
BaseTagHandler extensions, or custom Struts HTML components in general. 

I understand how to create taglibs in general, I am asking whether there is
such specific documentation for Struts.

Much thanks/Victor Grazi

-Original Message-
From: Craig McClanahan [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, August 17, 2004 4:42 PM
To: Struts Users Mailing List; [EMAIL PROTECTED]
Subject: Re: Generating struts tags from a Java Bean

The standard struts-example webapp has a case of conditional rendering as
well.  The "registration.jsp" page is used for both "Create a New User" and
"Log In As Existing User"., but only in the latter case does it show the
table at the bottom.  This is controlled by the following tag around the
table:

  
...
  

which makes sure that the "action" property on the "RegistrationForm"
bean equals "Edit" before displaying the table.

Craig

On Tue, 17 Aug 2004 16:13 -0400, Victor Grazi <[EMAIL PROTECTED]> wrote:
> The custom tag approach seems like the way to go. Is there any 
> documentation for considerations besides just perusing the source code 
> for exisiting html tags?
> Regards
> Victor
> 
> ... Original Message ...
> 
> 
> On Tue, 17 Aug 2004 10:53:29 -0700 "Jim Barrows" <[EMAIL PROTECTED]>
wrote:
> >
> >
> >> -Original Message-
> >> From: Victor Grazi [mailto:[EMAIL PROTECTED]
> >> Sent: Tuesday, August 17, 2004 10:35 AM
> >> To: Struts Users Mailing List
> >> Subject: RE: Generating struts tags from a Java Bean
> >>
> >>
> >> the problem we are trying to solve is that depending on user 
> >> entitlements and application state, some fields need to either be a 
> >> drop down or just text.
> >
> >What I would suggest then, is to figure that out in your action 
> >class, and
> pass boolean values as part of the form bean.  Then on the jsp page, 
> use  >
> >Alternatively you could write your own tag library for the field, 
> >which
> would figure out what html to generate based on the attributes you give
it.
>  Something like:
> > applicationState="${applicationState}"/>
> >You can of course get a list of roles from isUserInRole(), or hand 
> >them in if your doing
> something else.
> >
> >If you have only 1 or 2 pages, then the first option may be easier, 
> >but if you're doing it a
> lot then the taglib option might be better.
> >
> >>
> >>
> >> ___
> >> Sent with SnapperMail
> >> www.snappermail.com
> >>
> >> .. Original Message ...
> >> On Tue, 17 Aug 2004 09:46:49 -0700 "Jim Barrows"
> >> <[EMAIL PROTECTED]> wrote:
> >> >
> >> >
> >> >> -Original Message-
> >> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >> >> Sent: Tuesday, August 17, 2004 9:42 AM
> >> >> To: Struts Users Mailing List
> >> >> Subject: Generating struts tags from a Java Bean
> >> >>
> >> >>
> >> >> I would like to generate struts tags from a Java bean, which 
> >> >> would decide what tags to generate based on context.
> >> >> Is there any way to configure the JSP so that it will evaluate 
> >> >> the JavaBean first, before the struts tags, so that the struts 
> >> >> tags can be generated by the beans?
> >> >
> >> >I don't believe so.  Since struts tags only generate html,
> >> you could have
> >> beans that generate html based on context.  However, given that 
> >> struts and jstl have some rather powerful logical statements, you 
> >> might be able to achieve what you want without doing away with 
> >> struts tags, which is what you are basically asking.
> >> >
> >> >What problem are you trying to solve?
> >> >
> >> >
> >> >--
> >> >--- To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >>
> >>
> >> ---
> >> -- To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >>
> >>
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Generating struts tags from a Java Bean

2004-08-17 Thread Jim Barrows


> -Original Message-
> From: Victor Grazi [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 17, 2004 1:13 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Generating struts tags from a Java Bean
> 
> 
> The custom tag approach seems like the way to go. Is there any 
> documentation for considerations besides just perusing the 
> source code for 
> exisiting html tags?

There's a real nice tutorial on the java.sun.com site.

> Regards
> Victor
> 
> .. Original Message ...
> On Tue, 17 Aug 2004 10:53:29 -0700 "Jim Barrows" 
> <[EMAIL PROTECTED]> wrote:
> >
> >
> >> -Original Message-
> >> From: Victor Grazi [mailto:[EMAIL PROTECTED]
> >> Sent: Tuesday, August 17, 2004 10:35 AM
> >> To: Struts Users Mailing List
> >> Subject: RE: Generating struts tags from a Java Bean
> >> 
> >> 
> >> the problem we are trying to solve is that depending on user 
> >> entitlements 
> >> and application state, some fields need to either be a drop 
> >> down or just 
> >> text.
> >
> >What I would suggest then, is to figure that out in your 
> action class, and 
> pass boolean values as part of the form bean.  Then on the 
> jsp page, use 
>  >
> >Alternatively you could write your own tag library for the 
> field, which 
> would figure out what html to generate based on the 
> attributes you give it. 
>  Something like:
> > applicationState="${applicationState}"/>
> >You can of course get a list of roles from isUserInRole(), 
> or hand them in if your doing 
> something else.
> >
> >If you have only 1 or 2 pages, then the first option may be 
> easier, but if you're doing it a 
> lot then the taglib option might be better.
> >
> >> 
> >> 
> >> ___
> >> Sent with SnapperMail
> >> www.snappermail.com
> >> 
> >> .. Original Message ...
> >> On Tue, 17 Aug 2004 09:46:49 -0700 "Jim Barrows" 
> >> <[EMAIL PROTECTED]> wrote:
> >> >
> >> >
> >> >> -Original Message-
> >> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >> >> Sent: Tuesday, August 17, 2004 9:42 AM
> >> >> To: Struts Users Mailing List
> >> >> Subject: Generating struts tags from a Java Bean
> >> >> 
> >> >> 
> >> >> I would like to generate struts tags from a Java bean, which 
> >> >> would decide 
> >> >> what tags to generate based on context.
> >> >> Is there any way to configure the JSP so that it will 
> evaluate the 
> >> >> JavaBean first, before the struts tags, so that the struts 
> >> >> tags can be 
> >> >> generated by the beans?
> >> >
> >> >I don't believe so.  Since struts tags only generate html, 
> >> you could have 
> >> beans that generate html based on context.  However, given 
> >> that struts and 
> >> jstl have some rather powerful logical statements, you might 
> >> be able to 
> >> achieve what you want without doing away with struts tags, 
> >> which is what 
> >> you are basically asking.
> >> >
> >> >What problem are you trying to solve?
> >> >
> >> >
> >> 
> >-
> >> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> >For additional commands, e-mail: [EMAIL PROTECTED]
> >> >
> >> 
> >> 
> >> 
> -
> >> To unsubscribe, e-mail: [EMAIL PROTECTED]
> >> For additional commands, e-mail: [EMAIL PROTECTED]
> >> 
> >> 
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Generating struts tags from a Java Bean

2004-08-17 Thread Victor Grazi
The custom tag approach seems like the way to go. Is there any 
documentation for considerations besides just perusing the source code for 
exisiting html tags?
Regards
Victor

.. Original Message ...
On Tue, 17 Aug 2004 10:53:29 -0700 "Jim Barrows" <[EMAIL PROTECTED]> wrote:
>
>
>> -Original Message-
>> From: Victor Grazi [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, August 17, 2004 10:35 AM
>> To: Struts Users Mailing List
>> Subject: RE: Generating struts tags from a Java Bean
>> 
>> 
>> the problem we are trying to solve is that depending on user 
>> entitlements 
>> and application state, some fields need to either be a drop 
>> down or just 
>> text.
>
>What I would suggest then, is to figure that out in your action class, and 
pass boolean values as part of the form bean.  Then on the jsp page, use 

>Alternatively you could write your own tag library for the field, which 
would figure out what html to generate based on the attributes you give it. 
 Something like:
>
>You can of course get a list of roles from isUserInRole(), or hand them in if your 
>doing 
something else.
>
>If you have only 1 or 2 pages, then the first option may be easier, but if you're 
>doing it a 
lot then the taglib option might be better.
>
>> 
>> 
>> ___
>> Sent with SnapperMail
>> www.snappermail.com
>> 
>> .. Original Message ...
>> On Tue, 17 Aug 2004 09:46:49 -0700 "Jim Barrows" 
>> <[EMAIL PROTECTED]> wrote:
>> >
>> >
>> >> -Original Message-
>> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> >> Sent: Tuesday, August 17, 2004 9:42 AM
>> >> To: Struts Users Mailing List
>> >> Subject: Generating struts tags from a Java Bean
>> >> 
>> >> 
>> >> I would like to generate struts tags from a Java bean, which 
>> >> would decide 
>> >> what tags to generate based on context.
>> >> Is there any way to configure the JSP so that it will evaluate the 
>> >> JavaBean first, before the struts tags, so that the struts 
>> >> tags can be 
>> >> generated by the beans?
>> >
>> >I don't believe so.  Since struts tags only generate html, 
>> you could have 
>> beans that generate html based on context.  However, given 
>> that struts and 
>> jstl have some rather powerful logical statements, you might 
>> be able to 
>> achieve what you want without doing away with struts tags, 
>> which is what 
>> you are basically asking.
>> >
>> >What problem are you trying to solve?
>> >
>> >
>> >-
>> >To unsubscribe, e-mail: [EMAIL PROTECTED]
>> >For additional commands, e-mail: [EMAIL PROTECTED]
>> >
>> 
>> 
>> -
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>> 
>> 
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Generating struts tags from a Java Bean

2004-08-17 Thread Jim Barrows


> -Original Message-
> From: Victor Grazi [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 17, 2004 10:35 AM
> To: Struts Users Mailing List
> Subject: RE: Generating struts tags from a Java Bean
> 
> 
> the problem we are trying to solve is that depending on user 
> entitlements 
> and application state, some fields need to either be a drop 
> down or just 
> text.

What I would suggest then, is to figure that out in your action class, and pass 
boolean values as part of the form bean.  Then on the jsp page, use 
You can of course get a list of roles from isUserInRole(), or hand them in if your 
doing something else.

If you have only 1 or 2 pages, then the first option may be easier, but if you're 
doing it a lot then the taglib option might be better.

> 
> 
> ___
> Sent with SnapperMail
> www.snappermail.com
> 
> .. Original Message ...
> On Tue, 17 Aug 2004 09:46:49 -0700 "Jim Barrows" 
> <[EMAIL PROTECTED]> wrote:
> >
> >
> >> -Original Message-
> >> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> >> Sent: Tuesday, August 17, 2004 9:42 AM
> >> To: Struts Users Mailing List
> >> Subject: Generating struts tags from a Java Bean
> >> 
> >> 
> >> I would like to generate struts tags from a Java bean, which 
> >> would decide 
> >> what tags to generate based on context.
> >> Is there any way to configure the JSP so that it will evaluate the 
> >> JavaBean first, before the struts tags, so that the struts 
> >> tags can be 
> >> generated by the beans?
> >
> >I don't believe so.  Since struts tags only generate html, 
> you could have 
> beans that generate html based on context.  However, given 
> that struts and 
> jstl have some rather powerful logical statements, you might 
> be able to 
> achieve what you want without doing away with struts tags, 
> which is what 
> you are basically asking.
> >
> >What problem are you trying to solve?
> >
> >
> >-
> >To unsubscribe, e-mail: [EMAIL PROTECTED]
> >For additional commands, e-mail: [EMAIL PROTECTED]
> >
> 
> 
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Generating struts tags from a Java Bean

2004-08-17 Thread Craig McClanahan
On Tue, 17 Aug 2004 13:35 -0400, Victor Grazi <[EMAIL PROTECTED]> wrote:
> the problem we are trying to solve is that depending on user entitlements
> and application state, some fields need to either be a drop down or just
> text.
> 

The underlying problem isn't really Struts related ... you're trying
to dynamically create a JSP page and then get it compiled and
executed, and that's not supported by JSP.  Instead, you'll need to
use some other technique.

The most common approach for solving this particular problem is to
surround the conditional fields with something like  (if
using Struts conditional tags) or  (if using JSTL), and use an
expression that tests whether this particular user should see this
particular field.

Craig

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Generating struts tags from a Java Bean

2004-08-17 Thread Victor Grazi
the problem we are trying to solve is that depending on user entitlements 
and application state, some fields need to either be a drop down or just 
text.


___
Sent with SnapperMail
www.snappermail.com

.. Original Message ...
On Tue, 17 Aug 2004 09:46:49 -0700 "Jim Barrows" <[EMAIL PROTECTED]> wrote:
>
>
>> -Original Message-
>> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
>> Sent: Tuesday, August 17, 2004 9:42 AM
>> To: Struts Users Mailing List
>> Subject: Generating struts tags from a Java Bean
>> 
>> 
>> I would like to generate struts tags from a Java bean, which 
>> would decide 
>> what tags to generate based on context.
>> Is there any way to configure the JSP so that it will evaluate the 
>> JavaBean first, before the struts tags, so that the struts 
>> tags can be 
>> generated by the beans?
>
>I don't believe so.  Since struts tags only generate html, you could have 
beans that generate html based on context.  However, given that struts and 
jstl have some rather powerful logical statements, you might be able to 
achieve what you want without doing away with struts tags, which is what 
you are basically asking.
>
>What problem are you trying to solve?
>
>
>-
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Generating struts tags from a Java Bean

2004-08-17 Thread Jim Barrows


> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, August 17, 2004 9:42 AM
> To: Struts Users Mailing List
> Subject: Generating struts tags from a Java Bean
> 
> 
> I would like to generate struts tags from a Java bean, which 
> would decide 
> what tags to generate based on context.
> Is there any way to configure the JSP so that it will evaluate the 
> JavaBean first, before the struts tags, so that the struts 
> tags can be 
> generated by the beans?

I don't believe so.  Since struts tags only generate html, you could have beans that 
generate html based on context.  However, given that struts and jstl have some rather 
powerful logical statements, you might be able to achieve what you want without doing 
away with struts tags, which is what you are basically asking.

What problem are you trying to solve?


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]