on 1/5/2001 5:06 AM, "Shaun Campbell" <[EMAIL PROTECTED]> wrote:
> <table border="0" width="100%">
> <tr>
> <td width="18%">Entranet Customer Support System</td>
> <td width="52%">
> <form method="GET"
> action="$link.setPage("Index").setAction("LaunchApp")" NAME="appchoice">
This should be "Index.vm"
Actions don't have a suffix since they map to Java code. Pages do since they
map to template pages.
> public class LaunchApp extends VelocityAction
> {
> public void doPerform(RunData data, Context context) throws Exception
> {
> Log log = new Log();
> log.note("Executing Action");
That is the wrong way to use the Log class that comes with Turbine unless
that is your own logging class or something (I don't see your import
statements).
> if (true){
> setTemplate ( data, "ProjWeb.vm" );
> log.note("Template set to ProjWeb.vm");
> return ;
> }
> data.setMessage("Information stored!");
>
> }
> }
>
> What happens is that doPerform above is called and it goes into the if
> (true) block, but the ProjWeb class does not run, and the Index page is
> re-displayed. The template does not therefore appear to change from Index
> to ProjWeb as I would have expected.
Weird. That works fine for me. Does the log message underneath show up?
> I then decided to change $link.setPage in my template to $link.setScreen.
> When I did this the ProjWeb page appeared on the screen but I got an error
> "An error occurred while rendering template layoutsnull" in my turbine log
> file. The same error I reported a few days ago when I entered the URL
> /screen/screenName/action/actionName instead of /template/templateName.
Right. You don't want to override the Screen that gets executed. :-) Page ==
Template.
> I have two things therefore which I don't understand.
>
> Firstly, why did setPage in my original template not try to bring up the
> redirected template when executing the action?
All setPage does is define the URI.
> Secondly, what do you need to do to a screen class to be able to access it
> via /screen/screenName? The reason I ask is because the DynamicURI always
> generates URLs of the form /screen/screenName and not /template?
Your URI example above should generate:
http://localhost:8080/foo/servlet/foo/template/Index.vm/action/LaunchApp?jse
rvsessionid=laksjdfljasldffdljk
> Apologies once again if these are simple questions that are answered in the
> docs but if anyone can explain exactly what is going on or where I could get
> more information I would really appreciate it.
Nope. I think you are just confusing yourself. :-)
-jon
--
Honk if you love peace and quiet.
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]