You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@shale.apache.org by David Delbecq <de...@oma.be> on 2006/07/11 15:40:24 UTC

some questions regarding dialogs and subdialogs

Hello all,

Recently, i decided to play a bit with shale.  I began to write some 
tests jsp to play with it. I came across various problems/interrogations:

1) considering the following dialog configuration, and the following 
jsps  (see bottom of email), i am supposed to have one main dialog, with 
a button starting a subdialog to edit one specific value.
More precisely, the backing bean of  main dialog is a property bean 
which gets modified by the subdialog. I can start the dialog ok with  
<h:commandLink value="start..." action="dialog:Test Dialog"/>, i enter 
the subdialog when i click the appropriate button in testMain.faces but 
i am stuck in the subdialog. I never return from it. Did i miss 
something in the way a dialog is supposed to end? There is no message in 
console to help and in subdialog i click on an action which's outcome 
should direct to and <exit ...> of subdialog.

2) I plan in an app to have the following structure:
- have a 'main' dialog present some forms to the user to edit a bean X 
containing some properties.
- amongst properties of X there is a collection of element Y, those 
elements are complex beans which will be presented read-only
- i need, next to those elements Y to put a button starting a subdialog 
for edition of Y.
- How do i pass the element Y as a parameter to the subdialog for edition?
- Will the content of my main dialog be preserved during the run of 
subdialog?

3) While testing, i noticed if i start dialog A by clicking on an action 
'dialog:A', enter a subdialog B, redeploy the webapp, click again on 
action 'dialog:A', i get exceptions in console telling me "You have 
requested a transition outcome named "dialog:A" from a state named 
"xxxx" in a dialog named "B", but no transition definition can be 
found.  Double check the spelling of the transition outcome name. To 
circumvent this problem i need to remove my jsessionId cookie, reload 
the page containg the link to action, and the i can start dialog:A. Why 
isn't dialog:xxxx always assumed as an attempt to start a new dialog and 
drop currently running one?

4) is there a way to start a dialog process or create a link to a JSF 
page without ressorting to a <h:form><h:commandLink... construction? 
(like http://........?action=dialog:xxxx or 
http://..../userDetails.faces?username=xxxx), all this to prevent the 
use of javascript when possible and allow the sending of direct link to 
some JSF content by email.


Greetings,
David Delbecq



dialog-config.xml:
<!DOCTYPE dialogs PUBLIC
 "-//Apache Software Foundation//DTD Shale Dialog Configuration 1.0//EN"
 "http://struts.apache.org/dtds/shale-dialog-config_1_0.dtd">

<dialogs>

   <dialog name="Test Dialog" start="Edit Values">
       <view name="Edit Values" viewId="/rmi/testMain.jsp">
           <transition outcome="main" target="Edit Values"/>
           <transition outcome="sub" target="Edit Subdialog"/>           
       </view>
       <subdialog name="Edit Subdialog" dialogName="Sub Dialog">
           <transition outcome="done" target="Edit Values"/>
       </subdialog>
   </dialog>
  
   <dialog name="Sub Dialog" start="Edit Sub">
       <view name="Edit Sub" viewId="/rmi/testSub.jsp">
           <transition outcome="done" target="Exit" />
       </view>
       <end name="Exit" viewId="/rmi/testMain.jsp"/>
   </dialog>
</dialogs>





testMain.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<f:view>
 <html>
   <body>
    <h:form id="testForm">
       <h:outputText value="val1:"/>
        <h:inputText value="#{testBean.val1}"/>
        <h:inputText value="#{testBean.val2}"/>
        <h:inputText value="#{testBean.val3}"/>
       <h:commandButton action="main" value="Say Hello"/><br/>
       <h:outputText value="#{testBean.content.name}"/>
       <h:commandButton action="sub" value="Edit..."/>
    </h:form>
   </body>
 </html>
</f:view>


testSub.jsp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<f:view>
 <html>
   <body>
    <h:form id="testForm">
       <h:outputText value="sub value:"/>
        <h:inputText value="#{testBean.content.name}"/>
       <h:commandButton action="done" value="finish"/>
    </h:form>
   </body>
 </html>
</f:view>