This content has been marked as final.
Show 3 replies
-
1. Re: How to search word in h:inputTextArea?
sivaprasad9394 Aug 10, 2010 3:14 AM (in response to eswaramoorthy1985)Hi Moorthy,In your case,you can use the String class.suppose if you are searching by Hi from the below string.String textStr="Hi,How are you,Hi How are you, Hi how are you, Hi how are you,";int indexValue=textStr.indexOf(searchparam text); For example consider (second Hi)indexValue= 15; (Approximately depends upon how you are giving string text with space and all)String a= textStr.substring(0,15);String criteriaStr = textStr.substring(15,SearchBean.searchField length);(for example your case hi is 2 length)String reminingStr = textStr.substring(search criteria text length,textStr length);Now you have to format the string with the CSS styleclass.String fullString = a+<font class>criteriaStr<end font class> +reminingStr;Using this idea apply for all and similar manner Previous button clicking also.if there is need use for loop and hold Hi count values for searching second hi and next values. -
2. Re: How to search word in h:inputTextArea?
ilya_shaikovsky Aug 10, 2010 3:54 AM (in response to eswaramoorthy1985)you sure that for that case you need to use ajax? Maybe just try some JS solution?
-
3. Re: How to search word in h:inputTextArea?
eswaramoorthy1985 Aug 10, 2010 3:55 AM (in response to sivaprasad9394)In my textarea height is 15 (rows=15).
For example assume this ,
my filecontent more than 50 lines and Textarea have scrollbar option .
And also , the word 'Hi' locations is line number 5, 25, 45,50.
Now first time i click next button, Highlight the word 'hi' in 5th line,.
Then second time i click next button,
now i want to highlight the word 'hi' in 25 th line, and automativally scroll down the taxtarea.
Because the textarea height is 15 only (rows 50, cols 140).
How to acheive this?