You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Sundar Narasimhan <su...@ascent.com> on 2003/02/02 19:09:00 UTC

ok.. but how?

David -- Apologies.. but I'm a newbie to struts, and can't understand
your statement. Can you perhaps show me what you mean by concatenate
strings together? In short, are you saying struts cannot do somehting
like this?
ps. I have tried different syntaxes such as:
     <li> <html:link page=<%= "/action" + type %> ...
etc. but none of them seem to work. 
    
--

>>>>> "Sundar" == Sundar Narasimhan <su...@ascent.com> writes:

    Sundar> Hi, I have a variable "type" which I'd like to use like so
    Sundar> <logic:iterate id="element" collection="<%= myVector %>">
    Sundar>   <li> <html:link page="/action<%= type %>.do">
    Sundar> <bean:write name="element" 
/> </html:link></li>
    Sundar> </logic:iterate>

    Sundar> But no matter what I try I don't seem to be able to get
    Sundar> the link to do
    Sundar> the right thing.. Ideas?

Well, one problem is that if you use a scriptlet expression for a
custom tag
attribute, the expression scriptlet has to be the entire attribute
value, not
just a portion of it.  You'll have to concatenate strings together.

-- 

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


Re: ok.. but how?

Posted by "David M. Karr" <dm...@earthlink.net>.
>>>>> "Sundar" == Sundar Narasimhan <su...@ascent.com> writes:

    Sundar> David -- Apologies.. but I'm a newbie to struts, and can't understand
    Sundar> your statement. Can you perhaps show me what you mean by concatenate
    Sundar> strings together? In short, are you saying struts cannot do somehting
    Sundar> like this?
    Sundar> ps. I have tried different syntaxes such as:
    Sundar>      <li> <html:link page=<%= "/action" + type %> ...
    Sundar> etc. but none of them seem to work. 
    
Try this:

  <html:link page='<%= "/action" + type.toString() + ".do" %>' >
   <bean:write name="element"/>
  </html:link>

>>>>> "Sundar" == Sundar Narasimhan <su...@ascent.com> writes:

    Sundar> Hi, I have a variable "type" which I'd like to use like so
    Sundar> <logic:iterate id="element" collection="<%= myVector %>">
    Sundar> <li> <html:link page="/action<%= type %>.do">
    Sundar> <bean:write name="element" 
    Sundar> /> </html:link></li>
    Sundar> </logic:iterate>

    Sundar> But no matter what I try I don't seem to be able to get
    Sundar> the link to do
    Sundar> the right thing.. Ideas?

    Sundar> Well, one problem is that if you use a scriptlet expression for a
    Sundar> custom tag
    Sundar> attribute, the expression scriptlet has to be the entire attribute
    Sundar> value, not
    Sundar> just a portion of it.  You'll have to concatenate strings together.

-- 
===================================================================
David M. Karr          ; Java/J2EE/XML/Unix/C++
dmkarr@earthlink.net   ; SCJP; SCWCD




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