Many thanks to all for your replies. I've learned a lot because of
your responses.
1)From: shakah <
[email protected]> Date: Mon, 7 Jul 2008 06:01:18
-0700 (PDT)
Are you quoting the value attribute, i.e.:
<INPUT TYPE="hidden" name="realPath" value="<
%=application.getRealPath("/")%>" >
FWIW, it can be helpful to make a regular practice of validating your
HTML output via tools like those found at htmlhelp.com, w3c.org, the
WebDeveloper extension for Firefox, etc.
LB Response: Obviously you are correct. I did leave off the
quotation marks. In fact I left them off servlets and EL Expressions
throughout my JSP document.
And yes everybody is correct about HTML validation. Haven't had to do
that in quite a while. Biggest issue here is, until I saw your
responses (particularly the one about Internet Explorer right click
View Source) I never realized how Java servlet code resolved in
HTML... I just presumed the source would appear same as JavaScript,
visible to the world in view source. I presumed that I have to use
javaBeans throughout to hide the majority of my code. Obvious that
was wrong... thanks for the hints.
Shakah, thank you!
2)From: Lew <
[email protected]> Date: Mon, 07 Jul 2008 09:25:01
-0400
Use lower-case HTML tags, so that the transition to XHTML is easier.
Use EL '${realPath}' instead of scriptlet '<%= ... %>'.
--
Lew
LB Response: Lew, thanks for your info. I didn't have a clue about
going to lower-case HTML tags. I will do that from now on in all my
code! The other hint on EL '${realPath} stuff got me to re-examine my
understanding of Expression Language (EL) nomenclature. I spent a
couple of hours today trying to refresh my memory of EL why's and go
thru some examples. I spent a lot of time digesting sites like
http://java.sun.com/developer/EJTechTips/2004/tt0126.html. I still
haven't figured out how to translate the JSP Expression <%=... to EL $
{... expression, but I'm still working on it. I would have thought JSP
Expression <%=application.getRealPath("/")%> would map to EL
expression ${applicationScope.getRealPath} but that doesn't seem to
work. I do some more research after I complete this note.
One question: I'm doing the meat of my work within Plain Old Java
Class(POJO) JavaBean objects in this project. I'm sending the
realPath into the JavaBean class from the calling xxx.jsp file using
the <INPUT type ="hidden"... I need that pathname for file I/O. My
real question is, "Is there a way to call for the realPath from within
the javaBean class itself?"
--LB
3)From: Daniel Pitts <
[email protected]> Date:
Mon, 07 Jul 2008 07:47:57 -0700
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

....
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/>
LB Response: Daniel, thanks for your feedback. I do have a
question... What do you mean by the word 'escape' in the sentence
"make sure you HTML or XML escape your output at some point". Do you
mean do an HTML source validity check on the web page? (Note: I did
check read your web page / blog, and I apologize, I still don't
understand your use/definition of the word 'escape'. An escape is
when I leave somewhere I don't want to be, or a key on my keyboard. I
have trouble seeing beyond that. No offense intended.)
I presume by "View Source" you are talking about Internet Explorer,
right click, View Source, and not some other fancy program, right?
Until I read your note, I didn't realize that expressions were
translated BEFORE the page was displayed. (okay, duh!) I just never
thought about it. Good idea! I agree, View, Source is a great way to
quick test expressions. Daniel, thanks for your feedback.
Again, thanks to all for the education here.
--LB