aspose file tools*
The moose likes JSP and the fly likes Confusion with the simple JSP application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Confusion with the simple JSP application " Watch "Confusion with the simple JSP application " New topic
Author

Confusion with the simple JSP application

Asad Salim
Greenhorn

Joined: May 31, 2011
Posts: 13
I m trying to work on a simple JSP application

Thats my index.jsp
<html>
<head>
<title>Select Your Portal</title>
</head>
<body>
<h1>Select your preferred portal:</h1>
<form name="form1" action="showportal.jsp" method="get">
<select name="portchoice">
<option>news</option>
<option>weather</option>
<option>entertainment</option>
</select>
<input type="submit" value="Click on ME">
</form>
</body>
</html>




Below is showportal.jsp
<%@ taglib prefix="c" uri='http://java.sun.com/jsp/jstl/core" %>
<html>
<c:choose>
<c:when test="${param.portchoice=='news'}">
<jsp:include page="news.jsp"/>
</c:when>
<c:when test="${param.portchoice=='weather'}">
<jsp:include page="weather.jsp"/>
</c:when>
<c:when test="${param.portchoice=='entertainment'}">
<jsp:include page="entertainment.jsp"/>
</c:when>
<ctherwise>
<jsp:include page="problem.jsp"/>
</ctherwise>
</c:choose>
</html>


and below is news.jsp
<html>
<head>
<title>News Portal</title>
</head>
<body>
<jsp:useBean id="newsfeed" class="com.wrox.begjsp.ch2.NewsFeed" scope="request">
<jsp:setProperty name="newsfeed" property="topic" value="news"/>
<jsp:getProperty name="newsfeed" property="value" />
</jsp:useBean>
<jsp:include page="dummytext.html"/> <!-- dummytext.html is a dummy.html file-->
</body>
</html>

The application is giving the error below when I select New from the index.jsp and click on "Click on Me"

org.apache.jasper.JasperException: /ex2/showportal.jsp(5,41) equal symbol expected
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
org.apache.jasper.compiler.Parser.parseAttribute(Parser.java:198)
org.apache.jasper.compiler.Parser.parseAttributes(Parser.java:148)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:408)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:499)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1558)
org.apache.jasper.compiler.Parser.parse(Parser.java:130)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:245)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:161)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:326)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:307)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:565)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:309)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:308)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)

Below is my NewsFeed.java file :

package com.wrox.begjsp.ch2;

import java.beans.*;
import java.util.*;


public class NewsFeed extends Object implements java.io.Serializable {

private String topic;

private String value;

private ArrayList values;

public NewsFeed() {

}


public void setTopic(String topic) {
value = "";
values = null;
if (topic.equals("news")) {
value = "JSP Programmer Won 10 Million in Lottery";
}
if (topic.equals("entertainment")) {
value = "Reality TV Show Ratings Falling";
}
if (topic.equals("weather")){
values = new ArrayList();
HashMap tmap = new HashMap();
tmap.put("city", "Mumbai");
tmap.put("temp", "30 C");
values.add(tmap);
tmap = new HashMap();
tmap.put("city", "Tokyo");
tmap.put("temp", "18 C");
values.add(tmap);
tmap = new HashMap();
tmap.put("city", "Hong Kong");
tmap.put("temp", "28 C");
values.add(tmap);

}

}

public String getValue() {
return this.value;
}

public ArrayList getValues() {
return this.values;
}

}


Thanks in advance. I m confused with what would be the exact problem with this one.

Thanks,
Asad


Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Please UseCodeTags when posting code to the forums. It's also not necessary to post all the code.

Inspect the following carefully:


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Asad Salim
Greenhorn

Joined: May 31, 2011
Posts: 13
Thanks bear , yes i would remember use CodeTags henceforth.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

Did that solve the issue?
Asad Salim
Greenhorn

Joined: May 31, 2011
Posts: 13
yes , it did that was the only issue
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61768
    
  67

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Confusion with the simple JSP application