Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Format Contents of String Variable in JSP

  • 15-05-2009 08:30PM
    #1
    Registered Users, Registered Users 2 Posts: 269 ✭✭


    I have the contents of a string variable been displayed to the screen now the variable contains xml symtax but i dont want to format the results using xml i just want to parse the string varibale so the contents of the string is displayed nicely

    the code is as follows
     <div id="stylized" class="myform" >
              <%
                TripClient tripclient = new TripClient();
                String Result = tripclient.getTripRecord(TripHistory);
              %>
    
    <h1>Web Service Trip History Confirmation</h1>
    
    <p> TripID <b>${TripHistory.tripid}</b></p>
    
    
    [COLOR="Red"]<center><b><font size="12" face="Times"><%=Result%><b></center></font>[/COLOR]
    </div>
    
    

    The contents of my result variable i want to format

    instead of

    402Conference04-05-0906-05-09Paper242004hfhedd

    i want

    402 Conference 04-05-09 06-05-09 Paper 24 2004hfhedd

    or even better

    Trip ID : 402

    Description: Conference

    Date From: 04-05-09

    Date To: 06-05-09

    Reason: Paper

    Department: 24

    EmployeeNumber: 2004hfhedd


Comments

  • Registered Users, Registered Users 2 Posts: 1,919 ✭✭✭ronivek


    In general that kind of formatting is not something that's built in as such; you'd need to define it yourself using either regular expressions or some kind of print function.
    tripclient.getTripRecord(TripHistory)
    

    This returns your String so would it not be easier to modify your function?


Advertisement