?
Solved

JSP @ page import question

Posted on 2010-11-18
33
Medium Priority
?
583 Views
Last Modified: 2012-05-10
Hi,

I've been tasked with creating a dev site of an exiting JSP site.  So I'm going to make a www2 of the main site.  I'm brand new to JSP... I'm very proficient in ColdFusion.  So my first of many basic questions is this:

I duplicated the site but the pathing for java is now wrong.  The old site points to a folder called 'web'.  The new (dev) site points to a folder called web2.  How do I change the java (jsp) pathing?

In the index page I see the following code:
<%@ page import="com.monumental.trampoline.component.*" %>
<%@ page import="com.monumental.trampoline.navigation.*" %>

Can I hook into this site using Eclipse, and then start working with all this code?

Thanks ss very very very much.  ~Wendi
0
Comment
Question by:FrostyGirl
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 17
  • 16
33 Comments
 

Author Comment

by:FrostyGirl
ID: 34164427
I suppose my basic question is:  Is there a type of master config file that I can edit?
0
 
LVL 28

Expert Comment

by:rrz
ID: 34165197
><%@ page import="com.monumental.trampoline.component.*" %>
><%@ page import="com.monumental.trampoline.navigation.*" %>  
These lines tell java where to look for the class files that the JSP uses.

Are you using something like
http://www2.mydomain.com 
in your browser ?  
If so, then create a simple test JSP file and put it into your web2 folder.
Try to access it with
http://www2.mydomain.com/test.jsp 
What happens ?
You could read  
http://download.oracle.com/javaee/5/tutorial/doc/bnadx.html 
0
 
LVL 28

Expert Comment

by:rrz
ID: 34165212
>create a simple test JSP file and put it into your web2 folder.  
and name the file   test.jsp
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:FrostyGirl
ID: 34165335
I received this:  The requested resource (/test.jsp) is not available.  404 test.jsp.  However, if I change the file extension to test.html then the page is found.
0
 

Author Comment

by:FrostyGirl
ID: 34165482
Okay, so I've found and know what the WEB-INF/web.xml file does.  Still no help.  
0
 
LVL 28

Expert Comment

by:rrz
ID: 34165490
Which JSP container are you using ?
0
 

Author Comment

by:FrostyGirl
ID: 34165522
No idea.  I'm reading tutorials now and other than knowing what a JSP container is (the theory of it), I know nothing more about them.
0
 
LVL 28

Expert Comment

by:rrz
ID: 34165575
Does the original site still work ?  Can you add a JSP to it ? If you can, then try running this page.
Server is <%= application.getServerInfo()%><br/> 
JSP version is <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion()%><br/> 
Servlet API is <%= application.getMajorVersion()%>.<%=application.getMinorVersion()%>
${"Hello JSP 2"}

Open in new window

0
 
LVL 28

Expert Comment

by:rrz
ID: 34165615
>Can I hook into this site using Eclipse, and then start working with all this code?
You can create a new Web project and copy your code into it. After making changes you and publish to server.
0
 

Author Comment

by:FrostyGirl
ID: 34166245
Results from running the code you provided:

Server is Apache Tomcat/5.0.28
JSP version is 2.0
Servlet API is 2.4 Hello JSP 2
0
 
LVL 28

Expert Comment

by:rrz
ID: 34166517
Ok, Tomcat is your JSP container.  
>I received this:  The requested resource (/test.jsp) is not available.  404 test.jsp.  
Did you get any other error messages ? Either in Tomcat's logs or Apache web server logs ?
>if I change the file extension to test.html then the page is found.  
Also try changing the name to something else. For instance if you change to  test.java  then the browser should ask you if you want to download the file.
0
 

Author Comment

by:FrostyGirl
ID: 34166680
Result from changing file name to test.java (on original server):

The page didn't download, it displayed this code (using chrome):

Server is <%= application.getServerInfo()%><br/>
JSP version is <%= JspFactory.getDefaultFactory().getEngineInfo().getSpecificationVersion()%><br/>
Servlet API is <%= application.getMajorVersion()%>.<%=application.getMinorVersion()%>
${"Hello JSP 2"}
0
 

Author Comment

by:FrostyGirl
ID: 34166720
running test.java on the new site instance (www2) resulted in this error (there was no page rendering below the error statement):

This page contains the following errors:

error on line 2 at column 2: StartTag: invalid element name
Below is a rendering of the page up to the first error.
0
 

Author Comment

by:FrostyGirl
ID: 34166746
More detailed error message for test.java  :::


The XML page cannot be displayed
Cannot view XML input using XSL style sheet. Please correct the error and then click the Refresh button, or try again later.


--------------------------------------------------------------------------------

A name was started with an invalid character. Error processing resource 'http://www2.website.com/test.java'. Line 2, Pos...

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
-^
0
 

Author Comment

by:FrostyGirl
ID: 34166762
another example of www2 acting not as expected.

I have a page index3.jsp.  On www2 that page isn't found:  The requested resource (/index3.jsp) is not available.  But if I change the extension to .java, then the page is found and simply displays all of its code in the browser
0
 
LVL 28

Expert Comment

by:rrz
ID: 34166868
You should add the Apache Web Server zone to this question(as you did for your previous questions. Maybe one of those Apache experts can help you.  
Meanwhile look for a file called   server.xml  
It could be at  
 /usr/local/tomcat/conf/server.xml  
If you find it, then show us any <Host> tags in it.
0
 

Author Comment

by:FrostyGirl
ID: 34166976
<Host name="localhost" appBase="webapps">
<Context path="" docBase="/home/www/wwwwebsite.com/web" debug="1" reloadable="true" crossContext="false">
...........
 </context>
</host>

Can I add another host?  So it would be
<Host name="localhost" appBase="webapps">
<Context path="" docBase="/home/www/wwwwebsite.com/web2"
0
 
LVL 28

Expert Comment

by:rrz
ID: 34167023
Yes add a <Host> tag for your new web app web2
0
 

Author Comment

by:FrostyGirl
ID: 34167045
Do I have to make a new <Host> name?  

<Host name="localhost2" appBase=webapps">  ???
0
 
LVL 28

Expert Comment

by:rrz
ID: 34167058
But I think it needs a different name.
0
 
LVL 28

Expert Comment

by:rrz
ID: 34167059
yes
0
 

Author Comment

by:FrostyGirl
ID: 34167245
I can't make changes to the server.xml file.  Won't let me simply by trying to edit the file.  
0
 
LVL 28

Expert Comment

by:rrz
ID: 34167411
No, I am wrong. You should only one <Host> tag. Please leave the Host tag as it was before.
It is <Context> tag that should have another tag.

<Host name="localhost" appBase="webapps">
<Context path="" docBase="/home/www/wwwwebsite.com/web" debug="1" reloadable="true" crossContext="false">
...........
 </context>
<Context path="web2" docBase="/home/www/wwwwebsite.com/web2" debug="1" reloadable="true" crossContext="false">
...........
 </context>
</host>

Restart Tomcat.
Now try to browse to  http://www2.website.com/web2/test.jsp
0
 
LVL 28

Expert Comment

by:rrz
ID: 34167431
I can't make changes to the server.xml file.  
Do you have permissions ?
0
 

Author Comment

by:FrostyGirl
ID: 34167443
Will do... as soon as i can figure out a way to edit the server.xml file.  I'm accessing remotely and the only tools I currently have are a controlPanel or trying to overwrite the file... which isn't working.
0
 

Author Comment

by:FrostyGirl
ID: 34167453
I don't have permissions.  I've tried changing the permissions... no dice.  I tried stopping the apache server.... also didn't work.
0
 
LVL 28

Accepted Solution

by:
rrz earned 2000 total points
ID: 34167470
I made another error(forgot / in path). Should be  
<Host name="localhost" appBase="webapps">
<Context path="" docBase="/home/www/wwwwebsite.com/web" debug="1" reloadable="true" crossContext="false">
...........
 </context>
<Context path="/web2" docBase="/home/www/wwwwebsite.com/web2" debug="1" reloadable="true" crossContext="false">
...........
 </context>
</host>

Restart Tomcat.
Now try to browse to  http://www2.website.com/web2/test.jsp
0
 
LVL 28

Expert Comment

by:rrz
ID: 34167498
>I tried stopping the apache server....  
Stopping Tomcat should be a separate command.
What is your hosting provider ?
0
 

Author Comment

by:FrostyGirl
ID: 34167515
RimuHosting.com
0
 

Author Comment

by:FrostyGirl
ID: 34167533
This is the webadmin control panel I'm dealing with:
http://rimuhosting.com/images/webminservices.jpg
0
 
LVL 28

Expert Comment

by:rrz
ID: 34167554
You should delete(or rewrite) your lastest question. You are trying add a Context not a Host.
Meanwhile I am looking at Rimu
0
 
LVL 28

Expert Comment

by:rrz
ID: 34167623
Look at  
http://rimuhosting.com/tomcat.jsp   
on that page we see  that you have to go to the command line
0
 
LVL 28

Expert Comment

by:rrz
ID: 34167705
I think the commands are
/etc/init.d/tomcat stop
and
/etc/init.d/tomcat start  

Are you able to find the command line ? I can't remember where it is located. Keep poking around in Webmin for the command shell.
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The core idea of this article is to make you acquainted with the best way in which you can export Exchange mailbox to PST format.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question