You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Dakota Jack <da...@gmail.com> on 2005/06/01 00:03:20 UTC

Re: Dynamically adding components to pages (using struts and custom tags)

Not sure why Rahul sent you a reference to your own question.  Sort of
encourages strange iterations!  ///;-)  Just kidding!

In my opinion, using custom tags for this purpose is not the best way
to go.  Custom tags are meant to decouple code from markup.  I would
(A) either use a controller/navigation switch for this (B) or use some
logic on the page for this, e.g. <c:if>, etc.

On 5/31/05, Rahul Akolkar <ra...@gmail.com> wrote:
> [ http://marc.theaimsgroup.com/?l=taglibs-user&m=111756793724193&w=2 ]
> 
> -Rahul
> 
> 
> On 5/31/05, Marius Botha <ma...@workpool.co.za> wrote:
> > Hi there,
> >
> > Hope someone can help me.
> >
> > I have a requirement where my system needs to prompt users for certain
> > information at certain times in a process. To do this I need to be able to
> > add components to a page at run time based on a user's permissions. E.g. if
> > the user is supposed to specify a date for the process to continue, I need
> > to provide a calendar control; and if the user needs to enter a name, then
> > provide a textbox. I have developed my own custom tags that I would want to
> > use but I have the following questions:
> >
> > 1. How do I reuse my components in such an environment? I suppose I would
> > need to provide a StringBuffer or something to my component to write to
> > (how?) and then call the doStartTag(), etc. methods manually?
> > 2. How do I implement this in the JSP, seeing as the html/tags would have to
> > be inserted at a certain stage. Has anyone done this before or can you give
> > me any pointers?
> >
> > Much appreciated.
> >
> > Marius Botha
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> > For additional commands, e-mail: user-help@struts.apache.org
> >
> >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 


-- 
"You can lead a horse to water but you cannot make it float on its back."
~Dakota Jack~

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


RE: Dynamically adding components to pages (using struts and custom tags)

Posted by Marius Botha <ma...@workpool.co.za>.
>In my opinion, using custom tags for this purpose is not the best way
>to go.  Custom tags are meant to decouple code from markup.

I tend to agree with you.

>I would (A) either use a controller/navigation switch for this (B)
>or use some logic on the page for this, e.g. <c:if>, etc.

What do you mean by (A)?

(B) seems like the only practical option at the moment. My controller will
return a list of "attributes" (to be completed by the user on this step). I
will then have to go though each of them (iteratively) and use something
like <c:choose> to display or not display the custom tag associated to this
attribute (like a calendar control, text box, etc.). Does that sound about
right?

Thanks.


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