You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Steve Vanspall <sv...@bigpond.net.au> on 2006/02/20 04:19:05 UTC

Acessing TagHandlerPool for TagSupport

I know this isn't specifically struts realted, but am having trouble 
finding a jasper mailing list.

Basically was wondering if I can have a custom tagsupport tag's 
doStartTag() method acess the taghandlerpool.

Basically i want ot be able to create a form, where neccesary, with a 
start tag.

but, like struts does, only know the action and parameters adn be able 
to look up what form I should be using.

Also it would help if I knew how many form were laready in use, and if a 
form tag was open, and hence can throw an error.

So basically, I could create a html:form within some code that this tag 
creates.

Alternatively, although not the most desirable option, is the a way to 
output <html:form as part fo the start tag, and get the JSP to re 
evaluated it again.

Theres' probably a simple, duh!, solution coming my way, just can't seem 
to find the answer.

Thanks

Steve



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


Re: Acessing TagHandlerPool for TagSupport

Posted by Steve Vanspall <sv...@bigpond.net.au>.
ok thanks,

that will solve my problem

Steve

Craig McClanahan wrote:

>On 2/20/06, Steve Vanspall <sv...@bigpond.net.au> wrote:
>  
>
>>Thanks will have a look,
>>
>>yeah I figured reevaluation isn't the go.
>>
>>as I said I know the action I want is already going to be configure din
>>the struts-config file, so basically I need to look it up, then create a
>>form for it.
>>
>>I can fudge it by codig the HTML roughly as teh struts tage would do it,
>>if only I could look up struts-config from a TagSupport extension.
>>    
>>
>
>
>I should have been a bit more clear.  You *do* have access to the
>configuration information that Struts read from the
>struts-config.xmlfiles.  They are stored (if you only have one module)
>under a servlet
>context attribute named by symbolic constant Globals.MODULE_KEY (in a tag
>handler you can call PageContext.getAttribute() to acquire it).
>
>It's the "create a JSP page dynamically and get it compiled" part of the
>problem that isn't going to work well.
>
>Craig
>
>  
>




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


Re: Acessing TagHandlerPool for TagSupport

Posted by Craig McClanahan <cr...@apache.org>.
On 2/20/06, Steve Vanspall <sv...@bigpond.net.au> wrote:
>
> Thanks will have a look,
>
> yeah I figured reevaluation isn't the go.
>
> as I said I know the action I want is already going to be configure din
> the struts-config file, so basically I need to look it up, then create a
> form for it.
>
> I can fudge it by codig the HTML roughly as teh struts tage would do it,
> if only I could look up struts-config from a TagSupport extension.


I should have been a bit more clear.  You *do* have access to the
configuration information that Struts read from the
struts-config.xmlfiles.  They are stored (if you only have one module)
under a servlet
context attribute named by symbolic constant Globals.MODULE_KEY (in a tag
handler you can call PageContext.getAttribute() to acquire it).

It's the "create a JSP page dynamically and get it compiled" part of the
problem that isn't going to work well.

Craig

Re: Acessing TagHandlerPool for TagSupport

Posted by Steve Vanspall <sv...@bigpond.net.au>.
Thanks will have a look,

yeah I figured reevaluation isn't the go.

as I said I know the action I want is already going to be configure din 
the struts-config file, so basically I need to look it up, then create a 
form for it.

I can fudge it by codig the HTML roughly as teh struts tage would do it, 
if only I could look up struts-config from a TagSupport extension.



Craig McClanahan wrote:

>On 2/19/06, Steve Vanspall <sv...@bigpond.net.au> wrote:
>  
>
>>I know this isn't specifically struts realted, but am having trouble
>>finding a jasper mailing list.
>>
>>Basically was wondering if I can have a custom tagsupport tag's
>>doStartTag() method acess the taghandlerpool.
>>    
>>
>
>
>There is no API for this.  Indeed, in JSP 2.0 if you use simple tags there
>is no pooling of tag instances either.
>
>Basically i want ot be able to create a form, where neccesary, with a
>  
>
>>start tag.
>>
>>but, like struts does, only know the action and parameters adn be able
>>to look up what form I should be using.
>>
>>Also it would help if I knew how many form were laready in use, and if a
>>form tag was open, and hence can throw an error.
>>
>>So basically, I could create a html:form within some code that this tag
>>creates.
>>
>>Alternatively, although not the most desirable option, is the a way to
>>output <html:form as part fo the start tag, and get the JSP to re
>>evaluated it again.
>>
>>Theres' probably a simple, duh!, solution coming my way, just can't seem
>>to find the answer.
>>    
>>
>
>
>What you need to build forms like this dynamically is a component model like
>the one provided by JavaServer Faces or Tapestry.  The Shale framework[1]
>(also part of the Struts community), built on top of JSF, has an example of
>building views dynamically that is somewhat different than your use case (it
>lets you do SQL Browser queries, and dynamically decides what columns to
>show in the output table based on which database columns were returned in
>response to executing the query), but illustrates the principle.  It would
>be straightforward, for example, to dynamically generate a set of field
>labels and input fields based on the columns in a database, or the
>properties of a JavaBean.
>
>Trying to dynamically construct JSP code and then "re-evaluate it" is not
>the right approach to this kind of problem.
>
>Thanks
>  
>
>>Steve
>>    
>>
>
>
>Craig
>
>[1] http://struts.apache.org/struts-shale/
>
>
>---------------------------------------------------------------------
>  
>
>>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


Re: Acessing TagHandlerPool for TagSupport

Posted by Craig McClanahan <cr...@apache.org>.
On 2/19/06, Steve Vanspall <sv...@bigpond.net.au> wrote:
>
> I know this isn't specifically struts realted, but am having trouble
> finding a jasper mailing list.
>
> Basically was wondering if I can have a custom tagsupport tag's
> doStartTag() method acess the taghandlerpool.


There is no API for this.  Indeed, in JSP 2.0 if you use simple tags there
is no pooling of tag instances either.

Basically i want ot be able to create a form, where neccesary, with a
> start tag.
>
> but, like struts does, only know the action and parameters adn be able
> to look up what form I should be using.
>
> Also it would help if I knew how many form were laready in use, and if a
> form tag was open, and hence can throw an error.
>
> So basically, I could create a html:form within some code that this tag
> creates.
>
> Alternatively, although not the most desirable option, is the a way to
> output <html:form as part fo the start tag, and get the JSP to re
> evaluated it again.
>
> Theres' probably a simple, duh!, solution coming my way, just can't seem
> to find the answer.


What you need to build forms like this dynamically is a component model like
the one provided by JavaServer Faces or Tapestry.  The Shale framework[1]
(also part of the Struts community), built on top of JSF, has an example of
building views dynamically that is somewhat different than your use case (it
lets you do SQL Browser queries, and dynamically decides what columns to
show in the output table based on which database columns were returned in
response to executing the query), but illustrates the principle.  It would
be straightforward, for example, to dynamically generate a set of field
labels and input fields based on the columns in a database, or the
properties of a JavaBean.

Trying to dynamically construct JSP code and then "re-evaluate it" is not
the right approach to this kind of problem.

Thanks
>
> Steve


Craig

[1] http://struts.apache.org/struts-shale/


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