DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30696>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30696

Struts-Tiles-JSF-Integration SOMETIMES creates blank pages





------- Additional Comments From [EMAIL PROTECTED]  2004-09-07 08:03 -------
My work-around to the original problem with h:outputLink sometimes generating 
blank pages is the following:

I replaced all h:outputLink which directly called a Struts-Action (.do) with 
s:form and h:commandButton and placed a JavaScript that updates hidden input 
fields with the dynamic values specific to the button clicked!

=> Form submission never creates the blank pages because s:form submits to the 
Tiles layout page (e.g. layout.faces) instead of directly submitting to the 
Struts-Action (.do)!

Example with h:outputLink (DOES NOT WORK => sometimes creates blank pages):

<h:outputLink id="commandLinkPrev" value="scrollarticles.do">
<f:param name="page" value="#{PrevPage}"/>
<h:graphicImage url="images/arrow-previous.gif" />
</h:outputLink>

Example with s:form (WORKS FINE!, except for the problem below):

<s:form action="/scrollarticles">
<%-- another hidden field is rendered by JSF here, so in JavaScript I refer to 
elements starting with index 1 instead of 0 --%>
<h:inputHidden id="page" value="#{generalscrollForm.page}" />
<h:commandButton type="SUBMIT" image="images/arrow-previous.gif" 
onclick="this.form.elements[1].value='#{PrevPage}';"/>
<h:commandButton type="SUBMIT" image="images/arrow-next.gif" 
onclick="this.form.elements[1].value='#{NextPage}';"/>
</s:form>

New Problem:
When you have 2 forms with the same action on 1 page, the second one won't 
work.
Solution: you need to include the form somewhere on the page, include the 
hidden field and one Submit-Button within the form, and place simple buttons 
on your page, which execute JavaScript that updates the form's hidden fields.
You still need to press the one Submit-Button of the form manually!
Problem: You cannot use JavaScript on your various buttons to submit the form! 
I assume this is the JSF problem that Greg described as a dependency between a 
form and the component that submits it!

Again, there is no new s:outputLink in Struts-Faces! There's a new 
s:commandLink which submits the surrouding s:form.

Example with my JavaScript work-around:

<s:form action="/scrollarticles">
<%-- another hidden field is rendered by JSF here, so in JavaScript I refer to 
elements starting with index 1 instead of 0 --%>
<h:inputHidden id="page" value="#{generalscrollForm.page}" />
<s:commandLink id="commandLinkPrev" onclick="this.form.elements[1].value='#
{PrevPage}';">
<h:graphicImage url="images/arrow-previous.gif" styleClass="button-image" />
</s:commandLink>
<s:commandLink id="commandLinkNext" onclick="this.form.elements[1].value='#
{NextPage}';">
<h:graphicImage url="images/arrow-next.gif" styleClass="button-image" />
</s:commandLink>
</s:form>

THIS DOES NOT WORK because the onlclick attribute is ignored in the rendered 
<a/> tag which includes its own onclick attribute for submitting the 
surrounded form!!!

Conclusion:
Always using forms and JavaScript to call a Struts-Action instead of directly 
calling "someaction.do" eliminates the problem of sometimes receiving blank 
pages, BUT there are problems with multiple forms pointing to the same Struts-
Action within one single page AND so far, you cannot use JavaScript with the 
onclick event on the new s:commandLink!
So far, you can only use JavaScript on s:commandButton if you need variuos 
buttons on a page and need to change the values of the form's fields depending 
on which button is clicked!

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

Reply via email to