0

I have written some code for displaying values in input box using jsp ,Values coming from Action class.

request.setAttribute("Admissionno",studentdata.get(0));
request.setAttribute("Empname",studentdata.get(1));

Below is the Jsp Code:

<table id="biometric">
    <thead>
        <tr>
            <th>Admission No</th>
            <th>Employee Name</th>
            <th>Attendence</th>

        </tr>
    </thead>

    <tbody>

        <tr>
            <td><input type="text" size="30" name="admission" readonly="readonly"  
                       value="%=request.getAttribute("Admissionno")%>" /></td>
            <td><input type="text" size="30" name="empName"
                readonly="readonly" value=""></input></td>
            <td><select name="status" size="1">
                    <option value="Present">Present</option>
                    <option value="Absent">Absent</option>
                    <option value="Sunday">Sunday</option>
                    <option value="Holiday">Holiday</option>
                    <option value="NA">NA</option>
            </select></td>

        </tr>

        </tbody>
</table>

In Action class values are coming, But Values are not displayed in Jsp.

when using scriptlet Jsp is not working.

please provide the any other solution.

Emil L
  • 20,219
  • 3
  • 44
  • 65
user2996174
  • 1,391
  • 4
  • 13
  • 20
  • 1
    do not use request.setAttribute() in jsp the value does not remain once the page finishes loading. Please visit http://stackoverflow.com/questions/229937/using-request-setattribute-in-a-jsp-page – AurA Apr 10 '14 at 09:35
  • Here am passing some parameters,based on that values is getting from database.So same jsp using two times. Once values sending and getting ,if i use session previous values is displayed, not current request – user2996174 Apr 10 '14 at 09:41
  • in case you want to persist values in case of url redirects and page refreshes use session.setAttribute instead. – AurA Apr 10 '14 at 09:48
  • your scriptlet tag is incomplete <%=request.getAttribute("Admissionno")%> – Divya Apr 10 '14 at 09:48
  • Which version of Struts are you using? – Aleksandr M Apr 10 '14 at 20:22

0 Answers0