aspose file tools*
The moose likes JSP and the fly likes using replaceAll() function with jstl Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Reply locked New topic
Author

using replaceAll() function with jstl

Khushwinder Chahal
Ranch Hand

Joined: Oct 03, 2007
Posts: 128
Hi All

I am passing values from a child window to parent window.
The child window has the following link on clinking of which the corresponding value pass to the parent window:



The argument in the closewindow() function passes to the parent window's text box.
My problem comes when ${stone.code} contains the apostrophe in it.
The java script gives the err as we know we should replace all occurances of
' with \' .
But i am unable to do this in with the jstl.
I have already spent a lot of time on it.
Please help me if any body has any idea.
Thanks a lot of you people in advance.


Khushwinder
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

You can use the fn library's replace function. Here is a sample, look at the JSTL spec for more info about this function.



[My Blog]
All roads lead to JavaRanch
Khushwinder Chahal
Ranch Hand

Joined: Oct 03, 2007
Posts: 128
Thanks for your reply Sir

But my problem is i am declaring a parameter with c aram tag.
like :

<c aram name="catchphrase" value="${fn:replace(catchphrase, "'", "\\'")}" />

But this gives the compilation problem in jsp in value field as wen can see
" is ends when i write replace function.
So any body has any idea.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61770
    
  67

This is similar to your other post, so I'm going to close this one so any discussion can take place in the original.

Also, please be sure that you check the disable smilies checkbox when posting code.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using replaceAll() function with jstl