0

I am using java within a .jsp file and need to output account information in an HTML table. My code goes like this:

    <%    
    UserAccount ADuser = au.getAccountByEmail(user.getUserName());

    String fname = ADuser.getFirstName();
    %>

My question is how do I insert fname into a <td> such as this:

<td width="82%" height="30">'first name here</td>'

Thanks for the help

2
  • 2
    How use <%=ADuser.getFirstName()%> in td ? Commented Sep 17, 2014 at 14:07
  • Put this as an answer. Thanks!! Commented Sep 17, 2014 at 14:10

1 Answer 1

1

Can use scriptlet <%= %> in table data,

<%=ADuser.getFirstName()%>

Or can use jsp expression ${} like this post

<% request.setAttribute("firstName", ADuser.getFirstName()); %>

//then in table data
<td..>${firstName}</td>
Sign up to request clarification or add additional context in comments.

2 Comments

Don't use scriptlets, we are living in the 21st century, not the 11th century. Use EL Expressions.
@DwB Sure this is just to be simple and i updated with El usage.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.