Hi there I've successfully setup a function in JSP can calling it from the same file. I want to separate my logic from presentation, how would I go about throwing this function <%! somewhere else in a class and then accessing it from my .jsp front-end file>?
            Asked
            
        
        
            Active
            
        
            Viewed 138 times
        
    1 Answers
2
            Yes, you must have to avoid Java code in JSP files. Take a look at - How to avoid Java Code in JSP-Files? You need to place (create and compile) a public class definition under the WEB-INF/classes. For instance,
package test;
public class Foo
{
  public void methodOne() { .. }
  public static void methodTwo() { .. }
}
 
    
    
        Community
        
- 1
- 1
 
    
    
        KV Prajapati
        
- 93,659
- 19
- 148
- 186
