Hi folks, I have two questions, and I apologize for the n00b approach.
I'm just teaching myself struts2, coming from a PHP background (but I've
done plenty of JEE and Java Swing programming, so the language isn't
completely alien :)
Question 1...
I have a Logon form that works fine without an interceptor, but as soon
as I add one, my getUsername() and other methods fail (the username is
null).
Struts.xml:
http://pastebin.stonekeep.com/1893
DBInterceptor:
http://pastebin.stonekeep.com/1894
Logon.java:
http://pastebin.stonekeep.com/1895
If I uncomment the interceptor line in my struts.xml file, the Logon
form validator fails. Line 29 shows 'null' in Logon.java. If i leave
it commented out, it works fine.
Question 2...
In Logon.java, I'm using the execute() method to set up my JDBC
connection (as pulled from my JBoss container datasource), setting up
the Connection, and making the call. Wouldn't it make more sense to do
that in an interceptor around every class, and do something like
ic = new InitialContext();
dataSource = (DataSource)ic.lookup("java:JQuoDEV");
c = dataSource.getConnection();
Logon action = (Logon)invocation.getAction();
action.connection = c;
return invocation.invoke() ;
I tried doing this, and saw the connection start up, but the Action
class kept having the connection as 'null'. I think I'm either
misunderstanding how the interceptor / action sequence works, or doing
something blatantly stupid.
Help?
-dbs
--
Dave Belfer-Shevet
Stonekeep Consulting, Inc
http://www.stonekeep.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]