Hello,

i've got the same problem  a few weeks ago.
I needed to execute some code before the Login.vm was displayed.

The code does not execute if  your java class extends a secure screen.
If you extend the class VelocityScreen, then everything works.



public class Login extends VelocityScreen
{
    /**
     * Place all the data object in the context
     * for use in the template.
     */

    public void doBuildTemplate( RunData data, Context context )
    {
        ParameterParser _formParams;
        HttpSession _session;
        Enumeration _dataelts;
        String _tempParm;
        List _paramsList;
        Map _map;
        int counter = 0;

        _session = data.getSession();
        _formParams = data.getParameters();

        //System.out.println("TEMPSCREEN" + data.getScreen());
        //while(_dataelts.hasMoreElements())
        //{
          //_tempParm = _dataelts.nextElement().toString();

          //System.out.println("LOGIN NAME  " + _tempParm + "=" + 
_formParams.getString(_tempParm));
        //}
        _dataelts = _formParams.keys();

        _paramsList = new ArrayList();

        while(_dataelts.hasMoreElements())
        {
          _tempParm = _dataelts.nextElement().toString();
          if(!_tempParm.equals("template"))
          {
            counter++;
            _map = new HashMap();
            _map.put("name", _tempParm);
            _map.put("value", _formParams.getString(_tempParm));
            _paramsList.add(_map);
          }
        }

        context.put("ParamsList", _paramsList);
        context.put("ParamsNumber", String.valueOf(counter));
        context.put("TempScreen" ,data.getScreen()+".vm");
    }
}


bye

Fabio Daprile

Mark Nutter wrote:

>I'm still fairly new to Turbine and am trying to do some customization
>of the sample app I built when I did the TDK 2.1 HowTo.  Just as a
>trivial trial run, I want to add a timestamp to the page you see when
>you first go to the site.  It's a rendering of Login.vm, so I assumed I
>could just create a Login.java--I accomplished the same thing by editing
>Index.vm and Index.java.  But it seems Login.vm is a special case.  My
>Login class is never called.  I even tested it by deliberately putting a
>divide-by-zero bug in doBuildTemplate(), but Login.vm comes up without a
>whimper.  I just copied Index.java to Login.java and changed the
>classname, and saved it in the same directory, so I'm confident I'm not
>putting it in the wrong place.
>
>I've read the docs both in the /site directory and on the Jakarta web
>site, and nothing jumps out at me.  I've tried to trace the program flow
>by reading Turbine.java and trying to trace through the various imports
>and method calls, but I'm just confusing myself.
>
>Anybody got a quick and easy pointer for me?  If there's a doc or source
>file somewhere, I'm not afraid to read it, I just don't know where to
>look.  Of course, more complete answers are welcome as well, even if
>it's "You can't do that."
>
>Am I barking up a wrong tree?  My ultimate goal is to have a public
>front page with a certain amount of dynamic content that you can see
>without having to log in, and then after you log in you get extra
>functions.  Do I just have to bite the bullet and go the
>custom-SessionValidator route?
>
>Thanks.
>
>Mark Nutter
>[EMAIL PROTECTED]
>My horoscope says today is a bad day to be superstitious.
>
>
>
>--
>To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
>

-- 

-- 
Fabio Daprile

W�rth-Phoenix Srl
Via Kravogl 4, I-39100 Bolzano
Tel: +39 0471/564111 - (direct 564070)
Fax: +39 0471/564122

mailto:[EMAIL PROTECTED]
http://www.wuerth-phoenix.com
http://www.wuerth.com





--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to