• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem with bean  RSS feed

 
trinadh reddy
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have a jsp file and sample javabean.iam not able to trace the exact problem.please see this
tax.jsp
<HTML>
<HEAD>
<TITLE>
Tax Rate
</TITLE>
</HEAD>

<BODY>

<%@ page language="java" %>

<jsp:useBean id="taxbean" scope="session" class="tax.TaxRate" />

<% taxbean.setState("NJ");
taxbean.setRate(6.5);
%>

<b> Using method 1:</b> <p>
State is: <%= taxbean.getState() %> <br>
Rate is: <%= taxbean.getRate() %>

<p>
<% taxbean.setState("TX");
taxbean.setRate(5.5);
%>

<b> Using method 2:</b> <p>
State is: <jsp:getProperty name="taxbean" property="State" />
<br>
Rate is: <jsp:getProperty name="taxbean" property="Rate" />

</BODY>
</HTML>
TaxRate.java

package tax;

public class TaxRate {

String State;
double Rate;

public TaxRate() {
this.State = "NY";
this.Rate = 8.5;
}

public void setState (String stateName) {
this.State = stateName;
}

public String getState() {
return (this.State);
}

public void setRate (double rateValue) {
this.Rate = rateValue;
}

public double getRate () {
return (this.Rate);
}
}

my application is in bean2\tax.jsp
bean2\WEB-INF\classes\tax\TaxRate.class
bean2\WEB-INF\web.xml

iam unable to trace the problem.when iam accessing tax.jsp it is giving 404 error
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A 404 error means that the page can't be found.
Where is your JSP?
What is the address you are using when trying to access it.
 
trinadh reddy
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
iam accessing tax.jsp
i have created war file as tax.war
jar -cvf tax.war .
http:\\localhost:7001\tax\tax.jsp
 
trinadh reddy
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the first program i have specified is tax.jsp
 
Balaji Chopparapu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems to me that your web application context is bean2. I think you should access your jsp in this manner http:\\localhost:7001\bean2\tax.jsp
 
Raghu Shree
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
where did you stored your jsp file. In tomcat root folder name is treated as context name in default. if you store your jsp file under bean2 folder try to like this http://localhost ortno/bean2/tax.jsp. Or try to change the tax.jsp to index.jsp. Because index.xxx file is default startup file if you enter http://localhost:7001/bean2.

Hope this will helps you.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!