Viktor Pergjoka

Greenhorn
+ Follow
since Aug 30, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
2
Received in last 30 days
0
Total given
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Viktor Pergjoka

Hi,


This returns the current session. If there is no current session, a new session will be created.



This will return the current session. If there is no current session, no new session will be created.
9 years ago
JSP
The syntax of the jsp use bean is as follows:

<jsp:useBean id="name" scope="page|request|session|application" typeSpec />

typeSpec ::=
class="className" |
class="className" type="typeName" |
type="typeName" class="className" |
beanName="beanName" type="typeName" |
type="typeName" beanName="beanName" |
type="typeName"


So you used a wrong syntax.
Im not sure if this works because I never tried it, but maybe: User user = (User)SecurityContextHolder.getContext().getAuthentication().getPrincipal();

So you could retrieve your information from the SecurityContextHolder since you are using Spring Security.
9 years ago
Im not sure what exactly you mean. Is there a servlet which performs the database operation? If yes, you could put a Filter and map it on the Servlet. And in the Filter you could log the things.
9 years ago
Why don't you go with interfaces and when you think they fit better as EJBs you can transform them to EJB(vers 3+) with no so much effort.
Hi,
you could save the value in a properties file or whatever else what is persistence.
Then if the form was created you write the value. On loading you read the value and asks if the form was created or not.

In Pseudocode:
boolean wasCreated = getValue() //gets the persisted properry
if (!wasCreated)
....//your form
... wascreated = true
....

On the next call the value is true so the if statement is true and the form will not be created.
11 years ago
It looks like that the value could not be injected.
Is the name of your CatalogService identical with the name in the injection?

I mean does you class look like this :

@EJB(name = "ejb/CatalogService")
public class CatalogService {
.......
You can also think if you really need The Factory Design Pattern, because you could use frameworks which support dependency injection like Google Guice, Spring ......
11 years ago
Integer is an Object, And as this it has the default value null. So you compare null with 0 and this will give you the NullpointerException,
If you replace it with the primitive type int, it will have the default value of 0. And so the comparison is correct.
11 years ago
Maybe you could make something like this:


11 years ago
java.text.NumberFormat extends java.text.Format and it inherits the format(Object obj) method. You pass a String in and since String is an Object, like all others, the method accept it and cast the String.
The method than returns a String and this String is used in the format method.
Hi!

It's because s = "123.456xyz" is not a number.
If you pass a number, this will work.
Hi!

Your first code snippet dont work because you can think of this: Child is a specailisation of Parent. Maybe the Child class has methods that the Parent class does not have, so if you cast Parent to Child this is a "polymorphistic problem".
Hi,
i am not sure what you mean with url validation? Do you mean to test an url if it is a rss feed?

There is a rss feed java library called Rome, maybe this will help you.
The project is located at http://java.net/projects/rome/

With this library you can read or write rss feeds. I dont know if you can test for any validation, but you could try it.
12 years ago
Or you can register for an PrintJobAttributeListener
12 years ago