• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Many many thank to java ranch
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Perhaps this article might be helpful in understanding how JSPs operate.
 
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic