Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Path issue Please help 1

Status
Not open for further replies.

libaax

Technical User
Jul 22, 2003
38
US
I've had it with tomcat. I've never seen an application with reverse logic with respect to path. and which has so many diffent loops and settings to fidle with...

Here is the main problem now:
intallation: three test files to work with...
GetName.html, SaveName.jsp in:
e:\tomcat4.1\webapps\root
userData.class bean class not in a package
e:\tomcat4.1\webapps\root\web-inf\classes

I'm apple to access the html page @ the problem is <jsp:useBean> reference is not able to find the userData bean class .... see the error below ....what should I do in order to get the bean to be visible to the jsp page?



type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
[javac] Since fork is true, ignoring compiler setting.
[javac] Compiling 1 source file
[javac] Since fork is true, ignoring compiler setting.
[javac] E:\Tomcat 4.1\work\Standalone\localhost\_\SaveName_jsp.java:41: cannot resolve symbol
[javac] symbol : class UserData
[javac] location: class org.apache.jsp.SaveName_jsp
[javac] UserData user = null;
[javac] ^
[javac] E:\Tomcat 4.1\work\Standalone\localhost\_\SaveName_jsp.java:43: cannot resolve symbol
[javac] symbol : class UserData
[javac] location: class org.apache.jsp.SaveName_jsp
[javac] user = (UserData) pageContext.getAttribute(&quot;user&quot;, PageContext.SESSION_SCOPE);
[javac] ^
[javac] E:\Tomcat 4.1\work\Standalone\localhost\_\SaveName_jsp.java:46: cannot resolve symbol
[javac] symbol : class UserData
[javac] location: class org.apache.jsp.SaveName_jsp
[javac] user = (UserData) java.beans.Beans.instantiate(this.getClass().getClassLoader(), &quot;UserData&quot;);
[javac] ^
[javac] 3 errors
 
You have not posted the <jsp:useBean> code that causes the error. Also post the class declaration line for UserData and all of it’s constructor signatures.


-pete
 
ok...I'm gonna do that below...Please mension if I'm required to edit web.xml for sol porpose of the running the code also comment about what specific directories each file should be placed respectively...

thanks, Omar

<code>
public class UserData {
String username;
String email;
int age;

public void setUsername( String value )
{
username = value;
}

public void setEmail( String value )
{
email = value;
}

public void setAge( int value )
{
age = value;
}

public String getUsername() { return username; }

public String getEmail() { return email; }

public int getAge() { return age; }
}
-------------------------------------------
<HTML>
<BODY>
<FORM METHOD=POST ACTION=&quot;/SaveName.jsp&quot;>
What's your name? <INPUT TYPE=TEXT NAME=username SIZE=20><BR>
What's your e-mail address? <INPUT TYPE=TEXT NAME=email SIZE=20><BR>
What's your age? <INPUT TYPE=TEXT NAME=age SIZE=4>
<P><INPUT TYPE=SUBMIT>
</FORM>
</BODY>
</HTML>
 
Here is the jsp that caused the error as well..


<jsp:useBean id=&quot;user&quot; class=&quot;UserData&quot; scope=&quot;session&quot;>
<jsp:setProperty name=&quot;user&quot; property=&quot;*&quot;/>
</jsp:useBean>
<HTML>
<BODY>
<A HREF=&quot;/NextPage.jsp&quot;>Continue</A>
</BODY>
</HTML>
 
Yeah, i don't know if non-namspaced classes are supported. They used to be but perhaps not anymore. I received the same error with your original code. Then a put the class in a package modifying the code as below and the compile error was eliminated.
Code:
package mypak;

public class UserData {
...

Then the jsp:
Code:
<jsp:useBean id=&quot;user&quot; class=&quot;mypak.UserData&quot; scope=&quot;session&quot;>

-pete
 
Thanks Pete ...thanks a million.....
I'm still having jsp compile error due to unreachable...Please comment on which relative folder each file should be placed, wether or not I should fiddle with web.xml and if path could be the issue...
 
Naah...u r right it works.. But, the problem is NextPage is displaying null ..instead of the info intered in the form...I checked the session scope and it's not the problem. I'm thinking that may be NextPage.jsp and SaveName.jsp are accessing two different instances of the bean.....
 
>> I'm thinking that may be NextPage.jsp and SaveName.jsp
>> are accessing two different instances of the bean.....

Not if both pages are in the same application and both jsp:useBean tags are identical. I use that all the time and it has never failed.


-pete
 
I got it pete.....stupid me :(...I so happened that I rebooted the system and IIS started blocking port 80...... I had it figured out too late man...! I was so dump founded by simple ety pety thing like that. Thanks for all the help though ...u r my hero in the house. [thumbsup]


Libaax
Hakuna Matata....;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top