Struts 2 session

I have put a List in session in a Struts 2  action class  as below

How do I pull   this list in a  java variable  in  JSP page ?

The following does not work . Syntax error.
List temp =  #session['alist'] ;

what is the correct syntax ?
Who is Participating?
Sathish David Kumar NConnect With a Mentor ArchitectCommented:
you  can also use scriplet .

1st import the list in the jsp page
List a=(List) session.getAttribute("alist");%>

In this example beloow
they use dot (#session.ret)

In some other places I saw sessionScope instead of session.

Unlesss someone who knows better suggest something, you could at least try this.

<%@ taglib prefix="s" uri="/struts-tags" %>

    <s:head theme="ajax" debug="true"/>
    <s:div id="loginDiv" theme="ajax">
        <h3> Your Session: <s:property value="#session.ret" /></h3>
    <div style="width: 300px;border-style: solid">
      <s:form action="AjaxTestAction"  validate="false">
          <td colspan="2">
            Run Test
          <td colspan="2">
            <s:actionerror />
            <s:fielderror />
          <s:textfield name="welcome1" label="WELCOME1"/>
          <s:textfield name="welcome2" label="WELCOME2"/>
          <s:submit value="Submit" theme="ajax" targets="loginDiv"
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.