Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: How to get the JSP line postition in Tag class?

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default How to get the JSP line postition in Tag class?

    Hi,

    is it possible to determine the exact line-position in JSP files inside a Tag (or TagSupport Class)?
    We need this to generate a unique, but don't variable ID, it must the same by every request. (Depending on the actual position in the JSP)

    We've thought about the possibility to generate a ID over the StackTrace, but we aren't shure if this is a save method, cause every Webcontainer may translate the JSPs in a different way.
    (It must work on every web- or j2ee-container)
    IDs on different containers may be different, but in the same instance they must be exactly the same. (For every position, of course)

    Thanks for every suggestions.


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: How to get the JSP line postition in Tag class?

    Not entirely sure what you mean here, the line position of what exactly and when?

    // Json

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: How to get the JSP line postition in Tag class?

    I like to get the line position from the actual JSP.
    For example:

    test.jsp
    ...
    [...]
        <tr>
     
            <td class="FormAreaHorizontalPadder"></td>
     
            <td>
     
              <c:if test="${empty activeForm.testMessages}">
     
                &lt;no messages&gt;
     
              </c:if>
     
              <c:forEach var="message" items="${activeForm.testMessagesConsumed}">
     
                <c:out value="${message}" /><br />
     
              </c:forEach>
     
            </td>
     
          </tr>
    [...]

    When the IfTag is called on "<c:if test="${empty activeForm.testMessages}">" i need in the tag class a information like "test:jsp 102" where 102 is the actual line in the jsp.
    Particular i will use this at rendering time in the doStartTag() and doEndTag() Method in the Tag class.

    Thanks

Similar Threads

  1. Need help... how to get the line moving?
    By thaiman in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 7th, 2010, 10:04 AM
  2. Getting all points in line
    By Mike in forum Java Theory & Questions
    Replies: 7
    Last Post: September 13th, 2010, 11:59 AM
  3. Get a certain line in a JTextField
    By FlamingDrake in forum Java Theory & Questions
    Replies: 2
    Last Post: May 14th, 2010, 03:21 PM
  4. Reading a file line by line using the Scanner class
    By JavaPF in forum File Input/Output Tutorials
    Replies: 0
    Last Post: April 17th, 2009, 07:34 AM
  5. How to Read a file line by line using BufferedReader?
    By JavaPF in forum File Input/Output Tutorials
    Replies: 0
    Last Post: May 19th, 2008, 06:32 AM