|
Prev: Hibernate mapping <many-to-one>
Next: Puma Reptile Mid (black / tender shoots), www.NikeHome.net
From: Daniel Pitts on 7 Jul 2008 10:47 LB wrote: > I'm using an HTML form on a .jsp page which sends the following hidden > field (amoung other data fields) > > <INPUT TYPE="hidden" name="realPath" value= < > %=application.getRealPath("/")%> > > > application.getRealPath("/") resolves to: "C:\Documents and Settings > \HP_Administrator\My Documents\NetBeansProjects\SampleProject\build > \web" > > Not sure why, but when the data is sent to next page (via either POST > or GET) the spaces do NOT flip to '+' as expected for the realPath > piece of data. All the other data entries translate correctly. The > system only sends "C:\Documents" and stops right there. (actually it > looks like "realPath=C%3A%5CDocuments" but you get the idea.) > > Anybody been here before? Any hints on how to fix this? > thanks in advance, > LB You need to make sure you put quotes around it. You should also probably make sure you HTML or XML escape your output at some point, you'll be sorry if you don't :-) The problem is that you HTML output is <INPUT TYPE="hidden" name="realPath" value= C:\Documents and Settings\HP_Administrator\My Documents\NetBeansProjects\SampleProject\build\web> Which isn't valid HTML! The web browser will see that the attribute called "value" of your input field is "C:\Documents", and then it will see that it has a bunch of nonsensical other attributes, such as "and", "settings\HP_Administrator\My", etc... BTW, View Source is a wonderful tool for seeing what is actually generated before the browser munges it in parsing :-) And remember to always escape your output appropriately. -- Daniel Pitts' Tech Blog: <http://virtualinfinity.net/wordpress/>
|
Pages: 1 Prev: Hibernate mapping <many-to-one> Next: Puma Reptile Mid (black / tender shoots), www.NikeHome.net |