j2ee

Finding your application's URL with only a ServletContext

I'm writing a Java web app using Spring MVC. I have a background process that goes through the database and finds notifications that must be e-mailed to my users. These e-mail messages need to include hyperlinks to the application. This seems like a fairly common pattern for a web app, but I'm having trouble. How do I derive my applicat...

can i write a java logic in a javascript code?

Hi i am newbie to j2ee application. Can you please advice whether i can write a java logic inside javascript and if yes how. I dont have liberty to make new class and redirect it there on click of button ...

Java and J2EE code examples for 3-tier apps

Do you know a site that offers a tutorial with sample source code for a 3-tier application (the usual data access layer, business layer and UI layer)? The simple, readable and intuitive the source code. Best practices that are applied to the code are welcome as well. ...

OSGi and J2EE - JOSGiEE?

After reading this article, one question came to my mind: 'Is OSGi becoming a J2EE? Is OSGi going to replace J2EE? Is OSGi incrementing J2EE?' It's true that historically OSGi is totally different from J2EE, but considering now the resulting work from the EEG, some of these services are J2EE services. Another fact is that who uses J2EE...

Tutorial on JPA mapping file

Is there a great tutorial on how to use JPA mapping file? Accompanying related source code for the mapping file would be great also. ...

Fowler's "Patterns of Enterprise Application Architecture" still relevant?

Hi, I'm thinking of buying Martin Fowler's "Patterns of Enterprise Application Architecture". From what I can see it seems like a great book, it an architectural book with bias towards enterprise Java -- just what I need. However, in computer years, it is quite old. 2003 was a long time ago, and things have moved on quite a bit since t...

How to install Tomcat on Windows XP?

I'm having trouble installing Tomcat on my windows XP machine. I already have Apache and JDK 6 installed, what I need to know is: Which file to download from the Lastest Tomcat download page And how to install it so I can run the sample web app by going to http://localhost/ In my C:\Program Files\Java folder, I see the following fold...

Inversion of Control, Spring Framework - system of global instances

Is inversion of control essentially just retrieving a set of already instantiated objects? In theory. I guess more granular details as implemented by IoC frameworks like Spring have a lot more functionality, but in theory it seems like IoC containers operate like a collection of instantiated beans (in the Java world) and then you get a...

applet fails to load class from jar

Some users are complaining that the applet no longer works, When they view the java console they are greeted with a java.lang.noClassDefFoundError and checking my access log's I see they have downloaded the jar file that contains the class, and then issue a get request for the particular class. Different users break on different classes...

How do we get back a specific session using sessionId?

I work on a task that involves moving/traversing from one application to another. The applications are in separate JVMs. While traversing to the other application, I keep track of the session ID. However, as I traverse back and forth, a new session gets created. Is there any way for me to get back the same session, using the sessionId...

Combining namespace based configuration with different authentication methods in spring-security

I'm trying to get spring-security to work with a project where there is both a form login component needed (for website access) and a http-basic or http-digest component for web services. Now we started out with the namespace based configuration, e.g. a spring-security.xml file with stuff like: <http auto-config="true"> <intercept-u...

Caching solutions and Querying

Are there any in-memory/caching solutions for java that allow for a form of Querying for specific attributes of objects in the Cache? I realize this is something that a full blown database would be used for, but I want to be able to have the speed/performance of a cache with the Querying ability of a database. ...

How to implement REST in a web-aplication?

Hi, i want to know how i could be implement REST in my web aplication. I want to create a web aplication based in this service, but i don't know how to do it. Now, i'm using J2EE and Tomcat. What things should be considered for these technologies? EDIT: Sorry, i mean RESTful service. ...

Manipulating Hibernate 2nd Level Cache

I am using hibernate as my ORM solution, with EHCache as the Second Level (Read-Write) cache. My question is: Is it possible to access the Second Level cache directly? I want to access this: http://www.hibernate.org/hib_docs/v3/api/org/hibernate/cache/ReadWriteCache.html How can I access the same ReadWriteCache that is being used b...

Eclipse + Turn an Existing Project into a JPA Project

Is there a way to turn a normal Eclipse Project into a JPA Project? I have a normal project with Entities in it and a Persistence.xml file, but it is not an eclipse recognized JPA project. What can I do? ...

How do I fix a StackOverflowError on Struts DispatchAction?

Here's the situation: I practiced creating a mini blog application. I used Strut's EventDispatchAction to handle all post related methods like updating and listing posts. I have an update() method (http://mywebsite/post?update) that updates the database and then if it's successful it forwards to the same action class but I used a differ...

Message Driven Bean Selectors (JMS)

I have recently discovered message selectors @ActivationConfigProperty( propertyName="messageSelector", propertyValue="Fragile IS TRUE") My Question is: How can I make the selector dynamic at runtime? Lets say a consumer decided they wanted only messages with the property "Fragile IS FALSE" Could the consumer change the s...

Can I from a client detect which EJBs the current user is authorized to use?

I have various EJBs on a J2EE-server, with different security roles. Now, from a Java Swing client application, when I log the user on to the server, I would like to discover which of these EJBs that are accessible to the user, without actually trying to create them or invoke them. The reason I want to do this is to adjust the user int...

Simple Spring, use of ClasspathApplicationContext for standalone apps, how to reuse?

If I have a standalone main application. Say 20 classes. They all may need to interface with the beans defined by the spring configuration (ApplicationContext) at any time. I would boostrap the classpath application context at the main application entry point. But how do you reuse the already instantiated beans? For example, it seem...

How to redirect NullPointerExceptions in Struts?

Hi, is there a way to redirect all NullPointerExceptions to a pretty jsp page perhaps in Struts? Thanks in advance! ...