Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

398
Views
The server encountered an unexpected condition that prevented it from fulfilling the request

I am trying to display Data from DB.But Shows error as

The server encountered an unexpected condition that prevented it from fulfilling the request

Exception

org.apache.jasper.JasperException: An exception occurred processing JSP page /WEB-INF/pages/Detail.jsp at line 14

11: </head>
12: <body>
13: 
14: <c:forEach var="x" items="${prdt}">
15: <table>
16: <img src="resources/Images/${x.id}.png"/>
17: <td>"

MY JSP

<c:forEach var="x" items="${prdt}">
<table>
<img src="resources/Images/${x.id}.png"/>
<td>
<c:out value="${x.product_Name}"/></td>
<td>
<c:out value="${x.descripction}"/></td>
<td>
<c:out value="${x.price}"/></td>
<td>
<c:out value="${x.mfg_Date}"/>
</td>
</table>
</c:forEach>

My Controller

public ModelAndView productDtails(@PathVariable int id)
{   
ModelAndView model=new ModelAndView("Detail");
model.addObject("prdt",pd.getById(id));
return model;
}

My DAO IMpl

public Product getById(int id) 
{   
Session session=sessionFactory.openSession();
Product p=(Product) session.get(Product.class, id);
session.close();
return p;
}

Any Idea????

about 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You can't iterate over prdt object i.e., you are using forEach tag and prdt is not a List object, so to solve the issue simply remove <c:forEach var="x" items="${prdt}"> or else you need to return a list object from your Contoller.

Your JSP looks as below (after removing <c:forEach):

<table>
<img src="resources/Images/${x.id}.png"/>
<td>
<c:out value="${prdt.product_Name}"/></td>
<td>
<c:out value="${prdt.descripction}"/></td>
<td>
<c:out value="${prdt.price}"/></td>
<td>
<c:out value="${prdt.mfg_Date}"/>
</td>
</table>
about 4 years ago · Santiago Trujillo Report

0

My issue was resolved by adding the below in the model

    [AllowHtml]
    public string Description { get; set; }

C# MVC for POST

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!