First of all, apologies for asking what may be simple questions but I have
read and read the documentation and I still can't get my example to work. I
would really like to get to grips with Turbine and Velocity because I think
it shows great promise and I am really impressed so far, so if anyone can
help me get over this hurdle I would much appreciate it.
I am trying to get do something similar to the action in velocity-site.html
where the user is redirected to another screen depending on the
circumstances. I am calling the action from a template with something
like:
<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">
<p>System
<select size="1" name="Application">
#foreach ($app in $Apps)
<option value="$app.getURL()" selected>$app.getName()
</option>
#end
</select>
<a href="javascript:gotoApplication()">Go</a>
</p>
</form>
</td>
<td width="5%" align="center">
<A HREF="secure.htm">
<IMG SRC="../images/padlock.gif"><BR>
<FONT SIZE=1 COLOR=#FFFFFF>Login toggle</FONT>
</A>
</td>
</tr>
</table>
My java action class goes something like:
public class LaunchApp extends VelocityAction
{
public void doPerform(RunData data, Context context) throws Exception
{
Log log = new Log();
log.note("Executing Action");
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.
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.
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?
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?
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.
Thanks
Shaun Campbell
------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Search: <http://www.mail-archive.com/turbine%40list.working-dogs.com/>
Problems?: [EMAIL PROTECTED]