CSecurity
asked on
Two JSP Tags in 1 HTML page
Hello!
I have a JSP page and I open <% jsp tag in it. Then I close it with %>
In first tag I define a variable: int a = 23;
Then I put a lot of HTML code... Now I want to print 'a' variable in middle of html. So I re-open <% JSP tag.
But it says 'a' is not defined!
What should I do?
I have a JSP page and I open <% jsp tag in it. Then I close it with %>
In first tag I define a variable: int a = 23;
Then I put a lot of HTML code... Now I want to print 'a' variable in middle of html. So I re-open <% JSP tag.
But it says 'a' is not defined!
What should I do?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Again I got error in this line:
out.print( titles[0] );
But I defined them at TOP of opening of <% JSP tag
out.print( titles[0] );
But I defined them at TOP of opening of <% JSP tag
can you paste your JSP page?
Make sure for every opening <% , there is a closing %>
Make sure all html tags are closed properly.
<html tags>
<%
All your java code
%>
<html tags>
<%
All your java code
%>
..
Make sure all html tags are closed properly.
<html tags>
<%
All your java code
%>
<html tags>
<%
All your java code
%>
..
ASKER
The problem was that I should define them at TOP of code... it was in try and catch! ALTOUGHT everytime it goes to try and never goes to catch (no error occurs) but it should define before everything!
Thanks all
Thanks all
<%= a %>