I have problem to show data in jsp page with help of jstl. there is code and also error that i have got ;
my JSP PAGE is
<body>
<table border="1">
<thead>
<tr>
<th>UserId </th>
<th>First Name </th>
<th>Last Name </th>
<th>DOB </th>
<th>Email Id </th>
<th colspan="2" >Action</th>
</tr>
</thead>
<tbody>
<c:forEach items="${users}" var="user" >
<tr>
<td><c:out value="${user.userid}" /></td>
<td><c:out value="${user.firstName}" /></td>
<td><c:out value="${user.lastName}" /></td>
<td><fmt:formatDate pattern="yyyy-MMM-dd" value="${user.dob}" /></td>
<td><c:out value="${user.email}" /></td>
<td>Update</td>
<td>Delete</td>
</tr>
</c:forEach>
</tbody>
</table>
<p>Add User
this code where we fetch ALLUSERLIST IS :
public ArrayList getAllUsers()
{
ArrayList<User> USER = new ArrayList<User>();
try
{
iduQuery = "select * from user";
Statement st = conn.createStatement();
ResultSet rs =st.executeQuery(iduQuery);
while(rs.next())
{
User user =new User();
user.setUserid(rs.getString("userid"));
System.out.println("USER ID : " + user);
user.setFirstname(rs.getString("firstname"));
user.setLastname(rs.getString("lastname"));
user.setDob( new java.sql.Date(rs.getDate("dob").getTime()));
user.setEmail(rs.getString("email"));
USER.add(user);
}
}catch(Exception e)
{
e.printStackTrace();
System.out.println("Error : GetALLUSER " + e);
}
return USER;
}
Where we call jsp page :
forward ="/listUser.jsp";
ArrayList<User> myList = new ArrayList<User>();
myList = userdao.getAllUsers();
System.out.println("THis List of data arte : " + myList);
request.setAttribute("users", myList);
and error is show that:
HTTP Status 500 -
org.apache.jasper.JasperException: org.apache.jasper.JasperException: An exception occurred processing JSP page /listUser.jsp at line 33
30: <tbody>
31: <c:forEach items="${users}" var="user">
32: <tr>
33: <td><c:out value="${user.userid}" /></td>
34: <td><c:out value="${user.firstName}" /></td>
35: <td><c:out value="${user.lastName}" /></td>
36: <td><fmt:formatDate pattern="yyyy-MMM-dd" value="${user.dob}" /></td>
User.class
package com.d.model;
import java.util.Date;;
public class User {
private String userid;
private String firstName;
private String lastName;
private Date dob;
private String email;
public String getUserid() {
return userid;
}
public void setUserid(String userid) {
this.userid = userid;
}
/**
* #return the firstname
*/
public String getFirstname() {
return firstName;
}
/**
* #param firstname the firstname to set
*/
public void setFirstname(String firstName) {
this.firstName = firstName;
}
/**
* #return the dob
*/
public Date getDob() {
return dob;
}
/**
* #param dob the dob to set
*/
public void setDob(Date dob) {
this.dob = dob;
}
/**
* #return the email
*/
public String getEmail() {
return email;
}
/**
* #param email the email to set
*/
public void setEmail(String email) {
this.email = email;
}
/**
* #return the lastname
*/
public String getLastname() {
return lastName;
}
/**
* #param lastname the lastname to set
*/
public void setLastname(String lastName) {
this.lastName = lastName;
}
#Override
public String toString() {
return "User [userid= " + userid + ", firstName= '" + firstName
+ "', lastName=" + lastName + ", dob=" + dob + ", email="
+ email + "]";
}
}
spelling mistake setUsrid.change it setUserid
you are setting usrid but you are accessing userid
user.setUsrid(rs.getString("userid")); //usrid
${user.userid} // userid
spelling mistake setUsrid.change it to setUserid
you are setting usrid but you are accessing userid
user.setUsrid(rs.getString("userid")); //usrid
${user.userid} // userid
Related
I have 2 entities with a Many to One relationship that I want to display. However, when I save the data in the student entity while leaving the level entity at null I manage to display it without problem because the response is an object.
But when I associate a student with a level the answer then becomes an array [] and I cannot display with the map function since map cannot iterate over an array.
Please if anyone has any idea to help me.
×
TypeError: eleves.map is not a function
I put the capture of my code side front and back
Entity Eleve
#Entity
#Data #NoArgsConstructor #AllArgsConstructor #ToString
public class Eleve implements Serializable{
#Id #GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
//#NotBlank(message = "Ce champs est requis")
#Column(unique = true)
private String matriculeEleve;
#NotBlank(message = "Ce champs est requis")
private String nom;
#NotBlank(message = "Ce champs est requis")
private String prenom;
#NotBlank(message = "Ce champs est requis")
private String adresse;
#NotBlank(message = "Ce champs est requis")
private String contactPrimaire;
private String contactSecondaire;
#NotBlank(message = "Ce champs est requis")
private String nomParents;
#Enumerated(EnumType.STRING)
private Gender gender;
#JsonFormat(shape=Shape.STRING, pattern="yyyy-MM-dd")
#Temporal(TemporalType.DATE)
private Date dateNaissance;
#Column(name = "date_inscription")
#JsonFormat(shape=Shape.STRING, pattern="yyyy-MM-dd")
#Temporal(TemporalType.DATE)
private Date createdAt = new Date(System.currentTimeMillis());
private String statut;
private String photo;
#ManyToOne(fetch = FetchType.LAZY)
private Groupe groupe;
#ManyToOne(fetch = FetchType.LAZY)
private Niveau niveau;
public enum Gender { Masculin, Feminin }
Entite Niveau
#Entity
#Data #NoArgsConstructor #AllArgsConstructor
public class Niveau implements Serializable{
#Id #GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
#NotBlank(message = "Ce champ est requis")
private String code_classe;
private String libelle;
#OneToMany(mappedBy = "niveau")
private Collection<Eleve> eleves;
}
FrontEnd React
Action code
export const allEleves = () => async dispatch => {
const res = await axios.get("http://localhost:8080/api/eleve/all");
dispatch({
type: GET_ELEVES,
payload: res.data
});
}
Eleve Component
componentDidMount(){
this.props.allEleves()
}
render() {
const {eleves } = this.props.eleves
const listEleveComponent1 = eleves.length < 1 ? (<Info className="alert alert-info text-center" role="alert">Aucun eleve inscrit</Info>) :
eleves.map(eleve => (<ElevesItems key = {eleve.id} eleve={eleve} />
))
return (
<div className="table-responsive">
<table className="table table-striped table-bordered first">
<thead>
<tr>
<th></th>
<th>Matricule</th>
<th>Nom</th>
<th>Prenom</th>
<th>Genre</th>
<th>Date de naissance</th>
<th>Nom parents</th>
<th>Contact 1</th>
<th>Contact 2</th>
<th>Adresse</th>
<th>Niveau</th>
<th>Actions</th>
</tr>
</thead>
{listEleveComponent}
</table>
</div>
ElevesItems
<tbody>
<tr>
<td> <img src="" alt="" height="50%"/></td>
<td>{this.props.eleve.matriculeEleve}</td>
<td>{this.props.eleve.nom}</td>
<td>{this.props.eleve.prenom}</td>
<td>{this.props.eleve.gender}</td>
<td>{this.props.eleve.dateNaissance}</td>
<td>{this.props.eleve.nomParents}</td>
<td>{this.props.eleve.contactPrimaire}</td>
<td>{this.props.eleve.contactSecondaire}</td>
<td>{this.props.eleve.adresse}</td>
<td>{this.props.eleve.createdAt}</td>
<td >{this.props.eleve.niveau}</td>
<td>
<Link to={`/eleve-detail/${this.props.eleve.id}`} className="btn btn-light"><i class="fas fa-eye"></i></Link>
<button className="btn btn-danger" onClick={this.onDelete.bind(this, this.props.eleve.id)}><i class="fas fa-trash-alt"/></button>
</td>
</tr>
</tbody>
//I see a problem with de structured array at
````const {eleves } = this.props.eleves````
// to solve this u can either convert it into an object for an example
````
let p2 = ["Annie", "Becky"]
const p3 = {friend: p2}
let {friend} = p3;
friend.map(e=> e+1).forEach(k=> console.log(k))
````
// you can check if this.props.eleves this returns an array then create a new //object and add it to that
I am executing a stored procedure from my asp.net core app. The procedure executes a select statement from a db view. The db view inner joins 3 tables. When I execute the following code the result set comes as an int throwing an exception as the razor view expects List, I need to receive it as a list in order to pass it to the razor view and display the table. I would appreciate any help.
ViewModel:
public class ViewModel
{
public int TimeKey { get; set; }
public int FiscsalYear { get; set; }
public string LocationNum { get; set; }
public string Location { get; set; }
}
View:
#model List<FactWorkOrdersViewModel>
#{
ViewBag.Title = "Stored Procedure Test";
}
<div class="container">
<table class="table table-hover">
<thead>
<tr>
<th colspan="5"><h3>Stored Procedures results</h3></th>
</tr>
<tr>
<th>TimeKey</th>
<th>Fiscal Year</th>
<th>Location Number</th>
<th>Location</th>
</tr>
</thead>
<tbody>
#foreach (var item in Model)
{
<tr>
<td>
#item.TimeKey
</td>
<td>
#item.WorkOrderAltKey
</td>
<td>
#item.FiscsalYear
</td>
<td>
#item.LocationNum
</td>
<td>
#item.Location
</td>
</tr>
}
</tbody>
</table>
<div>
Controller:
public IActionResult SPTest(ReportViewModel model)
{
DbConnection connection = db.Database.GetDbConnection();
using (DbCommand cmd = connection.CreateCommand())
{
cmd.CommandText = "ExecuteReport";
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("#ReportId", model.ID));
if (connection.State.Equals(ConnectionState.Closed))
{
connection.Open();
}
var result = cmd.ExecuteScalar();
//var result = cmd.ExecuteNonQuery();
if (connection.State.Equals(ConnectionState.Open))
{
connection.Close();
}
return View(result);
}
This is a possible duplicate.
Please refer to What is the difference between ExecuteScalar, ExecuteReader and ExecuteNonQuery? for more information.
Short answer : You need ExecuteReader not ExecuteScalar.
ExecuteScalar returns first column's value of first row. ExecuteReader will return the list of rows which we can iterate through and display on your page.
I figured it out, thanks #Amogh
public IActionResult SPTest(ReportViewModel model)
{
List<ViewModel> viewModel = new List<ViewModel>();
using (SqlConnection conn = new SqlConnection("server=ServerName;database=DBName; user id=user_id; password=password; MultipleActiveResultSets=true"))
{
conn.Open();
SqlCommand cmd = new SqlCommand("ExecuteReport", conn)
{
CommandType = CommandType.StoredProcedure
};
cmd.Parameters.Add(new SqlParameter("#ReportId", model.ID));
using (SqlDataReader rdr = cmd.ExecuteReader())
{
while (rdr.Read())
{
foreach (var item in rdr)
{
ViewModel vm = new ViewModel
{
TimeKey = (int)rdr.GetValue(0),
FiscsalYear = (int)rdr.GetValue(2),
LocationNum = (string)rdr.GetValue(5),
Location = (string)rdr.GetValue(6)
};
viewModel.Add(vm);
}
}
}
}
return View(viewModel);
}
I am trying to show the employee details in a table. I created a model class EmployeeDetail, an EmployeeController and a view in EmployeeDetails.cshtml, plus a class for accessing the database.
EmployeeDetails is my model class:
[Serializable]
public class EmployeeDetails
{
private int _eid;
private string _ename;
private string _eaddress;
private string _gender;
private string _emobileno;
private bool _status;
private DateTime _ejoiningdate;
private DateTime _eleavedate;
#region ================= Code start for public variable =========================
[DataObjectField(true,true,false)]
public int eid {
get { return _eid; }
set { _eid = value; }
}
[DataObjectField(true, true, false)]
public string ename
{
get { return _ename; }
set { _ename = value; }
}
[DataObjectField(true, true, false)]
public string eaddress
{
get { return _eaddress; }
set { _eaddress = value; }
}
[DataObjectField(true, true, false)]
public string gender
{
get { return _gender; }
set { _gender = value; }
}
[DataObjectField(true, true, false)]
public string emobileno
{
get { return _emobileno; }
set { _emobileno = value; }
}
[DataObjectField(true, true, false)]
public bool status
{
get { return _status; }
set { _status = value; }
}
[DataObjectField(true, true, false)]
public DateTime ejoiningdate
{
get { return _ejoiningdate; }
set { _ejoiningdate = value; }
}
[DataObjectField(true, true, false)]
public DateTime eleavedate
{
get { return _eleavedate; }
set { _eleavedate = value; }
}
#endregion ==================== code end for public variable =================
}
Here is my EmployeeController:
public class EmployeeController : Controller
{
// GET: /Employee/
private Employeecon db = new Employeecon();
public ActionResult EmployeeDetails()
{
var studentList = new List<EmployeeDetails>{
new EmployeeDetails() { eid = 1, ename = "John", eaddress = "teszxs" } ,
new EmployeeDetails() { eid = 2, ename = "Steve", eaddress = "jfdsk" } ,
new EmployeeDetails() { eid = 3, ename = "Bill", eaddress = "jfdsk" } ,
new EmployeeDetails() { eid = 4, ename = "Ram" , eaddress = "jfdsk" } ,
new EmployeeDetails() { eid = 5, ename = "Ron" , eaddress = "jfdsk" } ,
new EmployeeDetails() { eid = 4, ename = "Chris" , eaddress = "jfdsk" } ,
new EmployeeDetails() { eid = 4, ename = "Rob" , eaddress = "jfdsk" }
};
return View();
}
}
I created EmployeeDetails.cshtml as a Razor view:
#model IEnumerable<Employee.Models.EmployeeDetails>
<html>
<head>
<title>Employee Details</title>
</head>
<body>
<div align="center">
<b> Employee Details</b>
</div>
<div align="right">
<p>
#Html.ActionLink("New Employee", "NewEmployee")
</p>
</div>
<table align="center" cellpadding="5" cellspacing="5" style="border:1px thin
black;" frame="box">
<tr>
<th>
Name
</th>
<th>
Address
</th>
<th>
Mobile no
</th>
<th>
Joining Date
</th>
</tr>
#foreach(var r in Model)
{
<tr>
<td>
#* #r.ename;*#
#Html.DisplayNameFor(m => r.ename); //but when I am declaring like that its showing error the call is ambiguous between the following methods or properties
</td>
</tr>
<tr>
<td>
#*#r.eaddress;*#
#Html.DisplayNameFor(m => r.eaddress);
</td>
</tr>
<tr>
<td>
#* #r.emobileno;*#
#Html.DisplayNameFor(m => r.emobileno);
</td>
</tr>
<tr>
<td>
#* #r.ejoiningdate;*#
#Html.DisplayNameFor(m => r.ejoiningdate);
</td>
</tr>
}
</table>
</body>
</html>
I am creating a separate folder for data access. I created a data context file Employeecon.cs:
public class Employeecon : DbContext
{
public Employeecon() : base("EmployeeContext")
{
}
public DbSet<EmployeeDetails> emp { get; set; }
}
And I added a connection string to the web.config file:
<add name="EmployeeContext"
connectionString="Data Source=LEVIOZA;Initial Catalog=Manali;Persist Security Info=True;User ID=sa;Password=pedcall"
providerName="System.Data.SqlClient" />
I want to connect to a SQL Server database, instead of local db, or I don't want to create database in the App_Data folder. Like we are did in the asp.net using SQL Server we pass the connection string using SqlConnection like that.
I am trying to connect but I don't know if it's working or not .
I don't know whats wrong with this program. I am trying to learn ASP.NET MVC and this is my first try. Please help me.
So you actually did a good job so far, let me point you to the rest.
Firstly, with database connection a side, you did created a simulation of data, which i assume you wonder why they did not shown in the view.
This is because you did not asked the controlled to use your data as model for the view. Yes, you did specify which type the model is, but you didn't supply it with data.
To fix it, pass the View() method the model instance you want, so it can bind it together.
return View(studentList);
Secondly, you want to extract those information from database, you only lacking querying the information you want from database and return it as model.
For example, lets create another url called /EmployeeDetailsFromDb
public ActionResult EmployeeDetailsFromDb()
{
var studentList = db.EmployeeDetails; // .EmployeeDetails should be changed to the table\dataset you want.
return View(studentList);
}
This will work, assuming the EmployeeDetails(if exists) is actually a collection of EmployeeDetails entities, which is what the view .cshtml expects.
I want to return a JSON Object in a datatable. I've provided the static working code that I found in an example in my angularjs template.
Thanks for help.
controller.js
function datatablesCtrl($scope,DTOptionsBuilder){
$scope.persons = [
{
id: '1',
firstName: 'Monica',
lastName: 'Smith'
},
{
id: '2',
firstName: 'Sandra',
lastName: 'Jackson'
}
];
}
Utenti.jsp
<div class="wrapper wrapper-content animated fadeInRight" ng-controller="datatablesCtrl">
<div class="row">
<div class="col-lg-12">
<table datatable="ng" dt-options="dtOptions" class="table table-striped table-bordered table-hover dataTables-example">
<thead>
<tr>
<th>ID</th>
<th>FirstName</th>
<th>LastName</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="person in persons">
<td>{{ person.id }}</td>
<td>{{ person.user }}</td>
<td>{{ person.password }}</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
I need to populate the $scope.person with data into a database.
The table of database is "utenti" with column id,fistName,lastName.
These are my classes.. There is also a class Utenti with a simple getter & setter.
UtentiService.class
#Service("UtentiService")
public class UtentiService implements IUtentiService{
private EntityManager entityManager;
final static Logger logger = Logger.getRootLogger();
#PersistenceContext
public void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
public EntityManager getEntityManager() {
return entityManager;
}
#Transactional(readOnly = true)
public List<Utenti> getAll() {
Query queryFindAll = null;
try{
queryFindAll = entityManager.createNamedQuery("utenti.findAll");
}catch(Exception ex){
logger.error("Failed in method **getAll** of utentiService: ",ex);
}
return (List)queryFindAll.getResultList();
}
}
IUtentiService.class
public interface IUtentiService {
public List<Utenti> getAll(); //Restituisce una lista di tutti i siti
}
UtentiRest.class
#Path("/utenti")
#Component
#Scope("request")
public class UtentiRest {
#Autowired
IUtentiService nameUtentiService;
final static Logger logger = Logger.getRootLogger();
#GET
#Produces("application/json")
#Path("/getAll")
public JSONObject getAll() {
ExecutorService executorService = Executors.newFixedThreadPool(10);
JSONObject jsonSitiTotal = new JSONObject();
try {
List<Utenti> soluzioni = nameUtentiService.getAll();
Iterator<Utenti> iter = soluzioni.iterator();
JSONArray jsonArray = new JSONArray();
while (iter.hasNext()) {
Utenti ut = (Utenti) iter.next();
JSONObject jsonSiti2 = new JSONObject();
jsonSiti2.put("id", ut.getId());
jsonSiti2.put("user", ut.getUserName());
jsonSiti2.put("password", ut.getPassword());
jsonArray.put(jsonSiti2);
}
jsonSitiTotal.put("Siti",jsonArray);
} catch (JSONException ex) {
logger.info(Level.ERROR, ex);
throw new WebApplicationException(
Response.status(Response.Status.BAD_REQUEST)
.entity("JSON Exception " + ex.getMessage())
.build()
);
} catch (NullPointerException ex) {
logger.info(Level.ERROR, ex);
throw new WebApplicationException(
Response.status(Response.Status.NO_CONTENT)
.entity("No process find ")
.build()
);
} catch (IllegalArgumentException ex) {
logger.info(Level.ERROR, ex);
throw new WebApplicationException(
Response.status(Response.Status.NOT_ACCEPTABLE)
.entity("Couldn't process request with the provided argument: "
+ " (" + ex.getMessage() + ")")
.build()
);
}finally {
executorService.shutdown();
}
return jsonSitiTotal;
}
}
I have to store my image into database Oracle using EJB through Struts2. It persists data but when I add input file to JSP I have NullPointerException on this line:
byte[] buffer=new byte[(int)this.telethoraxImg.length()];
Below are some parts of my code:
PictureAction.java
public class PictureAction extends ActionSupport implements SessionAware{
private static final long serialVersionUID = 1L;
private static final Logger log = Logger.getLogger(MorphoRECAction.class);
private Map session ;
private ExamMorpho exMoR;
private Patient pat;
private HttpServletRequest request;
public void setServletRequest(HttpServletRequest request) {
this.request=request;
}
public ExamMorpho getExam(){
return exMoR;
}
public void setExam(ExamMorpho exMoR){
this.exMoR = exMoR;
}
public Patient getPat(){
return pat;
}
public void setPat(Patient pat){
this.pat = pat;
}
private Date dateExMorpho;
private String echoAbdo;
private String echoCard;
private String exGyneco;
private String exOphtalmo;
private String mamo;
private String telethoraxTxt;
private File telethoraxImg;
public String execute(){
log.info("Entrée dans la méthode execute() ");
System.out.println("creation examen");
ExamMorpho ex = new ExamMorpho();
System.out.println("fin création");
try{
Patient pt = (Patient)session.get("lepat");
InitialContext initialContext = new InitialContext();
ExMorphoRemote facade = (ExMorphoRemote) initialContext.lookup("PatProjet/ExMorphoBean/remote");
System.out.println("ID Patient RECUPERE /" + pt.getIdPat());
System.out.println("Debut conversion image");
byte[] buffer=new byte[(int)this.telethoraxImg.length()];
/*exMoR = new ExamMorpho(buffer, dateExMorpho, echoAbdo, echoCard, exGyneco, exOphtalmo, mamo, telethoraxTxt); */
System.out.println("Fin conversion image");
FileInputStream in=new FileInputStream(this.telethoraxImg);
in.read(buffer);
ex.setTelethoraxImg(buffer);
ex.setDateExMorpho(dateExMorpho);
ex.setEchoAbdo(echoAbdo);
ex.setEchoCard(echoCard);
ex.setExGyneco(exGyneco);
ex.setExOphtalmo(exOphtalmo);
ex.setMamo(mamo);
ex.setTelethoraxTxt(telethoraxTxt);
System.out.println("FIN AJOUT IMAAAGE");
exMoR = facade.AddExMorphoR(ex, pt);
System.out.println("FIN AJOUT MORPHOOS");
} catch(Exception e) {
e.printStackTrace();
}
return SUCCESS;
}
/*private byte[] telethoraxImg = null;
public byte[] getTelethoraxImg() {
return this.telethoraxImg;
}
public void setTelethoraxImg(byte[] telethoraxImg) {
System.out.println("ENTREE ADD IMAGE");
this.telethoraxImg = telethoraxImg;
System.out.println("SORTIE ADD IMAGE");
}*/
/*private Date dateExMorpho = null;
public Date getDateExMorpho() {
return this.dateExMorpho;
}
public void setDateExMorpho(Date dateExMorpho) {
this.dateExMorpho = dateExMorpho;
}
private String echoAbdo = null;
public String getEchoAbdo() {
return this.echoAbdo;
}
public void setEchoAbdo(String echoAbdo) {
this.echoAbdo = echoAbdo;
}
private String echoCard = null;
public String getEchoCard() {
return this.echoCard;
}
public void setEchoCard(String echoCard) {
this.echoCard = echoCard;
}
private String exGyneco = null;
public String getExGyneco() {
return this.exGyneco;
}
public void setExGyneco(String exGyneco) {
this.exGyneco = exGyneco;
}
private String exOphtalmo = null;
public String getExOphtalmo() {
return this.exOphtalmo;
}
public void setExOphtalmo(String exOphtalmo) {
this.exOphtalmo = exOphtalmo;
}
private String mamo = null;
public String getMamo() {
return this.mamo;
}
public void setMamo(String mamo) {
this.mamo = mamo;
}
private String telethoraxTxt = null;
public String getTelethoraxTxt() {
return this.telethoraxTxt;
}
public void setTelethoraxTxt(String telethoraxTxt) {
this.telethoraxTxt = telethoraxTxt;
}
*/
public void setSession(Map session) {
this.session = session;
}
public Map getSession() {
return session;
}
}
jsp code
<form action="fileUpload" method="POST" enctype ="multipart/form-data"><table>
<thead>
<tr>
<th colspan="2"></th>
<th colspan="2" rowspan="3"><center><input type="text" name="dateExMorpho" id="dn"/></a></center></th>
</tr>
</thead>
<tbody>
<tr>
</tr>
<tr><td colspan="2">Echographie Abdominale</td><td><textarea name="echoAbdo" rows=4 COLS=40></textarea></td></tr>
<tr><td colspan="2">Ecographie Cardiaque</td><td><textarea name="echoCard" rows=4 COLS=40></textarea></td></tr>
<tr><td colspan="2">Examen Gynécologique</td><td><textarea name="exGyneco" rows=4 COLS=40></textarea></td></tr>
<tr><td colspan="2">Examen Ophtalmoloique</td><td><textarea name="exOphtalmo" rows=4 COLS=40></textarea></td></tr>
<tr><td colspan="2">Mamographie</td><td><textarea name="mamo" rows=4 COLS=40></textarea></td></tr>
<tr>
<td ROWSPAN="2">Téléthorax</td>
<td >Image</td>
<td><s:file name="telethoraxImg" ContentEditable="false" style="float:left;"/></td>
</tr>
<tr>
<td>Remarques</td>
<td><textarea name="telethoraxTxt" rows=4 COLS=40></textarea></td>
</tr>
</tbody>
my Xml
<action name="fileUpload" class="clientStruts2.PictureAction">
<interceptor-ref name="fileUpload">
<param name="allowedTypes">
image/pjpeg,image/png,image/gif,image/jpeg,image/jpg,image/pjpeg</param>
<param name="maximumSize">2097152</param></interceptor-ref>
<interceptor-ref name="basicStack"/>
<result name="input">/login/dossierRec.jsp</result>
<result name="error">/login/dossierRec.jsp</result>
<result name="success">/login/dossierRec.jsp</result>
</action>