File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Plus Signs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Plus Signs" Watch "Plus Signs" New topic
Author

Plus Signs

Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 828
Hey All,
The application I'll refer to is in JSP but I believe the problem lies elsewhere. Have an app whereby sometimes + signs come back in the data and sometimes it doesn't, using Post method in form. The page gets displayed by a JSP, shouldn't matter. The problem is "someone else" is getting plus signs stored in the database and I'm uncertain where the problem really lies (whether coming from the form, the third party javabeans we're using, within JSP, something to do with IIS, etc..,). Can someone suggest some ways to help eliminate plus signs within such an application so that at least I can try them out and also implement and see if that resolves the problem? Thanks.

Rob
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

Sounds like the request params aren't getting decoded at some point in the process (+ signs should decode as spaces).

You'll need to check the data at each step opf the process to see if the params aren't getting decoded, or more likely, are being double-encoded somewhere.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 828
Hey Bear,
New thing. The form we prompt for values has 5 fields but when we send back the values to the JSP the values get sent to a third party object then we use a method belonging to the object to write to the database. When it writes the entry to the database the first time with +s instead of spaces it continues to do so until the browser is closed and reopened. Sometimes users might go all day without experiencing a problem. We make a connection to the database using these third party javabeans and store them in the session for quicker reference later on other pages or the same pages again. Do you think this is web server related, serlet container related, or the third party javabeans at play? I'm guessing you'll be tittering on moving this to the JSP forum now. Thanks for the advice. If you suggest contacting the third party provider I'm going to ask if you could sign our petition for seeking a response.

RP
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61756
    
  67

How are you getting the data to send to the 3rd party code? Are you massaging it in any way on the way in or out?
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 828
Hi Bear,
It's easier to look at this way:
1) we use a method from the third party object to read a record
2) we populate 5 fields on the form with the values and store any objects within the session
3) we update the fields and JSP accepts the data back, takes the 5 fields and inserts into a "RedField", "dynamic array" object whereby a write is performed (the write is a method in the object as well).
4) 80% or more of the time we do not get the + sign substitution for spaces PLUS when the record gets written and the plus signs as well ALL the fields get plus signs in for spaces. Those additional fields (outside the 5 on the form) aren't even accepted back from the form in any way but the "old" object (before updated with fields from form) is stored within the session.
5) we're using IE 6, IIS, and using the post action for the form. We are not only dealing with an inconsistency with the plus sign subing happening but also fields that aren't accepting values from the form getting the substitution as well. Any help would be very much appreciated. Thanks again.

Rob
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 828
Bear,
Just wondering if you could give me a detailed description of what a session is (i.e. where the session information is stored and where it lies within the scope of an application)? What information can be maintained (if any) throughout the life of a web application instance within the web server? Servlet container? Client's machine? Currently we store temporary information certain ways and I'd like to explore other ways of doing so if they better apply. Thanks so much for the help.

Rob
Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
A very good chapter describing session tracking.

http://pdf.coreservlets.com/CSAJSP-Chapter9.pdf

Originally posted by Rob Pike:
Bear,
Just wondering if you could give me a detailed description of what a session is (i.e. where the session information is stored and where it lies within the scope of an application)? What information can be maintained (if any) throughout the life of a web application instance within the web server? Servlet container? Client's machine? Currently we store temporary information certain ways and I'd like to explore other ways of doing so if they better apply. Thanks so much for the help.

Rob


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Plus Signs