[Actionframework-users] Help me out!!!
Status: Inactive
Brought to you by:
ptoman
From: Vidya S. <sag...@ya...> - 2004-01-09 02:19:46
|
Hi all, I am new to Action Servlet and also to Velocity. I want to display a page which shows a text field with a value, which will be retreived from a Java class. This means, as soon as I start my server and goto the URL the page should display a text field showing a value which was returned by a Java class. Right now this is the code I am using. PortServlet.xml: <?xml version="1.0"?> <!DOCTYPE application SYSTEM "http://www.actionframework.org/dtd/ActionServlet_0_94.dtd"> <application> <templates> <template name="Port.vm" is-new-session="true"> <invoke component="port" method="getPort()"> </invoke> </template> </templates> <components> <component name="port" class="core.ServerPort" persistence="application"/> </components> </application> core.ServerPort.java: class{ ..... public int getPort() throws Exception { int value = 10; return value; } .... } Port.vm: <HTML> #set( $Response.ContentType = "text/html" ) <BODY> <FORM NAME=Port METHOD="POST" ACTION=""> Port: <INPUT TYPE="Text" NAME="Port" value="$port"> <INPUT TYPE="Submit" VALUE="Apply"> </FORM> </BODY> </HTML> The log shows this error: [init] ActionServlet runtime initialization OK [debug] ActionServlet DEBUG [6460907] Creating component 'port' (class: core.ServerPort) with instantiator 'org.actionframework.instantiators.DefaultInstantiator' [debug] ActionServlet DEBUG [6460907] Action '[template: Port.vm]' -> invoking 'getPort()' of 'port' [error] ActionServlet ERROR [6460907] Error ocurred in action *unknown* (request type='http.get') - org.actionframework.ActionServlet.onException() org.actionframework.ActionException: null; nested exception is: java.lang.ClassCastException: null Somebody pls help me out!!! Sorry for a lengthy email. -ss. __________________________________ Do you Yahoo!? Yahoo! Hotjobs: Enter the "Signing Bonus" Sweepstakes http://hotjobs.sweepstakes.yahoo.com/signingbonus |