?
Solved

error in jsp

Posted on 2005-03-27
1
Medium Priority
?
193 Views
Last Modified: 2010-04-01
i am stuck in this problem for 2 days. please help.

i am writing a method inside my jsp but it is giving me error

<%
   public void callMe() {
        ........
   }
 %>

Isn't it legal to write methods inside Jsp.?

0
Comment
Question by:niti20
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
thomas908 earned 1000 total points
ID: 13642042
You can't write a method inside a scriptlet. Whatever you write in a scriptelt goes inside the service method when the JSP code is translated to a servlet. So a method inside a scriptlet would mean a method inside the service method and that would be totally wrong as there is no concept of inner methods in Java.

if u want to write method inside a JSP, it must be in a declaration and not a scriptlet

<%!  
   //      method goes here
%>
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We are witnesses that everyone is saying that our children shouldn't "play" with a technology because it is dangerous. This article is going to prove that they are wrong.
The Summer 2017 Scholarship Winners have been announced!
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question