Your requirement, as stated, is more complicated than is worth doing.

IMO you'd be better served doing this conversion on the server side.

Dave

--- Varun Ratra <[EMAIL PROTECTED]> wrote:
> Thanks for the valuable information. The problem is my company is not using
> ajax at the moment. Is there any other way to call the javascipt funtion in
> struts tag. I have a java script function placed in web project. This
> function returns a value
> 
> function shortenTextLength(text, textlength)
> {
>       var textValue = text;
>       if (textValue.length > textlength){
>               var shortenedText = textValue.substring(0,textlength) + "...";
>       }else{
>               var shortenedText = text;
>       }
>       return (shortenedText);
> }
> 
> I want to call function shortenTextLength(text, textlength) in JSP using
> struts tag.
>
> > From: "Varun Ratra" <[EMAIL PROTECTED]>
> >> I have been researching on the web on how to call javascript from Struts
> >> tag.
> >> I am using struts 2 to develop JSP. Following is the piece of code in
> >> JSP,
> >> which calls javascript
> >> <td class="nowrap">
> >> <script type="text/javascript">
> >>      document.write(shortenTextLength('${defaultReturnReason}',
> >> '${displayLength}'))
> >> </script>
> >> </td>
> >> The script returns a shortened value of defaultReturnReason based
> >> displayLength
> >> I want to use struts tag to call javascript shortenTextLength(). In
> other
> >> words, I want to embed javascript inside struts tag.
> >> Please suggest how I can achieve this.
> >> --
> >> View this message in context:
> >
>
http://www.nabble.com/How-to-call-javascript-from-Struts-tag-tp15641406p1564
> > 1406.html
> >> Sent from the Struts - User mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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]
> > 
> > 
> > 
> 
> -- 
> View this message in context:
>
http://www.nabble.com/How-to-call-javascript-from-Struts-tag-tp15641406p15740609.html
> Sent from the Struts - User mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> 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]

Reply via email to