• Post Reply Bookmark Topic Watch Topic
  • New Topic

why i am getting this error while my file has no such code  RSS feed

 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear sir when i am calling a jsp fill on app server then i am getting error as

Generated servlet error:
[javac] C:\Sun\AppServer\domains\domain1\generated\jsp\j2ee-apps\dmp5\war-ic_war\org\apache\jsp\CourseCart_jsp.java:171: ';' expected
[javac] out.write(">\r\n");
[javac] ^
[javac] 1 error

although my jsp file hase no such types of code then also why i am getting this error

My jsp file is as below while it has no such code



<%@page import="javax.ejb.*, javax.naming.*, javax.rmi.PortableRemoteObject, java.rmi.RemoteException, java.math.*,java.util.*"%>
<%!

private Course course=null;
CourseHome home=null;
public void jspInit()
{

try
{


InitialContext ic=new InitialContext();
Object objRef=ic.lookup("java:comp/env/ejb/Univ");
home=(CourseHome)PortableRemoteObject.narrow(objRef,CourseHome.class);
}
catch(Exception ex)
{}
}

%>
<html>
<head>
<title>University Registration Application</title>
</head>
<body bgcolor="white">
<form method="get" name="f1">
<%

String stdname=request.getParameter("stdname");
String stdrollno=request.getParameter("stdrollno");
if(stdname != null && stdrollno.length() >0)
{

if (stdrollno !=null && stdrollno.length()>0)
{

course=home.create(stdname,stdrollno);
}
}
%>

<H1>University Registration Application</h1>
<p> Welcome <%=stdname%>
<p>
please a courese subject
<select name=ch size=1>
<option>Geography</option>
<option>History</option>
<option>Zoology</option>
<option>Botany</option>
</select>
<br>
<%

int i=1;
String choice=request.getParameter("ch");
if(Choice != null)
{


if(! choice.equals("--"))
{
String str=course.addCourse(choice);
%>
<p><%=str%>

<%
}
}

String rmcourse=request.getParameter("c");
if(rmcourse != null)
{

course.removeCourse(rmcourse);
}
Vector courseList=new Vector();
CourseList=course.getSelectedCourse();
Enumeration enumer=courseList.elements();

%>

<form method="get" name="f2">
<p><p>
<table border=1>
<th>
Course Name
</th>
<th>
Select Course to remove
</th>
<%
while(enumer.hasMoreElements())
{
String title=(String) enumer.nextElement();
if(title != null)
{
%>

<tr>
<td>
<%=title%>
</td>
<td>
<input type=radio name=c value=<%title%>>
</td>
</tr>
<%
}
}
%>
</table>
<input type="hidden" name="stdname" size="25" value=<%=stdname%>>
<input type="submit" value="submit">
<input type="reset"vallue="Reset">
</form>
</body>
</html>

Regard

Arun kumar maalik
 
Johnson Abraham
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
change --> <input type=radio name=c value=<%title%>> to <input type=radio name=c value=<%=title%>>

And the reason why you see that code even if you dont have it in JSP is because your JSP is pre-compiled into java class before loading. During the conversion from .jsp to .class it modifies many things like when you write a scriptlet say <%=anyVariable%> it gets converted into out.print(anyVariable \n\r). To satisfy your curiosity you can find the converted class files in the work folder of your application context root.
 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many many thank to java ranch
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66154
146
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perhaps this article might be helpful in understanding how JSPs operate.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!