Win a copy of Terraform in Action this week in the Cloud forum!

Cesar Loachamin

Ranch Hand
+ Follow
since Dec 25, 2010
Cesar likes ...
Eclipse IDE Chrome Java
Oracle Certified Professional, Java SE 6 Programmer.
Oracle Certified Professional, Java SE 7 Programmer
Oracle Certified Expert, Java EE6 Java Persistence API Developer
Ecuador
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
10
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 Cesar Loachamin

Hi Praveen, Your problem is very interesting, I was thinking in it for a while, You could solve your problem in this way, First you must have a security constraint in my application no matter the authentication method could be basic or with a form page, when the user logged in you create a session [request.getSession()]. Second you put a session listener (a class that implement the HttpSessionListener and it must be configured in the xml or with the @WebListener) with this listener you can be notified when a new session is created (when the user logged in) or when a session is destroyed (could be when the user logged out and you call the invalidate method from the session). With that you have a list of players and you can join two players in one game, The problem is when one player must wait for the other player, how the single player will be notified, you could use a push mechanism or a javascript function that submit every minute (you must choose this value) to check if there is a partner to play the match or simply put a button for the player to check if there is available a player.

I hope this help you.
Kind regards
Cesar
8 years ago
Hi, as Bear Bibeault said your topic is generic and you must post a more specific question, but I give you a generic answer and example, The ServletConfig is a interface that have methods to get information releted only to the servlet, as its name, and init parameters. The ServletContext is a more generic interface is as an ApplicationContext, it's generic for the whole application, with this interface you can get the global init parameters set an get attributes that are visible for the all application, and more. I give you an example.


I hope this help you
Kind regards
Cesar
8 years ago
Hi Fabian. If the property comment contains a plain html hyperlink with the <a> tag withing the property you must use a ouputText tag but with the property escape="false" to render the <a> tag.

Otherwise in your managed bean you can use regular expressions to find the http links and format it withing a <a> tag.
A better solution could be to parse the comment string, find the http links add it to a list and use a <ui:repeat> to show the command links.
I hope this will help you
Kind regards
Cesar
8 years ago
JSF
Hi Praveen. I understand your issue with the javascript, in my opinion you should use javascript to disabled the button, as you said in the servlet you have the count of the rolled dice if someone malicious disabled javascript and submit again in your servlet you must have a routine that validate the if request its valid or if the rolled dice is greater than one, but the way you can use the solution of Paul with the if tag from jstl or just use EL, I give you and example.



I hope this help you with your problem

Kind regards.
Cesar
8 years ago
Hi Sam, I'm not sure if it's your case but when you are trying to access a resource within the WEB-INF folder you'll get a 404 error, I suggest you to move out your folder views one level up from the WEB-INF folder, I hope this help you.

Kind regards.
César


8 years ago
Hi Alex.

It depends by the way you persistence provider log the information and the level of the log, generaly you need to add some properties to the persistence unit in the persistence.xml to log the sql generated with the parameters, for example for openjpa you need to add these properties: and for eclipselinkI hope this help you with your question.
Kind regards.
Cesar
Ok I understand, About the relationship I use the @JoinColumn in the entity owner the relationship AttachmentInfo because this entity has the foreign key column, and in the Attachment I use the mappedBy property of the OneToOne annotation to indicate the inverse relationship.
Kind Regards
Hi Rob

Remove the globalOnly=true, that is wrong, when you set this attribute to true you only show messages not associated with a commponent, the global messages are added using the FacesContext.addMessage.
Kind regards
César.
10 years ago
JSF
Hi Jeanne

In general should the fetch join be required if I have fetch set on the field?

The answer is no, if the relationship is a single value the default fetch type is eager.
I have two observations, first is about the query the postId attribute doesn't exist in the entity Attachment, and the other is about the way you mapping the relationship:

Kind regards
Cesar
Hi Jeanne

Try executing the query within a transaction, or you must use a fetch join with the AttachmentInfo relationship.
Kind regards
Cesar
Hi Shuan

If you realy need to get the data of the join table you can use a native query, it's no neccesary to map the result to an entity or pojo, the result of the query will be a list of array oject, and you can iterate over it to get the result.

Kind regards

César
Hi Arindam

You are in the right direction, now in the event of button for example or in the place that you need (function), you build the components and add them to the panelGrid, I give you an example:


I hope this help youwith you problem.
Regards
Cesar
10 years ago
JSF
Hi Mary

Since JSF 2.0 you have a core tag f:validateRegex that accept and validate from a regex expression, you have to set the pattern attribute to use it.
I hope this help you with your problem
Regards
Cesar
10 years ago
JSF
Hello Ast

I'm glad becuase you can solve the principal problem, sorry I forgot to told you about the Named annotation, when you want to use a Context and Dependency Injection with JSF 2.0, you need a configuration file beans.xml to indicate to the container that you want to use CDI. Here is the content of the beans.xml (you can leave this file in blank)
and you need put this file at the same level as web.xml withing the war

I hope with this you can use CDI in you project
Kind Regards
Cesar
10 years ago
JSF