[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2469) add postback flag to page actions
by Dan Allen (JIRA)
add postback flag to page actions
---------------------------------
Key: JBSEAM-2469
URL: http://jira.jboss.com/jira/browse/JBSEAM-2469
Project: JBoss Seam
Issue Type: Feature Request
Components: Core
Affects Versions: 2.0.1.CR1
Reporter: Dan Allen
Assigned To: Dan Allen
Fix For: 2.0.x
Page actions are incredibly useful, but sometimes they can get in the way during a postback. I would like to see a postback attribute added to the <action> tag that can be used to disable the action on postback. It's possible using a conditional, but it is ugly and a lot of typing.
Here is the logic that would go into Pages.java
private boolean isPostBack(FacesContext facesContext)
{
return facesContext.getExternalContext().getRequestParameterMap().
containsKey(ResponseStateManager.VIEW_STATE_PARAM);
}
The conditional alternative would be:
<action execute="#{component.action}" if="#{empty param['javax.faces.ViewState']}"/>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 3 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2348) seam generate-ui fails for @OneToOne @PrimaryKeyJoinColumn annotated fields
by Thorsten Kunz (JIRA)
seam generate-ui fails for @OneToOne @PrimaryKeyJoinColumn annotated fields
---------------------------------------------------------------------------
Key: JBSEAM-2348
URL: http://jira.jboss.com/jira/browse/JBSEAM-2348
Project: JBoss Seam
Issue Type: Bug
Components: Tools
Affects Versions: 2.0.0.GA
Environment: Seam 2.0.0.GA
JBoss Tools
Reporter: Thorsten Kunz
Since I do use JBoss Tool I assume that this is cause by an error in the underlying seam generate-ui. It fails if you have entities annotated like this:
public class User implements Serializable {
@Id
@GeneratedValue
private Long id;
@OneToOne
@PrimaryKeyJoinColumn
private UserData userData;
}
public class UserData implements Serializable {
@Id
private Long id;
@OneToOne
@PrimaryKeyJoinColumn
private User user;
}
This will result in this Exception:
org.eclipse.core.runtime.CoreException: org.hibernate.tool.hbm2x.ExporterException: Error while processing template view/list.xhtml.ftl
org.eclipse.core.runtime.CoreException[666]: org.hibernate.tool.hbm2x.ExporterException: Error while processing template view/list.xhtml.ftl
Caused by: freemarker.core.InvalidReferenceException: Expression property.value.typeName is undefined on line 39, column 6 in view/list.xhtml.ftl
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 3 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2499) Seam Messages strips any MessageFormat formatting parameters
by Calvin Yu (JIRA)
Seam Messages strips any MessageFormat formatting parameters
------------------------------------------------------------
Key: JBSEAM-2499
URL: http://jira.jboss.com/jira/browse/JBSEAM-2499
Project: JBoss Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0.GA
Reporter: Calvin Yu
I want to use f:outputFormat to format text so that I can specify the formatting style from resource bundles.
In messages.properties:
foo=Howdy {0}\! The time is {1, date, MMMM dd}
In my Facelets view:
<h:outputFormat value="#{messages['foo']}">
<f:param value="#{exampleAction.name}"/>
<f:param value="#{exampleAction.date}"/>
</h:outputFormat>
The result of '#{messages['foo']}' is actually: Howdy {0}\! The time is {1}
The reason this is happening is because the Interpolator is using MessageFormat to evaluate {1, date, MMMM dd} with empty parameters (line #141 in Interpolator.java), which results in just {1}.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-808) StatckOverflowError if factory specifies it's component
by John Ray (JIRA)
StatckOverflowError if factory specifies it's component
-------------------------------------------------------
Key: JBSEAM-808
URL: http://jira.jboss.com/jira/browse/JBSEAM-808
Project: JBoss Seam
Issue Type: Bug
Environment: Latest from CVS
Reporter: John Ray
I accidently specified the name of my component instead of a context variable and this resulted in a StatckOverflowError. For example
@Stateful
@Name("foo")
@Scope(ScopeType.EVENT)
public class FooAction implements Foo {
@Out("bar")
private String bar;
@Factory("foo")
public void initBar() {
...
}
}
I'd sugest changing the code in org.jboss.seam.Component at line 490 to include an if/throw. I highlighted the 2 new lines with an asterisk
if ( method.isAnnotationPresent(org.jboss.seam.annotations.Factory.class) )
{
Init init = (Init) applicationContext.get( Seam.getComponentName(Init.class) ); //can't use Init.instance() here 'cos of unit tests
String contextVariable = toName( method.getAnnotation(org.jboss.seam.annotations.Factory.class).value(), method );
* if (contextVariable.equals(name))
* throw new IllegalStateException("@Factory method can not be for it's own component: " + name);
init.addFactoryMethod(contextVariable, method, this);
}
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-1770) Infinite loop when in some pages.xml configuration
by Richard Leherpeur (JIRA)
Infinite loop when in some pages.xml configuration
--------------------------------------------------
Key: JBSEAM-1770
URL: http://jira.jboss.com/jira/browse/JBSEAM-1770
Project: JBoss Seam
Issue Type: Bug
Affects Versions: 2.0.0.BETA1
Environment: windows XP, RHEL 5.0
Reporter: Richard Leherpeur
You can download this example on the Seam web site: navigation.zip
I have the following classes:
Code:
@Name("user")
@Scope(ScopeType.CONVERSATION)
public class User implements Serializable {
private String pet;
public String getPet() {
return pet;
}
public void setPet(String pet) {
this.pet = pet;
}
}
Code:
@Name("navigation")
@Scope(ScopeType.CONVERSATION)
public class Navigation implements Serializable {
@In(required=true)
User user;
@Logger
private Log log;
public String animalOutcome(){
if (user == null){
return "Dog"; // Just to make sure we don't return null
}
log.info("********* Outcome: " + user.getPet());
return user.getPet();
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
}
Code:
@Name("animals")
public class AnimalList
{
private List<String> animals;
@Unwrap
public List<String> unwrap()
{
if (animals == null)
{
animals = new ArrayList<String>();
animals.add("Dog");
animals.add("Cat");
animals.add("Goldfish");
animals.add("Rabbit");
animals.add("Snake");
animals.add("Parrot");
}
return animals;
}
}
Pages.xhtml is defined as followed:
Code:
<pages xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
<page view-id="/pageOne.xhtml">
<begin-conversation join="true" pageflow="navigation" />
</page>
<page view-id="/animalPage.xhtml" action="#{navigation.animalOutcome}">
<navigation>
<rule if-outcome="Dog">
<redirect view-id="/animal/dog.xhtml"/>
</rule>
<rule if-outcome="Cat">
<redirect view-id="/animal/cat.xhtml"/>
</rule>
<rule if-outcome="Goldfish">
<redirect view-id="/animal/goldfish.xhtml"/>
</rule>
<rule if-outcome="Rabbit">
<redirect view-id="/animal/rabbit.xhtml"/>
</rule>
<rule if-outcome="Snake">
<redirect view-id="/animal/snake.xhtml"/>
</rule>
<rule if-outcome="Parrot">
<redirect view-id="/animal/parrot.xhtml"/>
</rule>
</navigation>
</page>
</pages>
The pageflow is defined as:
Code:
<pageflow-definition
xmlns="http://jboss.com/products/seam/pageflow"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-2.0.xsd"
name="navigation">
<start-page name="displayChoice" view-id="/pageOne.xhtml">
<redirect/>
<transition name="next" to="animalPage" />
</start-page>
<page name="animalPage" view-id="/animalPage.xhtml">
<end-conversation/>
<redirect/>
</page>
</pageflow-definition>
And finally the pageOne.xhtml:
Code:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:c="http://java.sun.com/jstl/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Test Navigation</title>
</head>
<body>
<div id="container">
<h3>Choose an animal</h3>
<h:form>
<h:selectOneMenu value="#{user.pet}">
<s:selectItems value="#{animals}" var="animal" label="#{animal}" noSelectionLabel="Select your pet"/>
</h:selectOneMenu>
<h:commandButton value="Go To Pet Page" action="next" />
</h:form>
</div>
</body>
</html>
When I select an animal, I get the following stacktrace:
Code:
INFO: Added Library from: jar:file:/C:/Jboss/jboss-4.2.0.GA/server/default/tmp/d
eploy/tmp50163navigation.ear-contents/navigation-exp.war/WEB-INF/lib/jsf-facelet
s.jar!/META-INF/jstl-core.taglib.xml
13:23:07,046 INFO [Navigation] ********* Outcome: Cat
13:23:07,218 INFO [Navigation] ********* Outcome: Cat
13:23:07,281 INFO [Navigation] ********* Outcome: Cat
13:23:07,359 INFO [Navigation] ********* Outcome: Cat
13:23:07,437 INFO [Navigation] ********* Outcome: Cat
13:23:07,515 INFO [Navigation] ********* Outcome: Cat
13:23:07,609 INFO [Navigation] ********* Outcome: Cat
13:23:07,687 INFO [Navigation] ********* Outcome: Cat
13:23:07,781 INFO [Navigation] ********* Outcome: Cat
13:23:07,859 INFO [Navigation] ********* Outcome: Cat
1:
Code:
<page view-id="/animalPage.xhtml">
<navigation evaluate="#{navigation.outcome}">
...
where #{navigation.outcome} returns outcome
-> redirection to /animalPage.xhtml (which doesn't exist) because evaluate EL expression is never called
2:
Code:
<page view-id="/animalPage.xhtml" action="#{navigation.animalOutcome}">
<navigation evaluate="#{navigation.outcome}">
...
where #{navigation.animalOutcome} returns void and #{navigation.outcome} returns outcome
-> We enter a loop where action expression is called then evaluate expression is called, etc....
3:
Code:
<page view-id="/animalPage.xhtml" action="#{navigation.animalOutcome}">
<navigation from-action="#{navigation.animalOutcome}">
...
where #{navigation.animalOutcome} returns outcome
-> We enter a loop where action expression is called indefinitely
4:
Code:
<page view-id="/animalPage.xhtml" action="#{navigation.animalOutcome}">
<navigation>
...
where #{navigation.animalOutcome} returns outcome
-> We enter a loop where action expression is called indefinitely
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2551) NPE in Support Services NPE in Param.validateConvertedValue
by Joshua Davis (JIRA)
NPE in Support Services NPE in Param.validateConvertedValue
-----------------------------------------------------------
Key: JBSEAM-2551
URL: http://jira.jboss.com/jira/browse/JBSEAM-2551
Project: JBoss Seam
Issue Type: Bug
Components: Core
Affects Versions: 2.0.0.GA
Environment: jdk1.5.0_12, JBoss 4.2.2.GA, Linux
Reporter: Joshua Davis
I've been getting null pointer exceptions with Seam 2.0.0.GA with a .page.xml file / application that used to work fine in 1.2.1.GA. The error happens when processing the restful parameters:
{code}
2008-01-23 14:44:57,532 [http-0.0.0.0-8080-1] ERROR SeamPhaseListener - uncaught exception
java.lang.NullPointerException
at org.jboss.seam.navigation.Param.validateConvertedValue(Param.java:246)
at org.jboss.seam.navigation.Pages.convertAndValidateStringValuesInPageContext(Pages.java:743)
at org.jboss.seam.navigation.Pages.postRestore(Pages.java:393)
{code}
This is the code in Param.java that fails:
{code}
if (valueExpression!=null)
{
//TODO: note that this code is duplicated from ModelValidator!!
ELContext elContext = facesContext.getELContext();
InvalidValue[] invalidValues;
try
{
invalidValues = Validators.instance().validate( valueExpression.toUnifiedValueExpression
(), elContext, value );
}
catch (ELException ele)
{
Throwable cause = ele.getCause();
if (cause==null) cause = ele;
throw new ValidatorException( createMessage(cause), cause );
}
if ( invalidValues.length>0 ) // <== Boom! NPE
{
throw new ValidatorException( createMessage(invalidValues) );
}
}
{code}
I took a look at the code and saw that there is an array of 'invalid values' which is expected to be of zero length if there are no errors but in this case it's null. The strange thing is that there are other places in the application where restful parameters work just fine. The only thing I can think of is that in this case, the restful parameter is being used inside a facelets template (the parameter turns the top nav bar off).
I fixed the bug by adding:
{code}
invalidValues = new InvalidValue[0];
{code}
To the constructor of ValidatingResolver inside Validators.java.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months
[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-2539) SeamTest - NonFacesRequest "eats" exceptions
by Darryl Smith (JIRA)
SeamTest - NonFacesRequest "eats" exceptions
--------------------------------------------
Key: JBSEAM-2539
URL: http://jira.jboss.com/jira/browse/JBSEAM-2539
Project: JBoss Seam
Issue Type: Bug
Components: Test Harness
Affects Versions: 2.0.1.CR2
Reporter: Darryl Smith
@Name("failComp")
public class FailComp {
public void failMethod(){
throw new NullPointerException();
}
}
Test
----
public class FailCompTests extends SeamTest {
@Test
public void facesRequest() throws Exception{
new FacesRequest("/failComp.xhtml"){
@Override
protected void invokeApplication() throws Exception {
invokeMethod( "#{failComp.failMethod}");
}
}.run();
}
@Test
public void nonFacesRequest() throws Exception{
new NonFacesRequest("/failComp.xhtml"){
}.run();
}
}
failComp.page.xhtml
-------------------
<?xml version="1.0" encoding="UTF-8"?>
<page xmlns="http://jboss.com/products/seam/pages"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
<action execute="#{failComp.failMethod}"/>
</page>
With this setup facesRequest() will fail correctly, but nonFacesRequest() will pass
[01/26 15:44:23] ERROR [seam.jsf.SeamPhaseListener] - <uncaught exception>
javax.el.ELException: java.lang.NullPointerException
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:333)
at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:173)
at org.jboss.seam.navigation.Page.preRender(Page.java:264)
at org.jboss.seam.navigation.Pages.preRender(Pages.java:309)
at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:549)
at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:460)
at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:144)
at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:114)
at org.jboss.seam.mock.BaseSeamTest$Request.renderResponsePhase(BaseSeamTest.java:629)
at org.jboss.seam.mock.BaseSeamTest$Request.emulateJsfLifecycle(BaseSeamTest.java:622)
at org.jboss.seam.mock.BaseSeamTest$Request.access$300(BaseSeamTest.java:184)
at org.jboss.seam.mock.BaseSeamTest$Request$2.doFilter(BaseSeamTest.java:530)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
at org.jboss.seam.mock.BaseSeamTest$Request.run(BaseSeamTest.java:524)
at test.FailCompTests.nonFacesRequest(FailCompTests.java:22)
There is no way to detect the exception throw from nonFacesRequest as SeamPhaseListener's error handler infastructure "eats" the exception due to a rule that most people will have in their pages.xml
<exception>
<redirect view-id="/pages/error.xhtml">
<message>Unexpected error, please try again</message>
</redirect>
</exception>
If you where to remove this rule SeamPhaseListener would really eat the exception.
A work around is to roll your own Exceptions component e.g.
@Scope( ScopeType.APPLICATION )
@BypassInterceptors
@Install( precedence = Install.MOCK, classDependencies = "javax.faces.context.FacesContext" )
@Name( "org.jboss.seam.exception.exceptions" )
public class Exceptions extends org.jboss.seam.exception.Exceptions {
@Override
public void handle( Exception e ) throws Exception {
throw new AssertionError(e);
}
}
but this is something I should not have to do. see http://jira.jboss.org/jira/browse/JBSEAM-2138
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 4 months