Meaningless Drivel is fun!*
The moose likes Websphere and the fly likes Websphere Commerce : from Java filter to Struts action mapping Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Websphere
Bookmark "Websphere Commerce : from Java filter to Struts action mapping" Watch "Websphere Commerce : from Java filter to Struts action mapping" New topic
Author

Websphere Commerce : from Java filter to Struts action mapping

Nils Quairiat
Greenhorn

Joined: Sep 22, 2011
Posts: 6

Hello,

I'm working on a project using Websphere Commerce v7.0 and I'm currently blocked on the following issue.

We use a CMS to store url's in a database. Some data is stored in regards to each of those url's. When the user enters an URL in the browser, we want to check if that url is stored in our database, and if it is the case, add some data to the request, and then forward to a particular view which is mapped in struts-config-ext.xml. If nothing is found in database, just do nothing (let websphere commerce handle the request as usual, instead of using a specific Struts mapping)

Unfortunately, I cannot reach the specific struts entry programmatically (due to a Java error). Here is what I did. I can add more code if necessary.

- I added a java filter in web.xml (the very first filter, mapped on "/*" )
- I implemented the filter, which uses access beans to make checks on the database, and adds attributes to the request if something is found. No problem until now
- I tried a few ways to dispatch the request to the right Struts entry, notably :



But this leads to a NullPointerException.

If we try to access the specific Struts entry by typing it in the URL, then it works (but that's not the goal)

Here is the full stacktrace :



Can anyone help ?

Thanks alot,

Nils
Nils Quairiat
Greenhorn

Joined: Sep 22, 2011
Posts: 6

Problem solved ! The solution was to put the custom filter AFTER all the WebsphereCommerce-related filters in web.xml
 
 
subject: Websphere Commerce : from Java filter to Struts action mapping