aspose file tools*
The moose likes Servlets and the fly likes how to solve the http error 500 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "how to solve the http error 500" Watch "how to solve the http error 500" New topic
Author

how to solve the http error 500

a k m shamsudoha
Greenhorn

Joined: Apr 09, 2013
Posts: 15
HTTP Status 500 -

type Exception report

message

description :The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: /result.jsp (line: 1, column: 18) quote symbol expected
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:42)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:408)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:89)
org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:222)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:162)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:183)
org.apache.jasper.compiler.ParserController.getPageEncodingForJspSyntax(ParserController.java:479)
org.apache.jasper.compiler.ParserController.determineSyntaxAndEncoding(ParserController.java:420)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:190)
org.apache.jasper.compiler.ParserController.parseDirectives(ParserController.java:119)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:193)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:373)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:353)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:340)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:646)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:357)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
BeerSelect.doPost(BeerSelect.java:18)
javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.27 logs.
Apache Tomcat/7.0.27
my jsp code is below
<%@ page import=”java.util.*” %>
<html>
<body>
<h1 align=”center”>Beer Recommendations JSP</h1>
<p>
<%
List styles = (List)request.getAttribute(“styles”);
Iterator it = styles.iterator();
while(it.hasNext()) {
out.print(“<br>try: “ + it.next());
}
%>
</body>
</html>
my servlet code is below
import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import java.util.*;
public class BeerSelect extends HttpServlet {
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws IOException, ServletException {
String c = request.getParameter("color");
BeerExpert be = new BeerExpert();
List result = be.getBrands(c);
// response.setContentType("text/html");
// PrintWriter out = response.getWriter();
// out.println("Beer Selection Advice<br>");
request.setAttribute("styles",result);
RequestDispatcher view =
request.getRequestDispatcher("result.jsp");
view.forward(request, response);
}
}
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12825
    
    5
You may think that this line:


has a quote mark at line 1 column 18 but in truth it is one of those CURSED microsoft word smart quotes.

I determined this by using UltraEdit 32 - a programmer's editor - that shows the hex value actually is 0x94

Illustrating once again why Word is a bad choice for programming.

Bill
a k m shamsudoha
Greenhorn

Joined: Apr 09, 2013
Posts: 15
thanks to william brogden for your reply
It works nicely
thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to solve the http error 500