You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mike Peremsky <mp...@yahoo.com> on 2007/06/04 01:12:55 UTC

jsp includes not compiling

I have used jsp includes with weblogic with no problems, I am using the same format of the code with Tomcat but am having issues.
   
  I include the jsp as follows:
   
  <%@ include file="/include/JspVariables.inc" %>

   
  The code in the inc file is:
   
  <%@ page import="com.drafthappy.GlobalConsts" %>
<%@ page import="com.drafthappy.dataobject.LoginObject" %>
  <%
  LoginObject loginobj = (LoginObject)session.getAttribute("<%= GlobalConsts.SO_LOGIN_OBJ %>");
%>
   
   
   
  The error I am getting is the following:
   
  org.apache.jasper.JasperException: Unable to compile class for JSP: 
  An error occurred at line: 5 in the jsp file: /include/JspVariables.inc
String literal is not properly closed by a double-quote
2: <%@ page import="com.drafthappy.dataobject.LoginObject" %>
3: 
4: <%
5:   LoginObject loginobj = (LoginObject)session.getAttribute("<%= GlobalConsts.SO_LOGIN_OBJ %>");
6: %>

  I also get other strange errors on other inc files, but am not yet sure if it is related to the fact that this variable is not being declared.
   
  - Mike

 
---------------------------------
No need to miss a message. Get email on-the-go 
with Yahoo! Mail for Mobile. Get started.

Re: jsp includes not compiling

Posted by David Smith <dn...@cornell.edu>.
The visibility of scriptlet objects is not well defined in the jsp spec 
-- at least as far as I can tell.  Someone will immediately correct me 
if I'm wrong :-). 

It'd probably be best to place code for retrieving the object closer to 
where it's used, preferably in the same scriptlet block.  If this login 
object is designed as a valid java bean, you could also access it using 
the jsp:useBean and related tags.  Those tags can search pageContext, 
request, session, and application scopes for attributes.

--David

Mike Peremsky wrote:
> Hmm,
>    
>   I went back to look. That is the syntax I use with weblogic. If I remove the <% %> from the inc file Tomcat loads the files properly. But then I cannot use logic in the inc file (e.g. 
>    
>   if (obj != null) {
>   }
>
> Mike Peremsky <mp...@yahoo.com> wrote:
>   Oops. I missed that. Thx
>
> David Smith wrote: You are already in a pair when you do GlobalConst.SO_LOGIN_OBJ %>. Why?
>
> Seems to me this would be a better expression:
>
> LoginObject loginobj = (LoginObject)session.getAttribute( 
> GlobalConst.SO_LOGIN_OBJ )
> %>
>
> --David
>
> Mike Peremsky wrote:
>   
>> I have used jsp includes with weblogic with no problems, I am using the same format of the code with Tomcat but am having issues.
>>
>> I include the jsp as follows:
>>
>>
>>
>>
>> The code in the inc file is:
>>
>>
>>
>>     
>>> LoginObject loginobj = (LoginObject)session.getAttribute("");
>>>       
>> %>
>>
>>
>>
>> The error I am getting is the following:
>>
>> org.apache.jasper.JasperException: Unable to compile class for JSP: 
>> An error occurred at line: 5 in the jsp file: /include/JspVariables.inc
>> String literal is not properly closed by a double-quote
>> 2: 
>> 3: 
>> 4: > 5: LoginObject loginobj = (LoginObject)session.getAttribute("");
>> 6: %>
>>
>> I also get other strange errors on other inc files, but am not yet sure if it is related to the fact that this variable is not being declared.
>>
>> - Mike
>>
>>
>> ---------------------------------
>> No need to miss a message. Get email on-the-go 
>> with Yahoo! Mail for Mobile. Get started.
>>
>>     
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
> ---------------------------------
> Looking for earth-friendly autos? 
> Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. 
>
>        
> ---------------------------------
> Be a better Heartthrob. Get better relationship answers from someone who knows.
> Yahoo! Answers - Check it out. 
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jsp includes not compiling

Posted by Martin Gainty <mg...@hotmail.com>.
inside your jsp:include try supplying your variables thru <jsp:param 
value="<%= expression %>"

http://java.sun.com/products/jsp/syntax/1.2/syntaxref1214.html
<jsp:include page="{relativeURL | <%= expression %>}"
   flush="true| false" >   <jsp:param name="parameterName"
      value="{parameterValue | <%= expression %>}" />+</jsp:include>
HTHM--This email message and any files transmitted with it contain 
confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.

----- Original Message ----- 
From: "Mike Peremsky" <mp...@yahoo.com>
To: "Tomcat Users List" <us...@tomcat.apache.org>
Sent: Sunday, June 03, 2007 8:24 PM
Subject: Re: jsp includes not compiling


> Hmm,
>
>  I went back to look. That is the syntax I use with weblogic. If I remove 
> the <% %> from the inc file Tomcat loads the files properly. But then I 
> cannot use logic in the inc file (e.g.
>
>  if (obj != null) {
>  }
>
> Mike Peremsky <mp...@yahoo.com> wrote:
>  Oops. I missed that. Thx
>
> David Smith wrote: You are already in a pair when you do 
> GlobalConst.SO_LOGIN_OBJ %>. Why?
>
> Seems to me this would be a better expression:
>
> LoginObject loginobj = (LoginObject)session.getAttribute(
> GlobalConst.SO_LOGIN_OBJ )
> %>
>
> --David
>
> Mike Peremsky wrote:
>> I have used jsp includes with weblogic with no problems, I am using the 
>> same format of the code with Tomcat but am having issues.
>>
>> I include the jsp as follows:
>>
>>
>>
>>
>> The code in the inc file is:
>>
>>
>>
>> > LoginObject loginobj = (LoginObject)session.getAttribute("");
>> %>
>>
>>
>>
>> The error I am getting is the following:
>>
>> org.apache.jasper.JasperException: Unable to compile class for JSP:
>> An error occurred at line: 5 in the jsp file: /include/JspVariables.inc
>> String literal is not properly closed by a double-quote
>> 2:
>> 3:
>> 4: > 5: LoginObject loginobj = (LoginObject)session.getAttribute("");
>> 6: %>
>>
>> I also get other strange errors on other inc files, but am not yet sure 
>> if it is related to the fact that this variable is not being declared.
>>
>> - Mike
>>
>>
>> ---------------------------------
>> No need to miss a message. Get email on-the-go
>> with Yahoo! Mail for Mobile. Get started.
>>
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
>
> ---------------------------------
> Looking for earth-friendly autos?
> Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.
>
>
> ---------------------------------
> Be a better Heartthrob. Get better relationship answers from someone who 
> knows.
> Yahoo! Answers - Check it out. 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: jsp includes not compiling

Posted by Mike Peremsky <mp...@yahoo.com>.
Hmm,
   
  I went back to look. That is the syntax I use with weblogic. If I remove the <% %> from the inc file Tomcat loads the files properly. But then I cannot use logic in the inc file (e.g. 
   
  if (obj != null) {
  }

Mike Peremsky <mp...@yahoo.com> wrote:
  Oops. I missed that. Thx

David Smith wrote: You are already in a pair when you do GlobalConst.SO_LOGIN_OBJ %>. Why?

Seems to me this would be a better expression:

LoginObject loginobj = (LoginObject)session.getAttribute( 
GlobalConst.SO_LOGIN_OBJ )
%>

--David

Mike Peremsky wrote:
> I have used jsp includes with weblogic with no problems, I am using the same format of the code with Tomcat but am having issues.
> 
> I include the jsp as follows:
> 
> 
>
> 
> The code in the inc file is:
> 
> 
> 
> > LoginObject loginobj = (LoginObject)session.getAttribute("");
> %>
> 
> 
> 
> The error I am getting is the following:
> 
> org.apache.jasper.JasperException: Unable to compile class for JSP: 
> An error occurred at line: 5 in the jsp file: /include/JspVariables.inc
> String literal is not properly closed by a double-quote
> 2: 
> 3: 
> 4: > 5: LoginObject loginobj = (LoginObject)session.getAttribute("");
> 6: %>
>
> I also get other strange errors on other inc files, but am not yet sure if it is related to the fact that this variable is not being declared.
> 
> - Mike
>
> 
> ---------------------------------
> No need to miss a message. Get email on-the-go 
> with Yahoo! Mail for Mobile. Get started.
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org




---------------------------------
Looking for earth-friendly autos? 
Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center. 

       
---------------------------------
Be a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out. 

Re: jsp includes not compiling

Posted by Mike Peremsky <mp...@yahoo.com>.
Oops. I missed that. Thx

David Smith <dn...@cornell.edu> wrote:  You are already in a pair when you do GlobalConst.SO_LOGIN_OBJ %>. Why?

Seems to me this would be a better expression:

LoginObject loginobj = (LoginObject)session.getAttribute( 
GlobalConst.SO_LOGIN_OBJ )
%>

--David

Mike Peremsky wrote:
> I have used jsp includes with weblogic with no problems, I am using the same format of the code with Tomcat but am having issues.
> 
> I include the jsp as follows:
> 
> 
>
> 
> The code in the inc file is:
> 
> 
> 
> >   LoginObject loginobj = (LoginObject)session.getAttribute("");
> %>
> 
> 
> 
> The error I am getting is the following:
> 
> org.apache.jasper.JasperException: Unable to compile class for JSP: 
> An error occurred at line: 5 in the jsp file: /include/JspVariables.inc
> String literal is not properly closed by a double-quote
> 2: 
> 3: 
> 4: > 5:   LoginObject loginobj = (LoginObject)session.getAttribute("");
> 6: %>
>
> I also get other strange errors on other inc files, but am not yet sure if it is related to the fact that this variable is not being declared.
> 
> - Mike
>
> 
> ---------------------------------
> No need to miss a message. Get email on-the-go 
> with Yahoo! Mail for Mobile. Get started.
> 


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org



  
---------------------------------
Looking for earth-friendly autos? 
 Browse Top Cars by "Green Rating" at Yahoo! Autos' Green Center.  

Re: jsp includes not compiling

Posted by David Smith <dn...@cornell.edu>.
You are already in a <% ... %> pair  when you do <%= 
GlobalConst.SO_LOGIN_OBJ %>.  Why?

Seems to me this would be a better expression:

<%
LoginObject loginobj = (LoginObject)session.getAttribute( 
GlobalConst.SO_LOGIN_OBJ )
%>

--David

Mike Peremsky wrote:
> I have used jsp includes with weblogic with no problems, I am using the same format of the code with Tomcat but am having issues.
>    
>   I include the jsp as follows:
>    
>   <%@ include file="/include/JspVariables.inc" %>
>
>    
>   The code in the inc file is:
>    
>   <%@ page import="com.drafthappy.GlobalConsts" %>
> <%@ page import="com.drafthappy.dataobject.LoginObject" %>
>   <%
>   LoginObject loginobj = (LoginObject)session.getAttribute("<%= GlobalConsts.SO_LOGIN_OBJ %>");
> %>
>    
>    
>    
>   The error I am getting is the following:
>    
>   org.apache.jasper.JasperException: Unable to compile class for JSP: 
>   An error occurred at line: 5 in the jsp file: /include/JspVariables.inc
> String literal is not properly closed by a double-quote
> 2: <%@ page import="com.drafthappy.dataobject.LoginObject" %>
> 3: 
> 4: <%
> 5:   LoginObject loginobj = (LoginObject)session.getAttribute("<%= GlobalConsts.SO_LOGIN_OBJ %>");
> 6: %>
>
>   I also get other strange errors on other inc files, but am not yet sure if it is related to the fact that this variable is not being declared.
>    
>   - Mike
>
>  
> ---------------------------------
> No need to miss a message. Get email on-the-go 
> with Yahoo! Mail for Mobile. Get started.
>   


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org