Discussion:
forwarding to an action w/o an input JSP
(too old to reply)
Chuck Chopp
2004-09-02 19:21:24 UTC
Permalink
I'm looking for some good solid examples that show how to configure the JSP
files, struts-config.xml [global forwards, action mappings, form beans] and
action classes where a JSP may forward/redirect to an action [may end up
being a chain of actions] before another JSP is finally displayed. The 2
books that I've been using for learning Struts are "The Struts Framework: A
Practical Guide for Java Programmers" by Sue Spielman and "Programming
Jakarta Struts" by Chuck Cavaness. Both of these books seem to be lacking
solid explanations & examples of the the full range of configurations for
forwards & actions. I keep getting the feeling that if I could see one good
comprehensive working example everything would be clear to me about how this
is supposed to work.

I have a welcome file named "index.jsp". I'm questioning if it should be
forwarding to the JSP file "login.jsp" [which I want to protect from direct
access from the browser] or should it be forwarding to the action named
"login" [or would it be "login.do"]? The action named "login" expects to
use "login.jsp" as its input, and I'm just not certain now whether
forwarding to a JSP will invoke the action or if forwarding to the action
will cause its input form to be displayed.


Also, in my web.xml file, I have a url-pattern of "*.do" set in my
servlet-mapping. What I'm not clear on is how/why URLs appear back in the
browser such as "login.do" and "success.do" when the global forwards that my
actions are using are called by their configured names of "login" and
"success". I'm concerned about the browser backward/forward buttons and the
reload button being clicked & what this might do to navigation within my webapp.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
David Durham
2004-09-02 19:45:26 UTC
Permalink
Post by Chuck Chopp
I'm looking for some good solid examples that show how to configure the JSP
files, struts-config.xml [global forwards, action mappings, form beans] and
action classes where a JSP may forward/redirect to an action [may end up
being a chain of actions]
Dear God, please let no one help him with this. Are you talking about
request dispatching from a JSP to an Action? That's not a chain of
Actions. Thats, well, I don't think there's a name for it -- not a good
one, anyway.
Post by Chuck Chopp
before another JSP is finally displayed. The 2
books that I've been using for learning Struts are "The Struts
Framework: A
Practical Guide for Java Programmers" by Sue Spielman and "Programming
Jakarta Struts" by Chuck Cavaness.
I don't know about the first book, but the second is very well written,
IMHO.
Post by Chuck Chopp
Both of these books seem to be lacking
solid explanations & examples of the the full range of configurations for
forwards & actions.
Again, I have to humbly disagree with you on this point.
Post by Chuck Chopp
I keep getting the feeling that if I could see one good
comprehensive working example everything would be clear to me about how this
is supposed to work.
There's plenty of them out there. Struts itself ships with one.
Post by Chuck Chopp
I have a welcome file named "index.jsp". I'm questioning if it should be
forwarding to the JSP file "login.jsp" [which I want to protect from direct
access from the browser] or should it be forwarding to the action named
"login" [or would it be "login.do"]?
If you're going to protect a JSP from direct access, one good way is to
put the JSP inside the WEB-INF and then have an action do a forward to
that JSP (presumably after a security check).
Post by Chuck Chopp
The action named "login" expects to
use "login.jsp" as its input, and I'm just not certain now whether
forwarding to a JSP will invoke the action or if forwarding to the action
will cause its input form to be displayed.
The request itself cause an action to be invoked. That is, a request
comes in that matches the URI mapping to the ActionServlet. Hopes
that's clear (it's crucial.) The ActionServlet receives the request and
does something with it (probably calls an Action, passing it the
request). Then you're action does some stuff and returns a Forward.
The ActionServlet then calls a RequestDispatcher's forward method based
on the Forward that was returned to it. Basically, your Action returns
a forward to a JSP (better off not to chain actions), and the JSP writes
to the response.
Post by Chuck Chopp
Also, in my web.xml file, I have a url-pattern of "*.do" set in my
servlet-mapping.
This is so that requests matching *.do get passed to the ActionServlet.
The ActionServlet looks at the * part to pass off to the correct action.
Post by Chuck Chopp
What I'm not clear on is how/why URLs appear back in the
browser such as "login.do" and "success.do" when the global forwards that my
actions are using are called by their configured names of "login" and
"success".
I think you're confusing a "forward" with a redirect. A forward, in
this context refers to an internal process in you ServletContainer.
Namely, a RequestDispatcher is used to pass the request off between
Servlets. In this case, we're passing the request off (internally) from
the model (ActionServlet and Action) to the view(a JSP). Your URL will
still be reflective of the original request (something.do), because a
redirect wasn't returned to your client -- the directing was handled
internally. This is a major strength of Struts.
Post by Chuck Chopp
I'm concerned about the browser backward/forward buttons and the
reload button being clicked & what this might do to navigation within my webapp.
I don't have too much for you on this. I'm almost positive that there
are hooks to check for "duplicate" requests occurring within a timeframe
(not nessecarily part of struts), and the backward/forward button issue
has to do with the statelessness (did I type that right?) of HTTP. That
is, you have to be ready for any kind of request with security and
validation in mind. Struts is not going to do that for you, but it
contains certain extension points, including plugins, that make it easy
to consolidate this code.


- Dave
Chuck Chopp
2004-09-02 23:00:44 UTC
Permalink
Post by David Durham
Post by Chuck Chopp
I have a welcome file named "index.jsp". I'm questioning if it should be
forwarding to the JSP file "login.jsp" [which I want to protect from direct
access from the browser] or should it be forwarding to the action named
"login" [or would it be "login.do"]?
If you're going to protect a JSP from direct access, one good way is to
put the JSP inside the WEB-INF and then have an action do a forward to
that JSP (presumably after a security check).
I did that. Specifically, I have a subfolder named "form" under the
"WEB-INF" folder. I placed my protected JSP files in there. My index.jsp
file [the welcome file] used the "logic:forward" tag to forward to an action
named "login", and the "login" action uses my protected "login.jsp" and the
corresponding ActionForm & Action classes. What I found is that on WinXP
running Tomcat v4.1.30 & NetWare v6.5 running Tomcat v4.1.28, the webapp
deployed & ran properly. However, Tomcat v4.1.24 running on OpenVMS Alpha
v7.3-1 refuses to compile my JSP files that are in a subfolder under
"WEB-INF". This really threw me for a loop and I've been trying to discover
why this is happening. Needless to say, when I take code that was already
working in one Tomcat implementation and it suddenly stops working in
another implementation of a comparable version [keeping the JDK constant at
v1.4.2], it leaves me confused.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Wendy Smoak
2004-09-02 20:25:54 UTC
Permalink
Post by Chuck Chopp
I keep getting the feeling that if I could see one good
comprehensive working example everything would be clear to me about how this
is supposed to work.
Have you spent some quality time with struts-example.war yet? Run that in a
debugger (JSwat, if you don't already have a favorite,) for an hour, and
most of the mysteries will be solved.
--
Wendy Smoak
Chuck Chopp
2004-09-02 23:07:53 UTC
Permalink
Post by Wendy Smoak
Have you spent some quality time with struts-example.war yet? Run that in a
debugger (JSwat, if you don't already have a favorite,) for an hour, and
most of the mysteries will be solved.
No, but now that I know where it is I can spend some time with it. I just
found it inside the Struts distribution kit. I wasn't aware that I needed
the Struts distribution kit at all as it looked like MyEclipse Enterprise
Workbench was providing all of the Struts files needed for a project.
Apparently the Struts demo/example webapps don't get distributed with that
particular Eclipse plug-in and they don't appear to be part of the Tomcat
distribution, either.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Erik Weber
2004-09-02 21:13:47 UTC
Permalink
Chuck, I think reading the Servlet specification would help you a lot! I
think it is well edited, and it sure helped me a lot.

Keep in mind that just as a container dispatches requests to Servlets
according to how the Servlets are mapped in web.xml, the Struts
controller Servlet dispatches requests to Actions according to how the
Actions are mapped in struts-config.xml.

The container asks, which Servlet should I invoke? If it is the Struts
controller Servlet, then the controller Servlet will look at the path
even more closely and, in turn, ask, which Action should I invoke? An
Action might even service three or four different (but similar) URLs, so
the pattern can go on within narrower and narrower contexts.

If your controller Servlet is mapped to *.do in web.xml, then the
container sees /actor1/usecase1.do and /actor2/usecase3.do as the same
-- they are headed for the controller Servlet. But the controller
Servlet sees the difference in these -- it will invoke one Action for
one and a different Action for the other.
Post by Chuck Chopp
I'm looking for some good solid examples that show how to configure
the JSP files, struts-config.xml [global forwards, action mappings,
form beans] and action classes where a JSP may forward/redirect to an
action [may end up being a chain of actions] before another JSP is
finally displayed. The 2 books that I've been using for learning
Struts are "The Struts Framework: A Practical Guide for Java
Programmers" by Sue Spielman and "Programming Jakarta Struts" by Chuck
Cavaness. Both of these books seem to be lacking solid explanations &
examples of the the full range of configurations for forwards &
actions. I keep getting the feeling that if I could see one good
comprehensive working example everything would be clear to me about
how this is supposed to work.
I think you should check out the examples on Rick Reumann's site:

http://www.reumann.net/do/struts/main
Post by Chuck Chopp
I have a welcome file named "index.jsp". I'm questioning if it should
be forwarding to the JSP file "login.jsp" [which I want to protect
from direct access from the browser] or should it be forwarding to the
action named "login" [or would it be "login.do"]?
The link would be to "/login.do". The ".do" portion tells the container
to map to the controller Servlet. The "/login" portion tells the
controller Servlet which Action to invoke. That action will forward to
"/login.jsp".
Post by Chuck Chopp
The action named "login" expects to use "login.jsp" as its input, and
I'm just not certain now whether forwarding to a JSP will invoke the
action or if forwarding to the action will cause its input form to be
displayed.
Also, in my web.xml file, I have a url-pattern of "*.do" set in my
servlet-mapping. What I'm not clear on is how/why URLs appear back in
the browser such as "login.do" and "success.do" when the global
forwards that my actions are using are called by their configured
names of "login" and "success". I'm concerned about the browser
backward/forward buttons and the reload button being clicked & what
this might do to navigation within my webapp.
Say the user's browser has requested "/restrictedpage.do". The container
dispatches the request to your Struts controller Servlet. The controller
Servlet invokes the "/restrictedpage"Action. The Action determines that
the user is not logged in, so instead of forwarding to
"/restrictedpage.jsp" as the user might have expected, you instead
forward to "/login.jsp". The user's browser is still going to reflect
"/restrictedpage.do". You serviced the request -- you sent back some
HTML as a response by forwarding to some JSP. The browser didn't care
what page on the server the HTML actually came from. If you want the
browser to reflect "/login.do", you need to issue a redirect in your
Action, instead of a forward. A redirect is a very small response that,
instead of including any HTML to display, simply tells the user's
browser to make a *different* request -- this time to the login page.

Hope that helps,
Erik
Chuck Chopp
2004-09-02 23:17:58 UTC
Permalink
Post by Erik Weber
Chuck, I think reading the Servlet specification would help you a lot! I
think it is well edited, and it sure helped me a lot.
Thanks for that tip. I will head on over to Sun's web site and read over
the specs themselves independent of the actual servelet container
implementations.

The part that was getting me was something that was hinted at in an example
in one of the books I mentioned, but the example wasn't complete enough to
get working code from it.

JSP #1 accepts user credentials and the submit button invokes Action #1.

Action #1 verifies user credentials and either forwards to JSP #2 or stores
errors in the request and forwards badk to JSP #1.

JSP #2 can have several functions performed with different submit buttons,
most of which forward to other JSPs and one of them invokes a logout action.
The part that was giving me fits was getting the logout action mapping
done properly since there's no input form associated with it. Once I got it
worked out properly, I could have the logout action do its task and then
that action, in turn, forwarded back to JSP #1 that prompts for a login.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Erik Weber
2004-09-02 23:34:14 UTC
Permalink
Yeah, you can actually have actions that are this simple (no Action
class or form bean required):

<action path="/bar" forward="/bar.jsp"/>

My logout action mappings typically look like this:

<action path="/actor/logout" type="SessionManagerAction"
parameter="executeLogout">
<forward name="success" path="/shared/main_index.jsp"/>
</action>

I would think yours would be similar except that your forward path would
be to a login page instead of a main index page, and you might not be
using the parameter attribute. The parameter attribute is there because
I have a single action that handles login as well as logout, so it has
to be parameterized.

Those books drive me crazy too. (Don't you just love the ones that say
things like "Here is some code. Now, if this code was *actually meant to
be used*, we would be handling errors, etc., here . . . "). They are
written in three months typically, and, in my judgment, usually not
edited by anyone who could pass Journalism 101.

There are exceptions though. Two I have encountered:

"Thinking in Java" (self published) by Bruce Eckel
"A Programmer's Guide to Java Certification" by Mughal and Rasmussen (my
favorite Java book of all).

I actually enjoyed reading the Servlet specification as well (it used to
be only 70 pages long -- then it was truly awesome).

Erik
Post by Erik Weber
Chuck, I think reading the Servlet specification would help you a
lot! I think it is well edited, and it sure helped me a lot.
Thanks for that tip. I will head on over to Sun's web site and read
over the specs themselves independent of the actual servelet container
implementations.
The part that was getting me was something that was hinted at in an
example in one of the books I mentioned, but the example wasn't
complete enough to get working code from it.
JSP #1 accepts user credentials and the submit button invokes Action #1.
Action #1 verifies user credentials and either forwards to JSP #2 or
stores errors in the request and forwards badk to JSP #1.
JSP #2 can have several functions performed with different submit
buttons, most of which forward to other JSPs and one of them invokes a
logout action. The part that was giving me fits was getting the logout
action mapping done properly since there's no input form associated
with it. Once I got it worked out properly, I could have the logout
action do its task and then that action, in turn, forwarded back to
JSP #1 that prompts for a login.
Jim Barrows
2004-09-02 22:31:18 UTC
Permalink
-----Original Message-----
Sent: Thursday, September 02, 2004 12:21 PM
Subject: forwarding to an action w/o an input JSP
I'm looking for some good solid examples that show how to
configure the JSP
files, struts-config.xml [global forwards, action mappings,
form beans] and
action classes where a JSP may forward/redirect to an action
[may end up
being a chain of actions] before another JSP is finally
displayed. The 2
books that I've been using for learning Struts are "The
Struts Framework: A
Practical Guide for Java Programmers" by Sue Spielman and
"Programming
Jakarta Struts" by Chuck Cavaness. Both of these books seem
to be lacking
solid explanations & examples of the the full range of
configurations for
forwards & actions. I keep getting the feeling that if I
could see one good
comprehensive working example everything would be clear to me
about how this
is supposed to work.
There are several excellent example apps on sourceforge, as well as on the links page of the basic struts documentation at struts.jakarta.apache.org
I have a welcome file named "index.jsp". I'm questioning if
it should be
forwarding to the JSP file "login.jsp" [which I want to
protect from direct
access from the browser] or should it be forwarding to the
action named
"login" [or would it be "login.do"]? The action named
"login" expects to
use "login.jsp" as its input, and I'm just not certain now whether
forwarding to a JSP will invoke the action or if forwarding
to the action
will cause its input form to be displayed.
index.jsp shouldn't forward anywhere. Redirect maybe... post maybe... but not forward.
Contemplate the definition of forward for wisdom. It's a tricky little bugger.
Also, in my web.xml file, I have a url-pattern of "*.do" set in my
servlet-mapping. What I'm not clear on is how/why URLs
appear back in the
browser such as "login.do" and "success.do" when the global
forwards that my
actions are using are called by their configured names of "login" and
"success". I'm concerned about the browser backward/forward
buttons and the
reload button being clicked & what this might do to
navigation within my webapp.
Struts knows that actions need to have the appropriate url pattern, and is capable of applying that pattern.

Back, next and reload will do to a struts app what they do with any other app: Allow the user to break your application in new and interesting ways.

--Jim Barrows
Chuck Chopp
2004-09-02 23:20:19 UTC
Permalink
Post by Jim Barrows
Back, next and reload will do to a struts app what they do with any other app: Allow the user to break your application in new and interesting ways.
I've seen the term "tokens" used in some postings here that appear to be
dealing with the same issue. Am I on the right track if I begin researching
tokens [as they relate to Struts apps] in the context of dealing with the
backward/forward button issue?
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Erik Weber
2004-09-02 23:35:21 UTC
Permalink
Yes, and consider learning how to prevent pages from being cached by the
browser as well.

Erik
Post by Chuck Chopp
Post by Jim Barrows
Back, next and reload will do to a struts app what they do with any
other app: Allow the user to break your application in new and
interesting ways.
I've seen the term "tokens" used in some postings here that appear to
be dealing with the same issue. Am I on the right track if I begin
researching tokens [as they relate to Struts apps] in the context of
dealing with the backward/forward button issue?
Jim Barrows
2004-09-02 23:03:35 UTC
Permalink
-----Original Message-----
Sent: Thursday, September 02, 2004 4:01 PM
Subject: Re: forwarding to an action w/o an input JSP
<snip>
why this is happening. Needless to say, when I take code
that was already
working in one Tomcat implementation and it suddenly stops working in
another implementation of a comparable version [keeping the
JDK constant at
v1.4.2], it leaves me confused.
I would immediately suspect either the JVM, or the underlying OS and the permissions of. Maybe even the way the security manager is setup on the JVM.
Chuck Chopp
2004-09-03 01:46:40 UTC
Permalink
Post by Jim Barrows
I would immediately suspect either the JVM, or the underlying OS and the permissions of. Maybe even the way the security manager is setup on the JVM.
That's the part that's getting me. I'm using JDK versions that are only a
"-" dash away from each other. I've got JDK v1.4.2-5 on WinXP and JDK
v1.4.2-2 on OpenVMS. I'm looking into the security manager issue to see if
there's anything involved there that might prevent JSPs from being compiled
when they are located in a subfolder located under "WEB-INF". I'm confident
that the underlying O.S. file system permissions are not a factor, though,
as the user account that was specifically created to run Apache & Tomcat was
explicitly set to be the owner of that entire folder hierarchy and ACLs were
added that grant that user full permissions to the folders & files.

The underlying issue appears to be that the login_jsp.java file is not being
found and thus the Java compiler ends up throwing a ClassNotFound exception.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Wendy Smoak
2004-09-03 15:59:01 UTC
Permalink
Post by Chuck Chopp
That's the part that's getting me. I'm using JDK versions that are only a
"-" dash away from each other. I've got JDK v1.4.2-5 on WinXP and JDK
v1.4.2-2 on OpenVMS.
They're running on different hardware (I assume) and definitely under
different operating systems. That's a lot different than moving from one
dash-version to another on the same platform.

They _ought_ to function exactly the same (the promise of write once, run
anywhere!) but these "other" JVM's (including the one we use for HP-UX)
often require some tweaking to work right. When we first started, Tomcat
would inexplicably crash every so often. It took recompiling the HP-UX
kernel with some different tuning parameters to make everything work
correctly.
--
Wendy Smoak
Chuck Chopp
2004-09-03 17:38:51 UTC
Permalink
Post by Wendy Smoak
Post by Chuck Chopp
That's the part that's getting me. I'm using JDK versions that are only a
"-" dash away from each other. I've got JDK v1.4.2-5 on WinXP and JDK
v1.4.2-2 on OpenVMS.
They're running on different hardware (I assume) and definitely under
different operating systems. That's a lot different than moving from one
dash-version to another on the same platform.
Yes, WinXP is on a 2.4 GHz Mobile P4 based DELL laptop. OpenVMS is running
on an Alpha processor in an AlphaServer DS10L rackmount system.

The JDK/JRE on WinXP was downloaded directly from Sun and the Tomcat kit was
downloaded from the Apache/Jakarta web site. The JDK/JRE on OpenVMS was
downloaded from HP's web site, as was the OpenVMS-specific Tomcat kit.
Post by Wendy Smoak
They _ought_ to function exactly the same (the promise of write once, run
anywhere!) but these "other" JVM's (including the one we use for HP-UX)
often require some tweaking to work right. When we first started, Tomcat
would inexplicably crash every so often. It took recompiling the HP-UX
kernel with some different tuning parameters to make everything work
correctly.
Yes, I was counting on "write once, run anywhere" in this case. I'm doing
something *very* basic here that should work fine w/o any problems
regardless of the platform it is on as long as the Tomcat & JDK/JRE are at
or above the required minimum versions.

OpenVMS isn't a unix derivative, so there's no recompiling of the kernel to
be done, per-se. There are other types of system parameter tuning that can
be done on OpenVMS, and I've gone through and granted unlimited resources to
the account that runs the JVM that Tomcat runs within.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Jim Barrows
2004-09-02 23:12:02 UTC
Permalink
-----Original Message-----
Sent: Thursday, September 02, 2004 4:08 PM
Subject: Re: forwarding to an action w/o an input JSP
Post by Wendy Smoak
Have you spent some quality time with struts-example.war
yet? Run that in a
Post by Wendy Smoak
debugger (JSwat, if you don't already have a favorite,) for
an hour, and
Post by Wendy Smoak
most of the mysteries will be solved.
No, but now that I know where it is I can spend some time
with it. I just
found it inside the Struts distribution kit. I wasn't aware
that I needed
the Struts distribution kit at all as it looked like
MyEclipse Enterprise
Workbench was providing all of the Struts files needed for a project.
Apparently the Struts demo/example webapps don't get
distributed with that
particular Eclipse plug-in and they don't appear to be part
of the Tomcat
distribution, either.
Nope, they wouldn't be included with Tomcat... and yes you need the struts distribution, and the source code to.. so you can step through it. Not just while you're learning, but after you've mastered it as well.
Chuck Chopp
2004-09-03 00:17:23 UTC
Permalink
Post by Jim Barrows
Nope, they wouldn't be included with Tomcat... and yes you need the struts distribution, and the source code to.. so you can step through it. Not just while you're learning, but after you've mastered it as well.
And that's where things start to get slightly "murky" w/respect to figuring
out am I doing something wrong [very likely], what am I doing wrong [if I'm
doing something wrong] or what's broken [if I'm not doing anything wrong].

So with Struts very new to me [as developer], Tomcat somewhere between
slightly to moderately familiar from a system admin's point of view [e.g.
have to drop WAR files in place for some admin tools and see that they run]
and Java moderately familiar [but not from use in a webapp framework like
Struts] along with 30 to 40 other programming languages that I currently or
have previously worked with, I've got the following components to deal with:

1) Java as a language, including various versions of the JDK & JRE.

2) Struts as a framework

3) Tomcat as a servlet container

4) Multiple operating systems.

5) Eclipse as the base IDE

6) MyEclipse Enterprise Workbench & Ant as plug-ins to Eclipse.

7) Platform-specific distributions of Tomcat, each with their own caveats
w/respect to configuration of the O.S. environment in which Tomcat will run.
Add in minor to possibly major differences depending on who prepares the
Tomcat distribution and factor in the JDK/JRE version differences as well.

8) JVM remote debug configuration.


When I sum it all up, one stupid mistake on my part or one very subtle
difference in the O.S. environment or a platform-specific implementation
detail can wreak one hell of a lot of havoc. Even with a good level of
experience with doing Usenet searches with Google it can be a daunting task
to find the correct reference resources at times to make my understanding of
things click into place. And, given the broad scope of sources from which
the various components come from, the knowledge base underlying it all for
FAQs & support is fractured & fragmented to a great degree. So it isn't
just learning one new thing, such as just a new language or a new framework
with a known language, it is learning several new things at the same time.
The last time I checked, human beings are equiped to juggle approximately 6
to 8 concurrent tasks if they are well organized. That much new material at
any given time is likely to be daunting to anybody until the eureka
lightbulb starts to shine.

Things are starting to mesh together now, especially since I got my remote
debug configuration working between Eclipse & Tomcat. I'll take the
struts-examples.war file and run it to death in the debugger and see what
else falls into place, too, and then my understanding should be improved.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Wendy Smoak
2004-09-03 00:39:30 UTC
Permalink
Post by Chuck Chopp
So it isn't
just learning one new thing, such as just a new language or a new framework
with a known language, it is learning several new things at the same time.
The last time I checked, human beings are equiped to juggle approximately 6
to 8 concurrent tasks if they are well organized. That much new material at
any given time is likely to be daunting to anybody until the eureka
lightbulb starts to shine.
Good list! Add to that, you're working with open source stuff, which will
change right out from under you if you're not paying attention.

Just keep asking questions, you're doing fine. It won't be long until
you're answering other newbies' questions. And if you think you're all
alone, look back in the list archives for my name... talk about confused!
Some of my early posts read like I randomly selected words from the Struts
website and strung them together.

The lightbulb will come on soon. :) [Weird, I used that phrase in my note
suggesting debugging struts-example.war and deleted it thinking it was too
flip.]
--
Wendy Smoak
Chuck Chopp
2004-09-03 01:39:28 UTC
Permalink
Post by Wendy Smoak
Good list! Add to that, you're working with open source stuff, which will
change right out from under you if you're not paying attention.
LOL... isn't that a hidden part of the definition of open source stuff?
The faster development cycle makes it hard to freeze the technology long
enough to get fluent in it. Mentally keeping up with new features being
released in "reference" releases while at the same time being limited by
lagging implementations on certain platforms keep my thinking spread out a
bit thin. That's just the nature of the open source beast, though.
Post by Wendy Smoak
Just keep asking questions, you're doing fine. It won't be long until
you're answering other newbies' questions. And if you think you're all
alone, look back in the list archives for my name... talk about confused!
Some of my early posts read like I randomly selected words from the Struts
website and strung them together.
It'll come along soon. It will just take getting through all of the tasks
successfully one time [meaning several failed attempts happen first] and
then it will all click.
Post by Wendy Smoak
The lightbulb will come on soon. :) [Weird, I used that phrase in my note
suggesting debugging struts-example.war and deleted it thinking it was too
flip.]
Nah.... that's not flip sounding at all. That's how it works for me most of
the time. The light simply comes on as if a voice said "let there be
comprehension" and suddenly it all makes sense.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Jim Barrows
2004-09-03 15:36:42 UTC
Permalink
-----Original Message-----
Sent: Thursday, September 02, 2004 4:20 PM
Subject: Re: forwarding to an action w/o an input JSP
Post by Jim Barrows
Back, next and reload will do to a struts app what they do
with any other app: Allow the user to break your application
in new and interesting ways.
I've seen the term "tokens" used in some postings here that
appear to be
dealing with the same issue. Am I on the right track if I
begin researching
tokens [as they relate to Struts apps] in the context of
dealing with the
backward/forward button issue?
Yes, tokens and the redirect-after-get pattern.. basically redirect after processing a form to make everything work correctly.
Jim Barrows
2004-09-03 15:48:08 UTC
Permalink
-----Original Message-----
Sent: Thursday, September 02, 2004 6:39 PM
Subject: Re: forwarding to an action w/o an input JSP
Post by Wendy Smoak
Good list! Add to that, you're working with open source
stuff, which will
Post by Wendy Smoak
change right out from under you if you're not paying attention.
LOL... isn't that a hidden part of the definition of open
source stuff?
I've found that it's worse dealing with proprietary software... especially MS. MS might have cleaned up their act in the regard, but I doubt it. With open source you just need to keep the occasional eye on the web page, and if you're really paranoid, the source code. Try doing that with Proprietary.
The faster development cycle makes it hard to freeze the
technology long
enough to get fluent in it. Mentally keeping up with new
features being
released in "reference" releases while at the same time being
limited by
lagging implementations on certain platforms keep my thinking
spread out a
bit thin. That's just the nature of the open source beast, though.
I dunno... I upgrade things when they release and don't pay a lot of attention to RC's.
Post by Wendy Smoak
Just keep asking questions, you're doing fine. It won't be
long until
Post by Wendy Smoak
you're answering other newbies' questions. And if you
think you're all
Post by Wendy Smoak
alone, look back in the list archives for my name... talk
about confused!
Post by Wendy Smoak
Some of my early posts read like I randomly selected words
from the Struts
Post by Wendy Smoak
website and strung them together.
It'll come along soon. It will just take getting through all
of the tasks
successfully one time [meaning several failed attempts happen
first] and
then it will all click.
Post by Wendy Smoak
The lightbulb will come on soon. :) [Weird, I used that
phrase in my note
Post by Wendy Smoak
suggesting debugging struts-example.war and deleted it
thinking it was too
Post by Wendy Smoak
flip.]
Nah.... that's not flip sounding at all. That's how it works
for me most of
the time. The light simply comes on as if a voice said "let there be
comprehension" and suddenly it all makes sense.
--
Chuck Chopp
ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com
RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651
Do not send me unsolicited commercial email.
---------------------------------------------------------------------
Jim Barrows
2004-09-03 15:51:52 UTC
Permalink
-----Original Message-----
Sent: Thursday, September 02, 2004 6:47 PM
Subject: Re: forwarding to an action w/o an input JSP
Post by Jim Barrows
I would immediately suspect either the JVM, or the
underlying OS and the permissions of. Maybe even the way the
security manager is setup on the JVM.
That's the part that's getting me. I'm using JDK versions
that are only a
"-" dash away from each other. I've got JDK v1.4.2-5 on
WinXP and JDK
v1.4.2-2 on OpenVMS. I'm looking into the security manager
issue to see if
there's anything involved there that might prevent JSPs from
being compiled
when they are located in a subfolder located under "WEB-INF".
I'm confident
that the underlying O.S. file system permissions are not a
factor, though,
as the user account that was specifically created to run
Apache & Tomcat was
explicitly set to be the owner of that entire folder
hierarchy and ACLs were
added that grant that user full permissions to the folders & files.
I've seen issues with Linux where just because the server was started under a user who had rwx permissions on a file, for some reason the thread doing the rwx didn't. Havne't seen that in a while and I don't if it was the Linux did threads, Java did threads, or the way Java did threads on linux. So, it might be worthwhile looking into it farther if nothing else works.
The underlying issue appears to be that the login_jsp.java
file is not being
found and thus the Java compiler ends up throwing a
ClassNotFound exception.
Hmmmmm...... that sounds like a classpath issue... is anything else in the same directory as login_jsp.java being found?
Course... it also sounds like a permissions issue too... OS, java or OS&Java.....
Chuck Chopp
2004-09-03 17:02:43 UTC
Permalink
Post by Jim Barrows
I've seen issues with Linux where just because the server was started under a user who had rwx permissions on a file, for some reason the thread doing the rwx didn't. Havne't seen that in a while and I don't if it was the Linux did threads, Java did threads, or the way Java did threads on linux. So, it might be worthwhile looking into it farther if nothing else works.
Hmmmmm...... that sounds like a classpath issue... is anything else in the same directory as login_jsp.java being found?
Course... it also sounds like a permissions issue too... OS, java or OS&Java.....
I did some more testing with adding additional JSPs to my test webapp.

Here's what I have


/index.jsp
/login.jsp
/success.jsp
/Form/page01.jsp
/WEB-INF/form/page02.jsp
/WEB-INF/page03.jsp

I have "index.jsp" set up as my welcome page. It uses the tag
"logic:redirect" to redirect the browser to the action named "login" which
uses "login.jsp" as its input form. After the "login" action completes, it
forwards to an action named "success" which displays "success.jsp". The
"success.jsp" page has 3 submit buttons on it, one each for "page01.jsp",
"page02.jsp" and "page03.jsp". The "success" action has 3 forwards defined
for it so that any of those 3 pages can be forwarded to depending on which
one of the submit buttons is clicked in the browser.

Testing has shown that *any* JSP file located within "WEB-INF" or in any
subfolder under "WEB-INF" cannot be compiled by Jasper when the webapp is
deployed on my OpenVMS system. If I deploy the app to WinXP or NetWare and
run it on the Tomcat implementations on those systems there is no problem
getting all of the JSPs to compile as they are being accessed.

I've reviewed the "conf/server.xml" and "conf/catalina.policy" files on the
OpenVMS Tomcat implementation and they are identical to the files on my
WinXP system.

What other configuration files do I need to review to rule out a
configuration error that could cause this problem?


TIA,

Chuck
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Brett Connor
2004-09-03 18:45:39 UTC
Permalink
Chuck Chopp wrote:

<snip>
Post by Chuck Chopp
I did some more testing with adding additional JSPs to my test webapp.
Here's what I have
/index.jsp
/login.jsp
/success.jsp
/Form/page01.jsp
/WEB-INF/form/page02.jsp
/WEB-INF/page03.jsp
I have "index.jsp" set up as my welcome page. It uses the tag
"logic:redirect" to redirect the browser to the action named "login"
which uses "login.jsp" as its input form. After the "login" action
completes, it forwards to an action named "success" which displays
"success.jsp". The "success.jsp" page has 3 submit buttons on it, one
each for "page01.jsp", "page02.jsp" and "page03.jsp". The "success"
action has 3 forwards defined for it so that any of those 3 pages can
be forwarded to depending on which one of the submit buttons is
clicked in the browser.
Testing has shown that *any* JSP file located within "WEB-INF" or in
any subfolder under "WEB-INF" cannot be compiled by Jasper when the
webapp is deployed on my OpenVMS system. If I deploy the app to WinXP
or NetWare and run it on the Tomcat implementations on those systems
there is no problem getting all of the JSPs to compile as they are
being accessed.
I've reviewed the "conf/server.xml" and "conf/catalina.policy" files
on the OpenVMS Tomcat implementation and they are identical to the
files on my WinXP system.
What other configuration files do I need to review to rule out a
configuration error that could cause this problem?
Hmm, I'm getting a half relevent memory flash here. Weblogic took some
time to catch on to the fact that JSPs could be under WEB-INF even
though the client could not directly get them from there, I think it was
not explicit in the JSP spec in the very earliest of days. I don't know
the history of the OpenVMS port of tomcat, but there's a chance that
it's using some unusual way of opening the JSPs, perhaps using the same
mechanism that clients use, and getting fouled up here. I think I would
have a peruse of the tomcat source if you can get it for your port, see
if there's anything helpful in there. I know it's not the most enjoyable
of tasks wading through a ton of code you don't know (I'm assuming you
don't), but I've been watching this thread for about a week now, perhaps
it's time.
Good luck.

Brett Connor
Chuck Chopp
2004-09-03 20:43:35 UTC
Permalink
Post by Brett Connor
Hmm, I'm getting a half relevent memory flash here. Weblogic took some
time to catch on to the fact that JSPs could be under WEB-INF even
though the client could not directly get them from there, I think it was
not explicit in the JSP spec in the very earliest of days. I don't know
the history of the OpenVMS port of tomcat, but there's a chance that
it's using some unusual way of opening the JSPs, perhaps using the same
mechanism that clients use, and getting fouled up here. I think I would
have a peruse of the tomcat source if you can get it for your port, see
if there's anything helpful in there. I know it's not the most enjoyable
of tasks wading through a ton of code you don't know (I'm assuming you
don't), but I've been watching this thread for about a week now, perhaps
it's time.
In the O'Reilly "Programming Jakarta Struts" [1st Ed.], on pages 379-380,
this very same issue is discussed in connection with WebLogic. It appears
to related to a difference of interpretations of section SRV.6.5 of the
Servlet specification. The fact that it is working OK with the Tomcat
imlementations on WinXP & NetWare lead me to expect that it should work
equally well with other Tomcat implementations, too. However, maybe Tomcat
v4.1.24 has this as a bug while v4.1.28 & v4.1.30 handle the situation properly.

If I can get the source code for the Tomcat implementation on OpenVMS I will
take the time to review it and compare it with the source code from the
implementation that I downloaded for use on WinXP.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Jim Barrows
2004-09-03 17:46:13 UTC
Permalink
-----Original Message-----
Sent: Friday, September 03, 2004 10:03 AM
Subject: Re: JSP won't compile on Tomcat v4.1.28 on OpenVMS
What other configuration files do I need to review to rule out a
configuration error that could cause this problem?
Any of the security manager related files. I don't know what they are off the top of my head. That's what it sounds like to me anyway, since Tomcat does not normally exclude WEB-INF, it's something outside tomcat.
Chuck Chopp
2004-09-03 20:34:36 UTC
Permalink
Post by Jim Barrows
Any of the security manager related files. I don't know what they are off the top of my head. That's what it sounds like to me anyway, since Tomcat does not normally exclude WEB-INF, it's something outside tomcat.
I would expect that there would be some sort of explicit exclusion affecting
"WEB-INF" and that this should appear somewhere in the Tomcat configuration
files. So far, I've been unable to find any references to "WEB-INF" that
involves anything security related. This was the result of examining all
files found doing a brute-force search of files in the file system.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Wendy Smoak
2004-09-03 20:43:44 UTC
Permalink
Post by Chuck Chopp
I would expect that there would be some sort of explicit exclusion affecting
"WEB-INF" and that this should appear somewhere in the Tomcat
configuration
Post by Chuck Chopp
files. So far, I've been unable to find any references to "WEB-INF" that
involves anything security related. This was the result of examining all
files found doing a brute-force search of files in the file system.
Have you asked on tomcat-user? If you think Tomcat is misbehaving, they may
have more insight into what it could be.
--
Wendy Smoak
Chuck Chopp
2004-09-03 22:43:26 UTC
Permalink
Post by Wendy Smoak
Have you asked on tomcat-user? If you think Tomcat is misbehaving, they may
have more insight into what it could be.
Yes, I've posted some inquiries there as well. It is looking like the
Tomcat implementation on OpenVMS is damaged and I'm taking up the discussion
over on comp.os.vms.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Vic
2004-09-04 02:40:23 UTC
Permalink
I did not see any posts about this on the Tomcat user list. The group
there is very good.
.V
Post by Chuck Chopp
Post by Wendy Smoak
Have you asked on tomcat-user? If you think Tomcat is misbehaving, they may
have more insight into what it could be.
Yes, I've posted some inquiries there as well. It is looking like the
Tomcat implementation on OpenVMS is damaged and I'm taking up the
discussion over on comp.os.vms.
--
Please post on Rich Internet Applications User Interface (RiA/SoA)
<http://www.portalvu.com>
Chuck Chopp
2004-09-04 14:00:36 UTC
Permalink
Post by Vic
I did not see any posts about this on the Tomcat user list. The group
there is very good.
I'm going through the news.gmane.org news server and using the news group
gmane.comp.jakarta.tomcat.user instead of directly emailing to a mailing
list. Perhaps there's some sort of delay with the news to email gateway.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Jim Barrows
2004-09-03 20:38:38 UTC
Permalink
-----Original Message-----
Sent: Friday, September 03, 2004 1:35 PM
Subject: Re: JSP won't compile on Tomcat v4.1.28 on OpenVMS
Post by Jim Barrows
Any of the security manager related files. I don't know
what they are off the top of my head. That's what it sounds
like to me anyway, since Tomcat does not normally exclude
WEB-INF, it's something outside tomcat.
I would expect that there would be some sort of explicit
exclusion affecting
"WEB-INF" and that this should appear somewhere in the Tomcat
configuration
files. So far, I've been unable to find any references to
"WEB-INF" that
involves anything security related. This was the result of
examining all
files found doing a brute-force search of files in the file system.
You've elimated the OS & Security Manager. That leaves us with a version of the VM that knows about WEB-INF or Tomcat.
It's possible Tomcat is doint something weird based on OS.
--
Chuck Chopp
ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com
RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651
Do not send me unsolicited commercial email.
---------------------------------------------------------------------
Chuck Chopp
2004-09-03 22:42:32 UTC
Permalink
Post by Jim Barrows
You've elimated the OS & Security Manager. That leaves us with a version of the VM that knows about WEB-INF or Tomcat.
It's possible Tomcat is doint something weird based on OS.
I back-rev'd down to JDK v1.4.1 from JDK v1.4.2 on OpenVMS and the problem
still occurs. The Tomcat version has remained constant.

I've taken up the discussion on comp.os.vms in an effort to get some
platform-specific support for the Compaq Secure Web Server - Java Servlet
v2.1 [CSWS_JAVA v2.1] product, which is what Tomcat is known as on OpenVMS.
I don't know if Tomcat source code used for that build is available or
not, but I've asked about it in a posting over on comp.os.vms so I'll see
what kind of response I get there.
--
Chuck Chopp

ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com

RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651

Do not send me unsolicited commercial email.
Jim Barrows
2004-09-03 22:47:16 UTC
Permalink
-----Original Message-----
Sent: Friday, September 03, 2004 3:43 PM
Subject: Re: JSP won't compile on Tomcat v4.1.28 on OpenVMS
Post by Jim Barrows
You've elimated the OS & Security Manager. That leaves us
with a version of the VM that knows about WEB-INF or Tomcat.
Post by Jim Barrows
It's possible Tomcat is doint something weird based on OS.
I back-rev'd down to JDK v1.4.1 from JDK v1.4.2 on OpenVMS
and the problem
still occurs. The Tomcat version has remained constant.
I've taken up the discussion on comp.os.vms in an effort to get some
platform-specific support for the Compaq Secure Web Server -
Java Servlet
v2.1 [CSWS_JAVA v2.1] product, which is what Tomcat is known
as on OpenVMS.
The name change is interesting...I'm wondering if they tinkered with the code...

Good luck!
I don't know if Tomcat source code used for that build is
available or
not, but I've asked about it in a posting over on comp.os.vms
so I'll see
what kind of response I get there.
--
Chuck Chopp
ChuckChopp (at) rtfmcsi (dot) com http://www.rtfmcsi.com
RTFM Consulting Services Inc. 864 801 2795 voice & voicemail
103 Autumn Hill Road 864 801 2774 fax
Greer, SC 29651
Do not send me unsolicited commercial email.
---------------------------------------------------------------------
Continue reading on narkive:
Loading...