Hi all,

I am using Java Servlets with XML and XSLt,

I am getting the values from text area in XSL , the value is using Escape method in Javascript.

The code is Like

src = frm.txtFeedBackDsc.value;
          src=rtrim(src,' ');
          src=ltrim(src,'');
          dest= escape(src);
          frm.hsFeedbackDsc.value=dest;

And the Value is stored in Database. If the value contains Special characters it should convert it into escape character and stored it.

For example it have a output in XSL : a b c means it stored it in database as a%20b%20c like this.

I print it in XSL again Using unescape method using javascript.

The code is like

src=document.txtFeedBack.value;  
              dest=unescape(src);
              document.txtFeedBack.value =dest;

But my problem is when i search this element i got an unwanted data.

When i search like just 2 and start search, it displayed the above data also.

Is there any methods or solutions to solve this problem?

Thanks in advance for you help..


Myl

Uhm, like 2 and not like \%20, maybe?

IOW, define a better query.

I am using Javascript Escape() method to replace a junk values and get the values in Servlet and

store the data in database table.

For Ex : the Input is given by the User : 1) a b c d
2) 1 2 3

And the input are stored the database like this : 1) a%20b%20c%20d
2) 1%202%203


In List, I displayed it through unescape() Javascript method and Print the Original user input data.

But my Problem is when I search in the List servlet it display the unwanted data, which is in database but it does not contain the search value.

For Ex: I give 2 as Search value it display above both value.

But the User give 2 as input in second value only.

Is there any methods or solution in MySQL?

Thanks

Myl

Why it is saved like this:
a%20b%20c%20d

How to you send the values and how you retrieve them?

Thanks for you reply,

In my textbox(or Text area), we get the value and call a method escape() in Javascript in converted it into junk replace values and then we get the value from XSL using request.getParameter() method and store the value in database.

Then get the value from Database and in our list XSL , we display the normal value(All values) using unescape() method in Javascript.

If i do not do like this means, Junk Characters displayed in my list screen. That is why we convert it like this.

It came problem when Search..

Thanks

Myl

I didn't understand much your response, but are you saying that you take the value from the text area and you add those "junk values" (%20) ?

If I understood correctly, why do you do this?

Hi once more thanks for your reply,

Actually, we want to store a responsibilities value in a table.

If the user may copy their responsibilities from their resume and paste here(in text area). When we get this value directly through Java-Servlet(without escape() method) and insert these data into database table means it stored.

But in list it displays some junk characters like â„¢. To avoid this problem , using escape() and Unescape() methods. That is why i was doing like this..

Is there any methods or solution in MySQL?

Yes. As I said, already, use a better query. And/Or don't do this encoding before writing to the DB (of which there is no need, neither HTML nor XML needs that URL encoding of content).

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.