[JBoss Seam] - Re: My list of questions: Seam validation, transactions and
by petemuir
I think we still have some confusion here: JSF does
1) RESTORE VIEW
2) APPLY REQUEST VALUES (update the JSF component instances with the submitted values - localValue on EditableValueHolder) (no affect on your backing beans here)
3) PROCESS VALIDATIONS - run converters, then validators (this is the *only* point at which s:convertEntity is invoked)
4) UPDATE MODEL
5) INVOKE APPLICATION
- if an exception is thrown anywhere, then further stages are aborted.
Transactions (JTA) and JSF know nothing about each other - so whether the transaction rolls back or not has no effect on updating the model.
Anyway, I have never seen the effect you describe. Can you try doing this without all the ui:decorate stuff (just put the components on the page) and see if you still observer the same effect? If you do, please submit a runnable, simple example of this to JIRA and I'll take a look (without the templating stuff)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4052909#4052909
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4052909
18Â years, 10Â months
[JBoss Seam] - Re: My list of questions: Seam validation, transactions and
by beligum
Hi again.
I've done some debugging and found interesting results.
In my update-form, I have these input-controls (they're templated, but you get the point)
| <ui:decorate template="/templates/t_form_text_entry.xhtml">
| <ui:param name="id" value="newSpaceName" />
| <ui:param name="label" value="#{messages['name']}" />
| <ui:param name="value" value="#{selectedSpaceInstance.entityData.name}" />
| <ui:param name="width" value="300px" />
| <ui:param name="required" value="true" />
| <ui:param name="validatorBean" value="#{spaceManager}" />
| <ui:param name="validatorAction" value="validateSpaceName" />
| </ui:decorate>
|
| <ui:decorate template="/templates/t_form_entry.xhtml">
| <ui:param name="id" value="newSpaceCompany" />
| <ui:param name="label" value="#{messages['company']}" />
| <ui:param name="required" value="true" />
|
| <h:selectOneMenu id="newSpaceCompany" value="#{selectedSpaceInstance.entityData.company}" styleClass="input" style="width: 200px;"
| required="true" rendered="#{not empty companyManager.possibleSpaceCompanies}">
| <s:selectItems value="#{companyManager.possibleSpaceCompanies}" var="company" label="#{company.name}" />
| <s:convertEntity />
| </h:selectOneMenu>
| </ui:decorate>
|
They're both validated: the input box is required, and it's name is also checked for existence (#{spaceManager.validateSpaceName}). The combobox is only required.
When I submit my form like this (long-running conversation, TransactionSeamPhaseListener), the data-model is updated, even when the transaction rolls back. This must be caused by the validation of the combobox, because it acts as expected when I delete the combobox-input and let the inputbox-field untouched.
Could this be a bug, where <s:convertEntity/> (or <s:selectItems/> ?) updates the model, even when the transaction rolls back?
b.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4052908#4052908
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4052908
18Â years, 10Â months
[EJB 3.0] - Re: how to access more than one EJB containers in one JSP
by ALRubinger
Haven't checked this in an IDE or anything, but this should get you the idea. Keeping in mind that business functions like obtaining and calling upon EJB3 services shouldn't really be taking place in the view layer...
<%!
| private YourEjbInterface1 ejb1 = null;
| private YourEjbInterface2 ejb2 = null;
|
| public void jspInit () {
| try {
|
| // Define the Connection Properties
| Properties props1 = new Properties();
| props1.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
| props1.put(InitialContext.PROVIDER_URL, "jnp://yourHost1:yourPort1");
| props1.put(InitialContext.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
|
| Properties props2 = new Properties();
| props2.put(InitialContext.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
| props2.put(InitialContext.PROVIDER_URL, "jnp://yourHost2:yourPort2");
| props2.put(InitialContext.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
|
|
| // Define the Context for Servers
| Context ctx1 = new InitialContext(props1);
| Context ctx2 = new InitialContext(props2);
|
| // Look up the EJB3 Proxies in JNDI
| ejb1 = (YourEjbInterface1) ctx.lookup("ejb1/jndi/name");
| ejb2 = (YourEjbInterface2) ctx.lookup("ejb2/jndi/name");
|
| } catch (Exception e) {
| e.printStackTrace ();
| }
| }
| %>
|
| Invoke 1:
|
| <% ejb1.myMethod(); %>
|
| Invoke 2:
|
| <% ejb2.myMethod(); %>
|
|
S,
ALR
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4052904#4052904
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4052904
18Â years, 10Â months