[JBoss Seam] - pageflow, validation and redisplay
by KnisterPeter
Hi,
I have a pageflow + validation problem.
1. When I submit my partial data and validation fails the data inserted by the user is not redisplayed. This is very annoying.
2. I have h:selectOneMenu wich is backed by a java enum field with two options. The validation of this field is always failing.
Here is my page code and my pageflow-definition:
<s:decorate id="salutationDecorate"
| template="#{themeSelector.resourcePrefix}/fieldDecorate.xhtml">
| <ui:define name="label">#{messages.salutation}:</ui:define>
| <ui:define name="field">
| <h:selectOneMenu id="salutation" value="#{person.salutation}"
| required="true">
| <f:selectItem itemLabel="#{messages.salutationMr}" itemValue="MR" />
| <f:selectItem itemLabel="#{messages.salutationMrs}"
| itemValue="MRS" />
| </h:selectOneMenu>
| </ui:define>
| </s:decorate>
| ...
| <div class="buttonBar"><h:commandButton action="next"
| value="#{messages.btnRegister}" /></div>
|
...
| <start-page name="register" view-id="/public/register.xhtml">
| <redirect />
| <transition name="next" to="personRegistered">
| <action expression="#{register.register}" />
| </transition>
| </start-page>
| ...
|
What am I doing wrong? Anyone has an idea?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056628#4056628
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056628
18Â years, 10Â months
[JBoss Seam] - @Out problem (Seam 1.2.1)
by bsmithjj
I'm probably missing something trivial, but I am stuck with an @Out issue and hopefully someone can point something out.
First, I have a Seam component that is JavaBean; annotated as such:
@Name("evergreenUser")
| @Roles( {
| @Role(name="accessRequestUser", scope=ScopeType.CONVERSATION),
| @Role(name="userToClone")
| } )
| public class EvergreenUser implements Serializable {
| ...
| }
I have a method in a SFSB that will, based on the value of a @RequestParameter, here is the relative code:
@Stateful
| @Name("accessRequestManager2")
| public class AccessRequestManager2Bean implements AccessRequestManager2 {
|
| @Logger
| private Log log;
|
| @PersistenceContext(unitName = "accessControlDatabase")
| private EntityManager em;
|
| @In
| private UserPrincipal userPrincipal;
|
| @In(required = false)
| @Out
| private Integer currentStep;
|
| @In
| private Conversation conversation;
|
| @In(create = true)
| private DraftAccessRequestMaster draftAccessRequestMaster;
|
| @RequestParameter
| private String selectedUserId;
|
| @Out
| private List<String> errors = new ArrayList<String>();
|
| @Out(required = false)
| private EvergreenUser accessRequestUser;
|
| /**
| * Start a new add-access request. This method also generates the conversationId to
| * use in the conversation that beans of this class are associated with.
| */
| @Begin(id = "DraftAccessRequestID:#{draftAccessRequestMaster.id}", join = true)
| public void startAddRequest() {
| log.info("startAddRequest()");
|
| draftAccessRequestMaster.setCurrentStep(
| currentStep = 1
| );
|
| }
|
| /**
| * Step 2.
| * Select user to clone (optional)
| * Select 1-or-more applications and entitlements
| */
| public void editAccessRequestDetails() {
| if (selectedUserId == null) {
| log.error("User not Selected...TODO - bounce back to step 1.");
| }
| log.info("selectedUserId -> " + selectedUserId);
| accessRequestUser = QueryEPeopleUtil.findUserByUid(selectedUserId);
| log.info("accessRequestUser -> " + accessRequestUser);
|
| draftAccessRequestMaster.setCurrentStep(
| currentStep = 2
| );
| }
| ....
| }
And I use an <s:link ... /> tag to call editAccessRequestDetails()
| <s:link value="#{eUser.name}"
| action="#{accessRequestManager2.editAccessRequestDetails}" propagation="join">
| <f:param value="#{eUser.anumber}" name="selectedUserId"/>
| </s:link>
|
I also have a navigation rule in pages.xml so that when editAccessRequestDetails() is called, another page is displayed
| <page view-id="/user_access_request_step_1.xhtml">
| <navigation from-action="#{accessRequestManager2.editAccessRequestDetails}"
| evaluate="#{draftAccessRequestMaster.currentStep}">
| <rule if-outcome="1">
| <redirect view-id="/user_access_request_step_1.xhtml"/>
| </rule>
| <rule if-outcome="2">
| <redirect view-id="/user_access_request_step_2.xhtml"/>
| </rule>
| </navigation>
| <navigation from-action="#{accessRequestManager2.cancel}">
| <redirect view-id="/index.xhtml"/>
| </navigation>
| </page>
|
I want to display the @Out-jected accessRequestUser on user_access_request_step_2.xhtml (which is where we land after clicking the s:link)
| (from user_access_request_step_2.xhtml)
| #{accessRequestUser.name}
| ... more markup ....
| <h:outputText value="#{accessRequestUser}"/>
| etc...
|
I can see from the log file that the SFSB method is being called, and that the accessRequestUser is being populated by my code, however, the user_access_request_step_2.xhtml page is not able to 'find' the accessRequestUser in any scope (display of attributes or the entire instance is blank). I must be missing something, I've looked this over and over and I can't figure out why @Out isn't working ... help?
Thanks,
Brad Smith
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4056627#4056627
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4056627
18Â years, 10Â months