This code lets you see what is in your session & request - usually nearly what you expect but spelled wrong! replace dbmd with what-ever you write log messages with (System.out.println probably). You can solve a lot of bugs with them. Ask again if that doesn't crack it!
========================================= //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static void printSessionAttributeNames(String caller, HttpSession session) { Enumeration ee3 = session.getAttributeNames(); dbmd("printSessionAttributeNames: for caller: "+ caller +" - start..."); while (ee3.hasMoreElements()) { String name = (String)ee3.nextElement(); Object object = session.getAttribute(name); String className = object == null ? "null" : object.getClass().getName(); dbmd(name +" of class:"+ className); } dbmd("printSessionAttributeNames: for caller: "+ caller +" - end"); } //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static void printRequestAttributeNames(String caller, HttpServletRequest request) { Enumeration ee2 = request.getAttributeNames(); dbmd("printRequestAttributeNames: for caller: "+ caller +" - start..."); while (ee2.hasMoreElements()) { String name = (String)ee2.nextElement(); Object object = request.getAttribute(name); String className = object == "null" ? null : object.getClass().getName(); dbmd(name +" of class:"+ className); } dbmd("printRequestAttributeNames: for caller: "+ caller +" - end"); } //- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - public static void printRequestParameters(String caller, HttpServletRequest request) { Enumeration ee5 = request.getParameterNames(); dbmd("printRequestParameters: for caller: "+ caller +" - start..."); while (ee5.hasMoreElements()) { String name = (String)ee5.nextElement(); String[] values = request.getParameterValues(name); String print = "name: "+ name +" value(s): "; for (int ii5 = 0; ii5 < values.length; ii5++) { print += values[ii5]; if (ii5 < values.length - 1) { print += ", "; } } dbmd(print); } dbmd("printRequestParameters: for caller: "+ caller +" - end"); } ====================================================== --- Slimane Zouggari <[EMAIL PROTECTED]> wrote: > Hi, > > sorry that I didn't mention it :) > The error is that my form (which normally should have a scope session) is > null ! > > so, when I run the app, it throws a java.lang.NullException, because I try > to use sdf which is null > (that's why I made a test to see if sdf == null, in that case my mapping > returns an error page) > > To summarize, the problem isn't that I have wrong values, but that my form > seems to not have a scope session (although it does have the mention > session in the struts-config.xml) > > Thanx for your answer and sorry that I wasn't clear enough. > > Friendly Regards, > Slimane > > At 01:42 13/03/2002 -0800, you wrote: > > > it doesn't work anymore > >what's the exact problem, > >exception or form there but values not set as expected or what? > >If you create a constructor for your form & print your form variable (ie' > >'this' in it (& in the reset method too) you'll be able to make sure you > only > >have 1 version of the form & that you are 'talking' to the one you think you > >are. > > > >--- Slimane Zouggari <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > > I have defined in my struts-config.xml an ActionForm with a scope > session. > > > Here's the struts-config code: > > > > > > > <action path="/searchbydate" > > > > type="be.stluc.info.struts.SearchByDateAction" > > > > name="searchbydateform" > > > > scope="session"> > > > > > > > > <forward name="successProject" path="/projectdetails.do" /> > > > > <forward name="successParticipant" path="/participantdetails.do" /> > > > > <forward name="successAllProject" path="/allprojectdetails.do" /> > > > > <forward name="successAllParticipant" > > path="/allparticipantdetails.do" > > > /> > > > > <forward name="baddates" path="/baddates.html" /> > > > > <forward name="error" path="/error.html" /> > > > > > > > > </action> > > > > > > The first time I use it in my java code, it works allright, but when I > > want > > > to use it in a second Action class, it doesn't work anymore :( > > > > > > Here's my java code: > > > > HttpSession session = request.getSession(); > > > > SearchByDateForm sdf = > > > > (SearchByDateForm) session.getAttribute("searchbydateform"); > > > > > > > > if (sdf == null) { > > > > return mapping.findForward("noForm"); > > > > } > > > > > > I'm sure it's just a simple error, but I can't find it :( > > > > > > Any pointer would be greatly appreciated. > > > > > > Friendly Regards, > > > Slimane > > > > > > > > > -- > > > To unsubscribe, > > e-mail: <mailto:[EMAIL PROTECTED]> > > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > > > > > > > > >===== > >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >Search the archive:- > >http://www.mail-archive.com/struts-user%40jakarta.apache.org/ > >~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > >Keith Bacon - Looking for struts work - South-East UK. > >phone UK 07960 011275 > > > >__________________________________________________ > >Do You Yahoo!? > >Try FREE Yahoo! Mail - the world's greatest free email! > >http://mail.yahoo.com/ > > > >-- > >To unsubscribe, e-mail: > <mailto:[EMAIL PROTECTED]> > >For additional commands, e-mail: > <mailto:[EMAIL PROTECTED]> > > > -- > To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> > For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> > ===== ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Search the archive:- http://www.mail-archive.com/struts-user%40jakarta.apache.org/ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Keith Bacon - Looking for struts work - South-East UK. phone UK 07960 011275 __________________________________________________ Do You Yahoo!? Try FREE Yahoo! Mail - the world's greatest free email! http://mail.yahoo.com/ -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>