akmal70 0 Newbie Poster

hi
i am in great trouble. problem is i create a Servlet and code is

    HttpSession session = request.getSession();
    session.setAttribute("employee", employee);

"employee" is bean and now i am access that in jsp page like this:

<LI><B>First Name:</B> ${employee.name.firstName}

it work fine but if i use this bean in java code, it return null value like this:

<LI><B>First Name:</B> <%= pageContext.getAttribute("employee.name.firstName") %>

my requirement is that i have to use it in java code not simple html second one thing more if i do this code in Servlet:

session.setAttribute("attribute2", "USA");

and use this code in jsp:

<LI><B>attribute1:</B> <%= pageContext.findAttribute("attribute2") %>

so this code work fine but problem with bean so kindly help me

thanks,
Akmal

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.