Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!

Jaaouane Aymen

Greenhorn
+ Follow
since Sep 22, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jaaouane Aymen

Hello All,

I want to add a file appender for log4j.
i add theses lines to my log4j.properties as mentioned in log4j documentation:

log4j.rootLogger=INFO, stdout, fedexday, FILE
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.FILE=org.apache.log4j.RollingFileAppender
log4j.appender.FILE.File=a.log


but alwayes i have an emty file a.log ???
Hello all,

I have a properties file wich will contain the adresses of the servers that i will send requests to . The properties file will have the good values only when packaging because maven will fill them thanks to its profiles.
So my file looks like this:
travelfusion.ip=${travelfusion.ip}
amadeus.ip=${amadeus.ip}.

So far all is good, but the problem is that i am writing a unit test which must read the ip from the properties file. the test fails because it can not connect to the server because the ${travelfusion.ip} will be returned and not a good value. i am launching the unit test from Eclipse so maven is not in the process and the variables are not replaced by good values.

Must i launch unit tests only by maven? or there is a way to keep the variables in the properties file and writing unit tests which can read good values from the properties file?

Thank you in advance,
8 years ago
hello,
i have an entity event with a collection of comments, the fetch strategy is lazy because i want to load the comments only when needed.
To avoid the LazyInitialisationException, i write this:
try{
comments=event.getComments();
}
catch(Exception e){
comment.setParameters(eventAction.getEventComments(selectedEvent.getId()));
//eventAction.getEventComments(selectedEvent.getId()) queries the database to get the collection
}
but i think the code is not very nice, do you have a better solution?
Hi Ralph,
thank you for your help,

this update method of EJB is called from a seam component

public void save() {
accountAction.update(selectedUser);
StatusMessages.instance().addFromResourceBundle(Severity.INFO, "fr.aptus.siaptus.delete.error.objectModified", "Utilisateur");
}

The problem is that when an exception occurs, the message of success is also displayed because the transaction is committed after the end of the save method and not in the middle of the save method, (the transaction is not committed after the update method which is an EJB method).
so, why the transaction is committed after the end of the save method and not after the end of the update method.As i read, the life cycle of a transaction is the EJB method. Is the life cycle of transaction has changed because i am using seam?
can you explain for me when a transaction is started and when a transaction is committed when we are using seam with EJB.
but when i put em.flush in the EJB, the transaction is committed after the call of update.
Hello,
I have an EJB which represents my DAO layer,
To update an entity, we do em.merge(user) if the scope of the persistence context is a an EJB method,
but when the persistence context is extended, i do not find the way to update the entity. It is not legal to
write a merge because the entity is not detached (PersistenceContextType.EXTENDED).
I do for that an em.flush() but it is not very correct because this operation will flush all the entity manager
and i want to do an update for only user object.


is there a correct statement to replace this em.flush?
hello, thak you for your help,
but i am not confused in inheritance,
User "is a" Collaborator, so i can not simply set it.
so, how i will set it in this situation?
I do not find the way to persist a user entity that belongs to an existing collaborator, I can add a user object and it results to 2 new created rows in the data base but what i want to do is to add only a user object and not a new collaborator.
I can find a collaborator by Collaborator clbr=em.findById(2);
and i want to add a user that its collaborator is clbr but how to associate the new user object to this collaborator object ?
Below my entities


Must I change my strategy to table per class?
hello, i have a user entity which inherits from collaborator entity, and i use @Inheritance(strategy = InheritanceType.JOINED) in the Collaborator entity.
I do not find the way to persist a user entity that belongs to an existing collaborator,
i can find a collaborator by em.findById(2);
but how to associate a new user object to this collaborator object ?
Hello, this is my source code

<rich:modalPanel id="confirmPopup" width="350" height="100">
<f:facet name="header">
<h:panelGroup>
<h: outputText value="Modal Panel">< /h:outputText>
</h:panelGroup>
</f:facet>
<f:facet name="controls">
< h:panelGroup>
< h:graphicImage value="/img/false.png" styleClass="hidelink"
id="hidelink" />
<rich:componentControl for="confirmPopup" attachTo="hidelink"
operation="hide" event="onclick" />
</h:panelGroup>
</f:facet>
<center><h:form>
<div class="actionButtons"><h:commandButton event="onclick"
action="#{accountManager.delete}"
rendered="#{event.parameters.action=='delete'}"
oncomplete="#{rich:component('confirmPopup')}.hide()"
value="#{messages['fr.aptus.siaptus.user.delete']}" /> <h:commandButton
value="#{messages['fr.aptus.siaptus.user.cancel']}"
onclick="#{rich:component('confirmPopup')}.hide();return false;">
</h:commandButton></div>
</h:form></center>
</rich:modalPanel>

I resolved the problem of submit but i don't for the problem of parameter, rendered="#{event.parameters.action=='delete'}" does not work
otherwise when i debugged the code by onshow="alert(event.parameters.action)" in the rich:modalpanel, the String delete is well dispalyed
10 years ago
JSF
Hello, i have this modal panel which is dislayed to confirm the save or the delete action:

<rich:modalPanel id="confirmPopup" width="350" height="100"
<div class="actionButtons">
<a4j:commandButton event="onclick" action="#{accountManager.save}" oncomplete="#{rich:component('confirmPopup')}.hide()" value="#{messages['fr.aptus.siaptus.user.save']}" />
<h:commandButton value="annuler" id="fermer" onclick="#{rich:component('confirmPopup')}.hide();return false;"></h:commandButton></div></center> </rich:modalPanel>

My first problem is that the action will not be triggered if i replace <a4j:commandButton by h:commandbutton, why?
I do not need an ajax action because i want to refresh the page so my source code is not logic.

The second problem is that i want to pass a parameter to the rich:modalPanel, I want this component rendered if a paramater is well passed to the rich:modalPanel.
<a4j:commandButton event="onclick" action="#{accountManager.save}" oncomplete="#{rich:component('confirmPopup')}.hide()" value="#{messages['fr.aptus.siaptus.user.save']}" />
10 years ago
JSF
Hello,
I have a rich:tree component which is built from an xml file, this tree will represent the
menu of my application, so not all nodes will be displayed, it will be according to the role.
i tested the rendered attribute of rich:treenode but it does not work.when the value of this attribute is false
the node is still displayed but with the default behaviour(i mean the icon and the text of the node are not
displayed but it dispalys the reference of the current treenode object).
how to make a treenode totally not displayed?
10 years ago
JSF
Hello, I have an xhtml page which displays a list, this list is built by a factory in a stateless session bean. when the pages is demanded for the first request, the factory method is called and the list is well displayed. after the page is rendered, when we do a sbmitt on this page, the first thing done by the seam life cycle is to call this factory again, and before calling the apply request values values.
I know very well that my factory variable is destroyed after the response is sent because my component scope is EVENT.
As i understand from the lifecycle of JSF, the life cycle must update the model values of the form and after invoke the application, so why the factory is called before to instansiate the backing bean of the model.
my factory variable is needed only to render the response, so why it is instansieted?
I debug my code, i put a message in the constructor of Project(my baking bean for rthe form), and a message in the factory method, when the request is get(first request), the backing bean is first instansieted and after the factory is called.
but after a submit, i see that the factory is called and after the backingbean is instansieted to update model.
why? is the resoreView that calls the factory?

To understand me better, this is my xhtml page :

<h:form>
<s:validateAll>
<h:inputText value="#{projet.nom}" size="15" required="true"/>
<br />
<h:inputText value="#{projet.description}" size="15" required="true"/>
</s:validateAll>
<h:messages/>
<br />
<h:commandButton type="submit" value="creer Projet"
action="#{projetManager.ajouterProjet}" />
</h:form>
<h:dataTable value="#{projets}" var="project">
<h:column>
< h : outputText value="#{project.nom}" />
</h:column>
<h:column>
< h : outputText value="#{project.description}" />
</h:column>
</h:dataTable>
after a submit, the factory is called first thing, because i think that my variable #{projets} is only needed to render the response.
Hello, i am a beginner and i am doing my fisrt seam application.
I am working with eclipse ganymede 3.4.2, jboss tools for ganymede
The version of JBOSS 5.1.0.
but when i change in the source code, i must restart JBOSS each time i modify my code
and it represents a nightmare for me. is there a solution that jboss reloads the context without restarting?
Is the JBOSS must restart eachtime? i was working withTomcat and i do not need to restart it after modifying my java classes
except when modifying web.xml.
10 years ago
thank you tim for your help, but i am not speaking about session attributes or using hidden fields
to maintain state. my issue is the lifecycle of the backing bean of jsf when its scope is request.
10 years ago
JSF
is that means that jsf will use the same instance of the backing bean for the whole life cycle of the jsf request?
is that means that the same instance of myBean will be used to validate and update the values of page1.jsp and then will be used to render page2.jsp?
10 years ago
JSF
Hello,
what is the real meaning of the request Scope in JSF?
Is the bean which is registered in the request scope remains alive until the render phase(last thing in the JSF Life cycle) or it is destroyed after the invoke application phase?
to understand me better, we assume that we have 2 pages: page1.jsp and page2.jsp. we assume also that after a post submitted in page1, page 2 will be dispalyed as a response. we assume that page1.jsp uses a backingbean called myBean and the page2.jsp uses
the same backingbean. my question is to process the jsf request which is the post to page2.jsp which comes rom page1.jsp, how the jsf engine will handle the request?
to display page2.jsp, is a new bean will be instancied to display page2.jsp or the same bean used in the lifecycle of page1.jsp will be used?
i hope my question is clear.
10 years ago
JSF