?
Solved

IN JSP <% AND <%!

Posted on 2012-03-28
7
Medium Priority
?
347 Views
Last Modified: 2012-03-29
What is the difference between

<%         %>

and

<%!         %>

Thnak you.
0
Comment
Question by:Mike Eghtebas
  • 3
  • 2
  • 2
7 Comments
 
LVL 28

Expert Comment

by:rrz
ID: 37778924
I would like to help you but I don't think you have been honest with me in your last two questions.
Did you even try my suggestions. ?
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 37778987
rrz@871311,

My apology for that. After work when I am home I would respond.

I was under gun and have to shift my focus elsewhere, Also, there was server setup which was adjusted and the attending to the question was not priority.

I will get back to you.

Also I thing <!-- to do with sort of public deceleration or just deceleration.

I am new and confused right now.

thx
0
 
LVL 28

Expert Comment

by:rrz
ID: 37779140
The solution you at
http://www.experts-exchange.com/Programming/Languages/Java/Q_27651282.html 
will not work for you. Why did you accept it ?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 20

Accepted Solution

by:
Sathish David  Kumar N earned 800 total points
ID: 37780532
<%         %>----------------> this is scriptlet

<%!    %> ------------> this declerative  

both are usefull to right java code but the main diffrences is if you want to use any filed or method any where in jsp then you can go with declerative  .
eg:
<%! String s="Sathish" %>
<% String  s1="David" %>

here you can use s in any where in your jsp but s1 will accessable inside the scriplet only ....
0
 
LVL 20

Expert Comment

by:Sathish David Kumar N
ID: 37780539
check with this solution mike .... it will usefull for you to understand ...
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 37783283
thanks dravidnsr, t

o post No instead of null, I am using the following code:

      <body>
          
             <%! String str = "No" %>   <-- is this correct?
             
            <b>Margherita?:</b>
            <%
            str = ((request.getParameter("margherita") != null)? "Yes":"No");
                  out.println(str);
            %>
            <br>
            <b>Hawaiian?:</b>
            <% out.println(request.getParameter("hawaiian")); %>
            <br>
            <b>Pepperoni?:</b>
            <% out.println(request.getParameter("pepperoni")); %>
            <br>

      </body>

I want to declare str once such that its scope will hande all three items. After the first one works, I wiil change the remainig two.

Mike
0
 
LVL 34

Author Closing Comment

by:Mike Eghtebas
ID: 37783736
Thank you. I figured out the rest.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

In the below post we have mentioned the best hosting type for startups. Also, check out some of the superlative web hosting companies that are proposing affordable web hosting solutions to host your startup website.
Tech giants such as Amazon and Google have sold Alexa and Echo to such an extent that they have become household names. And soon they are expected to be used by commoners in their homes, ordering takeout, picking out a song, answering trivia questio…
This Micro Tutorial will teach you how to add a cinematic look to any film or video out there. There are very few simple steps that you will follow to do so. This will be demonstrated using Adobe Premiere Pro CS6.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

807 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