473,322 Members | 1,719 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

JSP import problem

ashsa
45
Hi,

I am using this statement exactly in my JSP page.
Expand|Select|Wrap|Line Numbers
  1. <%@ page import="java.util.*, java.lang.*" %>
But when i view the equivalent servlet generated, it is like this :
Expand|Select|Wrap|Line Numbers
  1. import java.util.*; //[ /hrms/budgetsAndCosts_HRMS.jsp; Line: 1]
  2. import java.lang.*; //[ /hrms/budgetsAndCosts_HRMS.jsp; Line: 1]
  3.  
And the second import is always getting to the end of the first import statement so that it is also included as a part of the single line comment '//'. This happens with all the JSP imports.

Could anyone figure out where the problem lies ... Its really urgent.

Many Thanks for any help .
May 24 '07 #1
17 8293
dmjpro
2,476 2GB
what's the problem with the conversion?????

kind regards.
dmjpro.
May 24 '07 #2
r035198x
13,262 8TB
Hi,

I am using this statement exactly in my JSP page.
Expand|Select|Wrap|Line Numbers
  1. <%@ page import="java.util.*, java.lang.*" %>
But when i view the equivalent servlet generated, it is like this :
Expand|Select|Wrap|Line Numbers
  1. import java.util.*; //[ /hrms/budgetsAndCosts_HRMS.jsp; Line: 1]
  2. import java.lang.*; //[ /hrms/budgetsAndCosts_HRMS.jsp; Line: 1]
  3.  
And the second import is always getting to the end of the first import statement so that it is also included as a part of the single line comment '//'. This happens with all the JSP imports.

Could anyone figure out where the problem lies ... Its really urgent.

Many Thanks for any help .
Are you getting an error then?
May 24 '07 #3
ashsa
45
what's the problem with the conversion?????

kind regards.
dmjpro.

The second import statement gets to the end of the first one like

Expand|Select|Wrap|Line Numbers
  1. import java.util.*; //[ /hrms/budgetsAndCosts_HRMS.jsp; Line: 1]#import java.lang.*; //[ /hrms/budgetsAndCosts_HRMS.jsp; Line: 1]
so that the second one is always commented along with the comment of the first import statement with a special character (shown as a square in my editor)
inserted at the place where you see '#' here. Thus only the class being imported first is being imported and it raises an error when there is a reference to the classes imported second or later .


Hope thats clearer ..
May 24 '07 #4
dmjpro
2,476 2GB
now what 's ur headache with these comment lines???

r u trying to do something which is not due to these unexpected comment lines????


kind regards.
dmjpro.
May 24 '07 #5
r035198x
13,262 8TB
The second import statement gets to the end of the first one like

Expand|Select|Wrap|Line Numbers
  1. import java.util.*; //[ /hrms/budgetsAndCosts_HRMS.jsp; Line: 1]#import java.lang.*; //[ /hrms/budgetsAndCosts_HRMS.jsp; Line: 1]
so that the second one is always commented along with the comment of the first import statement with a special character (shown as a square in my editor)
inserted at the place where you see '#' here. Thus only the class being imported first is being imported and it raises an error when there is a reference to the classes imported second or later .


Hope thats clearer ..
Do you get an error when you run your JSP?
May 24 '07 #6
ashsa
45
now what 's ur headache with these comment lines???

r u trying to do something which is not due to these unexpected comment lines????


kind regards.
dmjpro.
If this is the import statement in the JSP page,

Expand|Select|Wrap|Line Numbers
  1. <%@ import="java.util.Date,java.util.Calendar" %>
the servlet generated shows it like

Expand|Select|Wrap|Line Numbers
  1. import java.util.Date; //[ test.jsp; Line: 1]import java.util.Vector; //[ test.jsp; Line: 1]
So, only Date is imported and not the Vector.
The second import is commented after
Expand|Select|Wrap|Line Numbers
  1. import java.util.Date;
as

Expand|Select|Wrap|Line Numbers
  1. //[ test.jsp; Line: 1]import java.util.Vector; //[ test.jsp; Line: 1]
May 24 '07 #7
ashsa
45
Do you get an error when you run your JSP?
I get the error when am referring to the class which comes in the second import statement. Since the second import is commented along with the first import's sidenote, its not imported at all..

Thanks for any Help
May 24 '07 #8
r035198x
13,262 8TB
I get the error when am referring to the class which comes in the second import statement. Since the second import is commented along with the first import's sidenote, its not imported at all..

Thanks for any Help
Which error did you get specifically?
May 24 '07 #9
dmjpro
2,476 2GB
why did not u tell the particualr problem before?????

it does not happen to me.
i m using Oracle Jdeveloper for JSP Editor.
what r u using????

if this happens to u then change it into one packege import instead of more that one packge or class import.

one more thing i want to mention that directly come to the point.... instead of complicating the problem..
and i hope u ll not do that again.
have a good day.

kind regards.
dmjpro.
May 24 '07 #10
JosAH
11,448 Expert 8TB
I get the error when am referring to the class which comes in the second import statement. Since the second import is commented along with the first import's sidenote, its not imported at all..

Thanks for any Help
I suspect it's just an editor problem; my guess is that those lines are just
terminated by a newline '\n' character and your editor chokes on it. If your
JSP runs fine I am right; if it doesn't there's a nasty bug somewhere in your
JSP compiler.

My JSP is more than rusty. Is it allowed to import more than one package
using a comma as a package name separator? Can you import those packages
using separate import statements, one of each package? Does it run then?

kind regards,

Jos
May 24 '07 #11
ashsa
45
Which error did you get specifically?
cannot resolve symbol
May 24 '07 #12
ashsa
45
why did not u tell the particualr problem before?????

it does not happen to me.
i m using Oracle Jdeveloper for JSP Editor.
what r u using????

if this happens to u then change it into one packege import instead of more that one packge or class import.

one more thing i want to mention that directly come to the point.... instead of complicating the problem..
and i hope u ll not do that again.
have a good day.

kind regards.
dmjpro.
Very sorry for not being clear ..
After some hours of head break on it found that the error has been due to a missing new keyword somewhere .. Now thats working fine ...


And Thanks a lot your valuable concern.. Am using Editplus trial version and it shows the newline characters as unidentified chars..
May 24 '07 #13
ashsa
45
I suspect it's just an editor problem; my guess is that those lines are just
terminated by a newline '\n' character and your editor chokes on it. If your
JSP runs fine I am right; if it doesn't there's a nasty bug somewhere in your
JSP compiler.

My JSP is more than rusty. Is it allowed to import more than one package
using a comma as a package name separator? Can you import those packages
using separate import statements, one of each package? Does it run then?

kind regards,

Jos
Your suspicion about my editor is cent percent correct. My editplus trial version shows newlines as squares.. atleast that it shows !!

Regarding the import statement, its always valid to import more than one package using a comma as a package name separator. And as i understand theres hardly any difference between importing watever u want through a single import and importing one through each statement.

Many Thanks for the support ..
May 24 '07 #14
JosAH
11,448 Expert 8TB
Regarding the import statement, its always valid to import more than one package using a comma as a package name separator. And as i understand theres hardly any difference between importing watever u want through a single import and importing one through each statement.

Many Thanks for the support ..
Ok, so we skip the editor for now as a cause (download vim instead!). Do your
JSPs work when you use separate import statements, one for each package?
(note that you never need to import java.lang.*, i.e. it's "self-imported" by javac).

If separate import statements do work, you're most probably facing a bug in
the JSP compiler. Which one are you using and what version?

kind regards,

Jos
May 24 '07 #15
r035198x
13,262 8TB
Ok, so we skip the editor for now as a cause (download vim instead!). Do your
JSPs work when you use separate import statements, one for each package?
(note that you never need to import java.lang.*, i.e. it's "self-imported" by javac).

If separate import statements do work, you're most probably facing a bug in
the JSP compiler. Which one are you using and what version?

kind regards,

Jos
I think they said the problem is resolved now Jos.
Said it was a missing keyword somewhere and so the problem had nothing to do with the import statements.
May 24 '07 #16
JosAH
11,448 Expert 8TB
I think they said the problem is resolved now Jos.
Said it was a missing keyword somewhere and so the problem had nothing to do with the import statements.
I still consider that a bug in the JSP compiler. If somewhere else a keyword is
missing the imports goof up without a warning or whatever. It once again shows
why I don't like that entire web mess ;-)

kind regards,

Jos
May 24 '07 #17
r035198x
13,262 8TB
I still consider that a bug in the JSP compiler. If somewhere else a keyword is
missing the imports goof up without a warning or whatever. It once again shows
why I don't like that entire web mess ;-)

kind regards,

Jos
Yeah the generated code should have the import statements right for the final class to be created correctly. Unless there's another file somewhere with the correct code ...
May 24 '07 #18

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: John Roth | last post by:
I've found a case where it seems that Python is importing two copies of a module without any reason or indication. It took me a while to verify that this is what is occuring: I had to write a...
5
by: Steve Holden | last post by:
This is even stranger: it makes it if I import the module a second time: import dbimp as dbimp import sys if __name__ == "__main__": dbimp.install() #k = sys.modules.keys() #k.sort() #for...
2
by: Jon | last post by:
It appears that (windows) python searches in the current working directory before looking in the local site-packages directory, or that '.' comes first in sys.path? The problem arises when I made...
2
by: Panard | last post by:
Hi, I'm experiencing a strange problem while trying to manage a ftp connection into a separate thread. I'm on linux, python 2.4.3 Here is a test : ------ ftp_thread.py ------ import ftplib...
6
by: robert | last post by:
I get python crashes and (in better cases) strange Python exceptions when (in most cases) importing and using cookielib lazy on demand in a thread. It is mainly with cookielib, but remember the...
1
by: Nick Craig-Wood | last post by:
I've been dumping a database in a python code format (for use with Python on S60 mobile phone actually) and I've noticed that it uses absolutely tons of memory as compared to how much the data...
0
by: Victor Lin | last post by:
Hi, I got some problem with import. I have some python file that should be executed. Something like unit-test or other small tool. The project is not so small. So I want to separate these files...
5
by: Stef Mientki | last post by:
hello, The import statement "import sqlite3" gives the error given below. In simple programs, the import statement (sometimes) succeed, and I can indeed access the database. So I guess there is...
10
by: nisp | last post by:
Hi all ! I'm trying to capture stderr of an external module I use in my python program. I'm doing this by setting up a class in my module overwriting the stderr file object method write. The...
13
by: Rafe | last post by:
Hi, I am in a situation where I feel I am being forced to abandon a clean module structure in favor of a large single module. If anyone can save my sanity here I would be forever grateful. My...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.