1 16 17 package org.apache.velocity.tools.struts; 18 19 import org.apache.velocity.app.Velocity; 20 import org.apache.velocity.tools.view.tools.LinkTool; 21 import org.apache.velocity.tools.struts.StrutsUtils; 22 23 47 public class StrutsLinkTool extends LinkTool 48 { 49 50 51 62 public StrutsLinkTool setAction(String action) 63 { 64 return (StrutsLinkTool)copyWith( 65 StrutsUtils.getActionMappingURL(application, request, action)); 66 } 67 68 69 80 public StrutsLinkTool setForward(String forward) 81 { 82 String url = StrutsUtils.getForwardURL(request, application, forward); 83 if (url == null) 84 { 85 Velocity.warn("StrutsLinkTool: In method setForward(" + forward + 86 "): Parameter does not map to a valid forward."); 87 return null; 88 } 89 return (StrutsLinkTool)copyWith(url); 90 } 91 92 93 } 94 | Popular Tags |