whoopy_whale Posted September 8, 2008 Share Posted September 8, 2008 Please tell me how to call a user defined function in jsp? Is it possible to write functions in jsp in a similar fashion of php? Or do we need to create it in a java file? Please respond. Link to comment https://www.neowin.net/forum/topic/666566-jsp-calling-a-user-defined-function-in-a-jsp/ Share on other sites More sharing options...
0 Antaris Veteran Posted September 8, 2008 Veteran Share Posted September 8, 2008 You can do a couple of things really, you can have a servlet which you make calls to, you could have a bean which you instantiate declaratively, or you could use scripting blocks. Scripting blocks work like follows: <% public String sayHello(String myName) { return "Hello " + myName; } %> Link to comment https://www.neowin.net/forum/topic/666566-jsp-calling-a-user-defined-function-in-a-jsp/#findComment-589757054 Share on other sites More sharing options...
0 whoopy_whale Posted September 9, 2008 Author Share Posted September 9, 2008 Please tell me how to call functions from a servlet. I was under the impression that servlets can be used to process form data only. I am migrating from PHP to JSP... so i have some doubts here... Plz help me... Link to comment https://www.neowin.net/forum/topic/666566-jsp-calling-a-user-defined-function-in-a-jsp/#findComment-589760314 Share on other sites More sharing options...
0 Antaris Veteran Posted September 9, 2008 Veteran Share Posted September 9, 2008 I don't mean to be rude, but have you actually spent some time looking into what JSP does? Or have you come straight on here for answers without spending some time doing research yourself? Generally, a Servlet (which can be a .jsp page, or a compiled class) receives a request and returns a response. You should research Java beans, and J2EE... Link to comment https://www.neowin.net/forum/topic/666566-jsp-calling-a-user-defined-function-in-a-jsp/#findComment-589760884 Share on other sites More sharing options...
0 whoopy_whale Posted September 9, 2008 Author Share Posted September 9, 2008 Thats ok :) I was actually looking for a quick solution... I started off with JSP,and then worked on PHP and now back to JSP..and I really need to do some research... Thanks for the reply... Link to comment https://www.neowin.net/forum/topic/666566-jsp-calling-a-user-defined-function-in-a-jsp/#findComment-589761592 Share on other sites More sharing options...
Question
whoopy_whale
Please tell me how to call a user defined function in jsp?
Is it possible to write functions in jsp in a similar fashion of php? Or do we need to create it in a java file?
Please respond.
Link to comment
https://www.neowin.net/forum/topic/666566-jsp-calling-a-user-defined-function-in-a-jsp/Share on other sites
4 answers to this question
Recommended Posts