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
  • Devaka Cooray
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Jeanne Boyarsky
  • Tim Cooke
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
Bartenders:

regarding scriptlets

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
hi...
i am trying to develop a web client using jsp... am using Apache... i tried to run a sample jsp file... the content is as follows...

<HTML>
<BODY>
Hello! The time is now <%= new java.util.Date() %>
</BODY>
</HTML>

but even this simple file is not executing properly... the output displays only "Hello! The time is now " and not the date.. anything inside <% %> is not getting recognized... have similar problem with my other jsp files...

thanks in advance.. a quick reply would help a lot...
 
Sheriff
Posts: 67735
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:
  • Report post to moderator
Apache is not a JSP engine.
 
shanu jain
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
k thanks.. but the same code din work even when i tried running with the tomcat server... any idea why?? i even set the path for my java files..
 
Bear Bibeault
Sheriff
Posts: 67735
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:
  • Report post to moderator
If you've got Tomcat set up correctly it should work without difficulty. There is a Tomcat forum for Tomcat setup questions.
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
What is your file called ?
 
shanu jain
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
hi..
its called sample.jsp
is there some limitation like a jsp file can be run only by an initial call from a html file??
and some limitation on where the jsp files need to be saved??
thanks a lot for all ur help!!
 
Bear Bibeault
Sheriff
Posts: 67735
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:
  • Report post to moderator

Originally posted by shanu jain:

and some limitation on where the jsp files need to be saved??



Well of course your web app needs to be properly formed.

thanks a lot for all ur help!!



Please show your appreciation by dropping the use of abbreviations such as "ur" and spelling out the entire word. Thanks.
 
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi

Try this in tomcat



bye for now
sat
 
satishkumar janakiraman
Ranch Hand
Posts: 334
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,

I forgot to add the following in your code. Change your code like this



bye for now
sat
 
Bear Bibeault
Sheriff
Posts: 67735
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:
  • Report post to moderator
No, I suggest not doing that. Not only is using the <%! a dangerous habit to get into, it's immaterial to the problem. If the original JSP isn't working (what does that mean, by the way), the suggested JSP isn't going to either.
 
author
Posts: 288
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator


The above code should work.


The following code is not threadsafe and not recommended.




The Date variable "d" will become a member (aka instance) variable in the converted servlet. if you take the ! mark out, then it becomes a local variable.
 
shanu jain
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
hi everybody..
thanks a lot for all YOUR help.. the problem was that i had set the JAVA_HOME variable to my j2sdk1.5.0_06.. guess tomcat does not support this.. after setting it to j2sdk1.4.2_03, the sample.jsp file ran without any problem.. could anybody help me with database connection(mysql) from a jsp file..?? is there any classpath that needs to be set?? any other pre-requisites needed?? tried setting the classpath to my mysql jar file, does not help..
got an error like the one stated below when i ran my jsp file..
java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
 
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Its better to raise another thread in JDBC Forum.
 
The moth suit and wings road is much more exciting than taxes. Or this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
    Bookmark Topic Watch Topic
  • New Topic