• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can i execute few lines of code in a given jsp page  RSS feed

 
soma lingam
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

In JSP, i had 1000 Lines of Code in which i need to execute 500 Lines of code how can i perform this is any method or any attribute is available?
if so specify.


Thanks,
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What you want to do is not clear. Could you elaborate ?
 
soma lingam
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One.jsp
<%@page language='java'%>
<%
out.println("1");
out.println("2");
.
.
.
out.println("1000");
%>

like this, if i want to display only 500 lines of code out of 1000 lines of code how can i do ?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure I understand what you are trying to do You could just comment out half of it. Using java comments /* */.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of the lines in a JSP become get put into a single method call in the generated servlet (with the exception of code in declaration tags).

There is no external way of asking that lines 1 through 100 are run.

Using JSTL or scriptlets (not a best practice), you could branch your code to execute certain blocks under certain conditions.


Does this help?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could also make things a lot easier to follow by putting "do A stuff" and "do B stuff" into Plain Old Java Objects.

Now the parts are reusable on other JSPs, too.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"soma lingam",
Please see your private messages
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!