You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "bartosz (JIRA)" <ji...@apache.org> on 2009/03/28 01:42:04 UTC

[jira] Created: (WW-3064) Velocity-tools Struts2 problem, help!

Velocity-tools Struts2 problem, help!
-------------------------------------

                 Key: WW-3064
                 URL: https://issues.apache.org/struts/browse/WW-3064
             Project: Struts 2
          Issue Type: Bug
          Components: Integration
    Affects Versions: 2.1.6
         Environment: WinXP, Struts 2.1.6, Velocity 1.6, Velocity-tools 1.4
            Reporter: bartosz


Hi. Please help me because I'm loosing my nerves on it....

 I decided to build my aplication in Struts2 using Velocity.
 I downloaded latest versions of both. Ok, simple HelloWorld build with velocity works fine...
I also wanted to use some velocity tools such as date formatting and Struts field or error messages so I installed velocity-tools 1.4.
 I've made the toolbox.xml and put it in the WEB-INF I also made some corrections in web.xml...
 Aplication starts without any errors but none of tools is working :/

this is a part of my .vm template
       <h2>#if( $messages.exist() )
				#foreach( $e in $messages.all )
					$e <br>
				#end
			#end
			$message
		</h2>
		<p>Current date and time is: <b>$currentTime</p>                            
		<p>sformatowana $date.format("yyyy-MM-dd",$currentTime)</p>     

and it looks like:

Current date and time is: Sat Mar 28 00:15:06 CET 2009

sformatowana $date.format("yyyy-MM-dd",$currentTime)      

as you can see velocity tools arent working.
I also find some topics on forums and some solutions like: https://issues.apache.org/struts/browse/WW-2796
but it didn't help

MY FILES:
struts.xml
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
    "http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
	<constant name="struts.locale" value="en_GB" />
    <constant name="struts.enable.DynamicMethodInvocation" value="false" />
    <constant name="struts.devMode" value="true" />
    
    <constant name="struts.velocity.manager.classname" value="MyVelocityManager" />
        
    <package name="start" extends="struts-default">
    	<action name="start">
    		<result type="velocity">/pages/start.vm</result>
    	</action>
    
 		<action name="rejestracjaShow">
			<result type="velocity">/pages/rejestracja.vm</result>
        </action>
        <action name="rejestracja" class="Rejestracja" >
   			<result type="velocity" name="success">/pages/rejestracja.vm</result>
			<result type="velocity">/pages/rejestracja.vm</result>
		</action>
		
	</package>
	
	<package name="roseindia" namespace="/roseindia" extends="struts-default">	
		<action name="HelloWorld" class="HelloWorld">
            <result type="velocity">/pages/HelloWorld.vm</result>
        </action>
        
        <action name="showLogin">
			<result>/pages/login.vm</result>
        </action>
        <action name="doLogin" class="Login">
            <result type="velocity" name="input">/pages/login.vm</result>
			<result type="velocity" name="error">/pages/login.vm</result>
			<result>/pages/loginsuccess.jsp</result>
        </action>
		
 	</package>
</struts>

---------------------------------------------------------------------------------------------------------------------------------------------------------------------
toolbox.xml
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
<?xml version="1.0"?>
<toolbox>
  <tool>
     <key>link</key>
     <scope>request</scope>
     <class>
       org.apache.velocity.tools.struts.StrutsLinkTool
     </class>
  </tool>
  <tool>
     <key>msg</key>
     <scope>request</scope>
     <class>
       org.apache.velocity.tools.struts.MessageTool
     </class>
  </tool>
  <tool>
     <key>errors</key>
     <scope>request</scope>
     <class>
       org.apache.velocity.tools.struts.ErrorsTool
     </class>
  </tool>
  <tool>
     <key>form</key>
     <scope>request</scope>
     <class>
       org.apache.velocity.tools.struts.FormTool
     </class>
  </tool>
  <tool>
     <key>tiles</key>
     <scope>request</scope>
     <class>
       org.apache.velocity.tools.struts.TilesTool
     </class>
  </tool>
  <tool>
     <key>validator</key>
     <scope>request</scope>
     <class>
       org.apache.velocity.tools.struts.ValidatorTool
     </class>
  </tool>
  
</toolbox>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
HelloWolrd.vm
----------------------------------------------------------------------------------------------------------------------------------------------------------------------

<html>
    <head>
        <title>Struts 2 Hello World Application!</title>
    </head>
    <body>
	VELOCITY
	
        <h2>#if( $messages.exist() )
				#foreach( $e in $messages.all )
					$e <br>
				#end
			#end
			$message
		</h2>
		<p>Current date and time is: <b>$currentTime</p>
		<p>sformatowana $date.format("yyyy-MM-dd",$currentTime)</p>
		
Time      $Dzis.getHours():$Dzis.getMinutes():$Dzis.getSeconds()
Date      $Dzis.getDate()/$Dzis.getMonth()/$Dzis.getYear()
    </body>
</html>





-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (WW-3064) Velocity-tools Struts2 problem, help!

Posted by "Musachy Barroso (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/struts/browse/WW-3064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Musachy Barroso resolved WW-3064.
---------------------------------

    Resolution: Not A Problem

please ask questions on the user mailing list

> Velocity-tools Struts2 problem, help!
> -------------------------------------
>
>                 Key: WW-3064
>                 URL: https://issues.apache.org/struts/browse/WW-3064
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1.6
>         Environment: WinXP, Struts 2.1.6, Velocity 1.6, Velocity-tools 1.4
>            Reporter: bartosz
>
> Hi. Please help me because I'm loosing my nerves on it....
>  I decided to build my aplication in Struts2 using Velocity.
>  I downloaded latest versions of both. Ok, simple HelloWorld build with velocity works fine...
> I also wanted to use some velocity tools such as date formatting and Struts field or error messages so I installed velocity-tools 1.4.
>  I've made the toolbox.xml and put it in the WEB-INF I also made some corrections in web.xml...
>  Aplication starts without any errors but none of tools is working :/
> this is a part of my .vm template
>        <h2>#if( $messages.exist() )
> 				#foreach( $e in $messages.all )
> 					$e <br>
> 				#end
> 			#end
> 			$message
> 		</h2>
> 		<p>Current date and time is: <b>$currentTime</p>                            
> 		<p>sformatowana $date.format("yyyy-MM-dd",$currentTime)</p>     
> and it looks like:
> Current date and time is: Sat Mar 28 00:15:06 CET 2009
> sformatowana $date.format("yyyy-MM-dd",$currentTime)      
> as you can see velocity tools arent working.
> I also find some topics on forums and some solutions like: https://issues.apache.org/struts/browse/WW-2796
> but it didn't help
> MY FILES:
> struts.xml
> --------------------------------------------------------------------------------------------------------------------------------------------------------------------
> <?xml version="1.0" encoding="UTF-8" ?>
> <!DOCTYPE struts PUBLIC
>     "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
>     "http://struts.apache.org/dtds/struts-2.0.dtd">
> <struts>
> 	<constant name="struts.locale" value="en_GB" />
>     <constant name="struts.enable.DynamicMethodInvocation" value="false" />
>     <constant name="struts.devMode" value="true" />
>     
>     <constant name="struts.velocity.manager.classname" value="MyVelocityManager" />
>         
>     <package name="start" extends="struts-default">
>     	<action name="start">
>     		<result type="velocity">/pages/start.vm</result>
>     	</action>
>     
>  		<action name="rejestracjaShow">
> 			<result type="velocity">/pages/rejestracja.vm</result>
>         </action>
>         <action name="rejestracja" class="Rejestracja" >
>    			<result type="velocity" name="success">/pages/rejestracja.vm</result>
> 			<result type="velocity">/pages/rejestracja.vm</result>
> 		</action>
> 		
> 	</package>
> 	
> 	<package name="roseindia" namespace="/roseindia" extends="struts-default">	
> 		<action name="HelloWorld" class="HelloWorld">
>             <result type="velocity">/pages/HelloWorld.vm</result>
>         </action>
>         
>         <action name="showLogin">
> 			<result>/pages/login.vm</result>
>         </action>
>         <action name="doLogin" class="Login">
>             <result type="velocity" name="input">/pages/login.vm</result>
> 			<result type="velocity" name="error">/pages/login.vm</result>
> 			<result>/pages/loginsuccess.jsp</result>
>         </action>
> 		
>  	</package>
> </struts>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
> toolbox.xml
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------
> <?xml version="1.0"?>
> <toolbox>
>   <tool>
>      <key>link</key>
>      <scope>request</scope>
>      <class>
>        org.apache.velocity.tools.struts.StrutsLinkTool
>      </class>
>   </tool>
>   <tool>
>      <key>msg</key>
>      <scope>request</scope>
>      <class>
>        org.apache.velocity.tools.struts.MessageTool
>      </class>
>   </tool>
>   <tool>
>      <key>errors</key>
>      <scope>request</scope>
>      <class>
>        org.apache.velocity.tools.struts.ErrorsTool
>      </class>
>   </tool>
>   <tool>
>      <key>form</key>
>      <scope>request</scope>
>      <class>
>        org.apache.velocity.tools.struts.FormTool
>      </class>
>   </tool>
>   <tool>
>      <key>tiles</key>
>      <scope>request</scope>
>      <class>
>        org.apache.velocity.tools.struts.TilesTool
>      </class>
>   </tool>
>   <tool>
>      <key>validator</key>
>      <scope>request</scope>
>      <class>
>        org.apache.velocity.tools.struts.ValidatorTool
>      </class>
>   </tool>
>   
> </toolbox>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
> HelloWolrd.vm
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
> <html>
>     <head>
>         <title>Struts 2 Hello World Application!</title>
>     </head>
>     <body>
> 	VELOCITY
> 	
>         <h2>#if( $messages.exist() )
> 				#foreach( $e in $messages.all )
> 					$e <br>
> 				#end
> 			#end
> 			$message
> 		</h2>
> 		<p>Current date and time is: <b>$currentTime</p>
> 		<p>sformatowana $date.format("yyyy-MM-dd",$currentTime)</p>
> 		
> Time      $Dzis.getHours():$Dzis.getMinutes():$Dzis.getSeconds()
> Date      $Dzis.getDate()/$Dzis.getMonth()/$Dzis.getYear()
>     </body>
> </html>

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.