Actually, struts-bean.tld has a define tag which does the same thing (no
custom eval tag necessary):

<bean:define id="idValue" name="somebean" property="id"/>
<html:link href="somepage.jsp?action=someaction&id=<%= idValue %>" >link
text</html:link>



                                                                                       
                            
                    John Raley                                                         
                            
                    <johnr@moonli        To:     [EMAIL PROTECTED]        
                            
                    ght.com>             cc:                                           
                            
                                         Subject:     Re: nesting bean:write inside of 
html:link                   
                    08/27/2001                                                         
                            
                    03:49 PM                                                           
                            
                    Please                                                             
                            
                    respond to                                                         
                            
                    struts-user                                                        
                            
                                                                                       
                            
                                                                                       
                            




As a workaround, I wrote an 'eval' tag that captures its content to a
bean.  You can bind the content to a scripting variable and use the
variable.  It's ugly but it works.

So, you'd do this:

<x:eval id='idValue'><bean:write name="somebean" property="id" /></x:eval>
<html:link href="somepage.jsp?action=someaction&id=<%= idValue %>" >link
text</html:link>

The actual implementation of eval is very simple - just a body tag that
captures its content to a String and puts the String into the page context.

Tom Tibbetts wrote:

> I would then agree.  It's kind of a pain to create special tags to
> handle stuff like this....
>
> At 12:03 PM 8/27/01 -0700, you wrote:
>
>> Sorry - nesting like this is not allowed in JSP (another of its
>> weaknesses IMO).
>>
>> Tom Tibbetts wrote:
>>
>>> Hi All.  Is it possible to nest a bean:write inside of html:link
>>> such as you have the following:
>>>
>>> <html:link href="somepage.jsp?action=someaction&id=<bean:write
>>> name="somebean" property="id" />" >link text</html:link>
>>>
>>> When I do this I get an error that attribute somebean is not found,
>>> even though it does exist.  Thanks Tom
>>>
>>
>>
>
>







Reply via email to