Results 1 to 3 of 3
  1. #1
    Marcus is offline Member
    Join Date
    Jun 2007
    Posts
    92
    Rep Power
    0

    Default Help with Tags JSP

    Under WEB-INF/tags directory there is a file called select.tag.
    I viewed the filed and found there are some lines of java codes wrapped within the
    Java Code:
    <%! %>:
    
    <%!
    ...
    try {
    Object bean = jspContext.findAttribute(beanName);
    Method m = bean.getClass().getMethod(methodName, null);
    result = m.invoke(bean, null).toString();
    ...
    %>
    My question is: why use "!" after the
    Java Code:
    <%? Why not directly use <%.... %>>
    Thanks.
    Marcus :cool:

  2. #2
    Eric is offline Senior Member
    Join Date
    Jun 2007
    Posts
    111
    Rep Power
    0

    Default

    JSP, not client-side javascript.

    Please check this link

    Greetings.
    Eric

  3. #3
    Daniel is offline Member
    Join Date
    Jun 2007
    Posts
    91
    Rep Power
    0

    Default

    Java Code:
    <%! ... %> i
    s referred to as a declaration block.

    it can also be written in xml syntax...for example

    Java Code:
    <jsp:declaration>
    String user_name = new String();
    </jsp:declaration
    the following is a comment
    Java Code:
    <%-- comment --%>
    the following is an expression
    Java Code:
    <%= expression %>
    Say for example, you have a string and it contains a user's name "John Smith" and you want to print it...you can write
    Java Code:
    <%= name %> instead or typing <% out.println( name ); %>
    Greetings
    Daniel:o

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •