I've got a nice little STRUTS app working by sticking to the path set by the 
community examples and keeping my views gray and skeleton-like. I'm digging 
STRUTS, my form beans are not volatile through various wizard-style screens, 
so now I move on to fleshing things out by prettyfacing the JSPs and 
retrieving data from session beans for presentation by the view.

Assumption 1: Now that I need onChange and onClick events in the JSP tags, I 
need to rely on calling the submit() method of the form. This means I need 
to remove all of my <html:submit> because of the problem mentioned by others 
on this list with name="submit" and "submit method not supported by this 
object".

Result: Good: the submit() method works and I can pass an action token 
either as a parameter of the request or as a hidden field via form bean 
property. Bad: My browser will not call the submit() method unless the URL 
of the request is *identical* to the URL of the source. So smile.jsp to 
smile.jsp works and I dispatch. faceSmile.do to smile.jsp or smile.jsp# 
fails because URLs differ and faceSmile.do or smile.jsp to faceFrown.do or 
frown.jsp fail. By *fail* I mean the submit() method *does not* call the 
perform() method of the smile action class (as verified through debugging 
console println).

Assumption 2: I need to call the action class of every JSP page and always 
forward to the action class instead of linking (href) to the JSP. This is 
necessary to properly populate collections, retrieve data from the business 
tier, etc. without resorting to scriptlets in the JSP. For example, every 
JSP forwards to a global forward like forward="face.Smile" my face.Smile 
forward paths to faceSmile.do and my faceSmile.do maps to face.jsp which 
contains an <html:form> whose action="faceSmile" and which uses the 
faceFormBean. This also solves my first problem because every link forwards 
to its own action class (smile.jsp links forward to faceSmile.do which 
matches the source URL).

Result: Good: Dispatching works, uses never see a jsp in the URL, my 
collections are populated in the action class and presented via the 
smile.jsp view. *Very Bad*: Every time I forward or call faceSmile.do, a new 
faceFormBean is instantiated, all properties are null (or default) and the 
methods in the action class attempting to get values from the faceFormBean 
get null. How do I control form bean recycling? What's going on? Does every 
call to a logical forward/action servlet generate a new request? I confirmed 
that the session id is constant.

Someone developing 4 or 5 tier apps must with STRUTS in the view and 
controller must have run into this problem! Can you help?

CONFIGURATIONS:
Tomcat 4.0/Struts 1.0/JDK1.3.1_02/JAXP1.01
Tomcat 4.0/Struts 1.0.2/JDK1.3.1_02/JAXP1.01
IBM Visual Age for Java 4.0 Enterprise with JTE and JAXP 1.0.1 nicely 
configured per help provided by many in this community (took a while 
though!)
Our target production environment is WebSphere 4 + Oracle 9i

Respectfully,
Paul Devalier


_________________________________________________________________
MSN Photos is the easiest way to share and print your photos: 
http://photos.msn.com/support/worldwide.aspx


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to