Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Format Contents of String Variable in JSP

  • 15-05-2009 7: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,916 ✭✭✭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