Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 608
  • Last Modified:

JSP @ page import question

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
FrostyGirl
Asked:
FrostyGirl
  • 17
  • 16
1 Solution
 
FrostyGirlAuthor Commented:
I suppose my basic question is:  Is there a type of master config file that I can edit?
0
 
rrzCommented:
><%@ 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
 
rrzCommented:
>create a simple test JSP file and put it into your web2 folder.  
and name the file   test.jsp
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
FrostyGirlAuthor Commented:
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
 
FrostyGirlAuthor Commented:
Okay, so I've found and know what the WEB-INF/web.xml file does.  Still no help.  
0
 
rrzCommented:
Which JSP container are you using ?
0
 
FrostyGirlAuthor Commented:
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
 
rrzCommented:
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
 
rrzCommented:
>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
 
FrostyGirlAuthor Commented:
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
 
rrzCommented:
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
 
FrostyGirlAuthor Commented:
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
 
FrostyGirlAuthor Commented:
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
 
FrostyGirlAuthor Commented:
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
 
FrostyGirlAuthor Commented:
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
 
rrzCommented:
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
 
FrostyGirlAuthor Commented:
<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
 
rrzCommented:
Yes add a <Host> tag for your new web app web2
0
 
FrostyGirlAuthor Commented:
Do I have to make a new <Host> name?  

<Host name="localhost2" appBase=webapps">  ???
0
 
rrzCommented:
But I think it needs a different name.
0
 
rrzCommented:
yes
0
 
FrostyGirlAuthor Commented:
I can't make changes to the server.xml file.  Won't let me simply by trying to edit the file.  
0
 
rrzCommented:
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
 
rrzCommented:
I can't make changes to the server.xml file.  
Do you have permissions ?
0
 
FrostyGirlAuthor Commented:
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
 
FrostyGirlAuthor Commented:
I don't have permissions.  I've tried changing the permissions... no dice.  I tried stopping the apache server.... also didn't work.
0
 
rrzCommented:
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
 
rrzCommented:
>I tried stopping the apache server....  
Stopping Tomcat should be a separate command.
What is your hosting provider ?
0
 
FrostyGirlAuthor Commented:
RimuHosting.com
0
 
FrostyGirlAuthor Commented:
This is the webadmin control panel I'm dealing with:
http://rimuhosting.com/images/webminservices.jpg
0
 
rrzCommented:
You should delete(or rewrite) your lastest question. You are trying add a Context not a Host.
Meanwhile I am looking at Rimu
0
 
rrzCommented:
Look at  
http://rimuhosting.com/tomcat.jsp   
on that page we see  that you have to go to the command line
0
 
rrzCommented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 17
  • 16
Tackle projects and never again get stuck behind a technical roadblock.
Join Now