473,734 Members | 2,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Http status 404 error in struts!!

283 Contributor
hi frnds,
the situation is im developing a web application in struts--
my specifications-eclipse3.2.2,st ruts1.1,tomcat5 .5.23 mysql5.0 db.
the scenario-i have a jsp page which adds the records in the db.when the user clicks submit,a javascript gets fired and checks the validation.on submit the BdgMastAction.j ava does all the data access and forwards the control to a jsp named bdgm.jsp.the results are displayed in the jsp.the values are stored in a java bean for the views to display it.
the problem is when i click on submit Http Status 404 error shows up,also there is nothing in the stack trace that conveys the error.
herrz my code

BdgMastAction.j ava

Expand|Select|Wrap|Line Numbers
  1. package publicity;
  2. import java.io.IOException;
  3. import java.io.PrintWriter;
  4. import java.sql.Connection;
  5. import java.sql.DriverManager;
  6. import java.sql.PreparedStatement;
  7. import java.sql.SQLException;
  8. import java.sql.SQLWarning;
  9. import java.sql.Statement;
  10.  
  11. import javax.sql.DataSource;
  12. import javax.servlet.ServletResponse;
  13. import javax.servlet.http.HttpServletRequest;
  14. import javax.servlet.http.HttpServletResponse;
  15. import javax.sql.*;
  16. import org.apache.struts.action.Action;
  17. import org.apache.struts.action.ActionError;
  18. import org.apache.struts.action.ActionMapping;
  19. import org.apache.struts.action.ActionErrors;
  20. import org.apache.struts.action.ActionForm;
  21. import org.apache.struts.action.ActionForward;
  22. import org.apache.struts.action.ActionServlet;
  23.  
  24. import com.mysql.jdbc.ResultSet;
  25.  
  26. public class BdgMastAction extends Action 
  27. {
  28.     private Connection con;
  29.     //private DataSource datasource=null;
  30.     private ResultSet resultset;
  31.     private PrintWriter out;
  32.     //DBConnect dbc=new DBConnect();
  33.  
  34.     public ActionForward execute(ActionMapping mapping,ActionForm form,
  35.             HttpServletRequest httpservletrequest,HttpServletResponse httpservletresponse)throws Exception
  36.     {
  37.  
  38.             //datasource=getDataSource(httpservletrequest);
  39.             //connection=datasource.getConnection();
  40.         try
  41.             {
  42.                 Class.forName("com.mysql.jdbc.Driver");
  43.             }
  44.             catch(ClassNotFoundException cnfe)
  45.             {
  46.                 System.out.println("coudnt load class com.mysql.jdbc.Driver"+ cnfe);
  47.  
  48.     }
  49.         BdgtMasForm bmf=(BdgtMasForm) form;
  50.         bmf.setBranch(httpservletrequest.getParameter("branch"));
  51.         bmf.setBudget(httpservletrequest.getParameter("budget"));
  52.         bmf.setOption(httpservletrequest.getParameter("option"));
  53.         bmf.setPublicity_Code(httpservletrequest.getParameter("publicity_code"));
  54.  
  55.  
  56.                 String s3=null;
  57.                 String s4 = "";
  58.                 String s2 = httpservletrequest.getParameter("option");
  59.                 s3 = httpservletrequest.getParameter("branch");
  60.                 s4 = httpservletrequest.getParameter("publicity_code");
  61.                 String s5 = httpservletrequest.getParameter("budget");
  62.  
  63.                 try
  64.                 {
  65.                     String s6 = "0";
  66.                     String s7 = "0";
  67.                     String s8 = "INSERT INTO Budget_Master(Branch,Publicity_Code,Budget_Alloted,Work_In_Progress,Amount_Paid) VALUES (?,?,?,?,?)";
  68.                     String s9 = "update budget_master set old_budget = budget_alloted where branch='" + s3 + "' and publicity_code=" + s4;
  69.                     String s10 = "UPDATE Budget_Master set budget_alloted=" + s5 + " where Branch='" + s3 + "' and publicity_code=" + s4;
  70.                     //datasource = "jdbc:odbc:budget";
  71.                     con = DriverManager.getConnection("jdbc:mysql://localhost:3306/publicity_db","db_user","test");
  72.                     int i = con.getTransactionIsolation();
  73.                     con.setTransactionIsolation(2);
  74.                     con.setAutoCommit(false);
  75.                     if("new".equalsIgnoreCase(s2))
  76.                     {
  77.                         PreparedStatement preparedstatement = con.prepareStatement(s8);
  78.                         preparedstatement.setString(1, s3);
  79.                         preparedstatement.setString(2, s4);
  80.                         preparedstatement.setString(3, s5);
  81.                         preparedstatement.setString(4, s7);
  82.                         preparedstatement.setString(5, s6);
  83.                         preparedstatement.executeUpdate();
  84.                         con.commit();
  85.                         preparedstatement.close();
  86.                     }
  87.                     if("update".equalsIgnoreCase(s2))
  88.                     {
  89.                         Statement statement = con.createStatement();
  90.                         statement.executeUpdate(s9);
  91.                         statement.executeUpdate(s10);
  92.                         con.commit();
  93.                     }
  94.                     con.setTransactionIsolation(2);
  95.  
  96.  
  97.                     con.close();
  98.                 }
  99.                 catch(SQLException sqlexception)
  100.                 {
  101.                     cleanUp();
  102.                     printSQLException(sqlexception);
  103.                 }
  104.                 out.flush();
  105.  
  106.                 return(mapping.findForward("bdgm"));
  107.  
  108.             }
  109.  
  110.  
  111.                 static void printSQLException(SQLException sqlexception)
  112.                 throws IOException
  113.             {
  114.                 System.out.print("<b>SQLException</b>\n<p>\n\n");
  115.                 for(; sqlexception != null; sqlexception = sqlexception.getNextException())
  116.                 {
  117.                     System.out.println("<b>SQLState:</b> " + sqlexception.getSQLState() + "<br>\n");
  118.                     System.out.println("<b>Message:</b> " + sqlexception.getMessage() + "<br>\n");
  119.                     System.out.println("<b>Vendor:</b> " + sqlexception.getErrorCode() + "<br>\n");
  120.                 }
  121.  
  122.             }
  123.  
  124.             String link(String s, String s1)
  125.             {
  126.                 return "<a href=\"" + s + "\">" + s1 + "</a>";
  127.             }
  128.  
  129.  
  130.             public void cleanUp()
  131.                 throws IOException
  132.             {
  133.                 if(con != null)
  134.                     try
  135.                     {
  136.                         out.print("Closing database connection");
  137.                         con.setTransactionIsolation(0);
  138.                         con.close();
  139.                         return;
  140.                     }
  141.                     catch(SQLException _ex)
  142.                     {
  143.                         return;
  144.                     }
  145.                 else
  146.  
  147.                    return;
  148.  
  149.  
  150.  
  151.  
  152.     }
  153.  
  154.  
  155. }
  156.  
  157.  
addbdgt.jsp(the first page where i enter the records)

[HTML]
<%@ page language="java" contentType="te xt/html; charset=ISO-8859-1"
pageEncoding="I SO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<html>
<head>
<title>Budget Master Administration</title>
<meta name="GENERATOR " content="Micros oft FrontPage 3.0">
<SCRIPT LANGUAGE="JavaS cript" SRC="bscript.js "></SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body topmargin="0" leftmargin="0" bgproperties="f ixed">
<div align="left">
<form name="arch" method="get" action="/BdgMastAction.d o">
<table border="0" width="100%">
<tr>
<td width="100%" bgcolor="#DFDFF F" background="ima ges/niceblue.gif">< font face="Tahoma"
color="#000000" ><strong>B u d g e t&nbsp;&nbsp; M a s t e r</strong></font></td>
</tr>
</table>
<div align="left">

<table width="60%" height="127">
<tr>
<td valign="top" width="50%" height="34"><st rong><small><fo nt face="Verdana"> </font></small></strong></td>
<td width="50%" height="34"></td>
</tr>
<tr>
<td valign="top" width="50%" height="27"><st rong><small><fo nt face="Verdana"> Branch</font></small></strong></td>
<td width="50%" height="27">
<input type=hidden name="option" value="new">
<p><select name="branch" size="1">
<option value="Bombay"> Bombay</option>
<option value="Delhi">D elhi</option>
<option value="Ahmedaba d">Ahmedabad </option>
<option value="Madras"> Madras</option>
<option value="Bangalor e">Bangalore </option>
<option value="Calcutta ">Calcutta</option>
<option value="Hyderaba d">Hyderabad </option>
<option value="Pune">Pu ne</option>
<option value="Lucknow" >Lucknow</option>
<option value="Jaipur"> Jaipur</option>
<option value="Patna">P atna</option>
<option value="Cochin"> Cochin</option>
<option value="Chandiga rh">Chandigar h</option>
<option value="Bhopal"> Bhopal</option>
</select></p>
</td>
</tr>
<tr>
<td width="50%" height="25"><st rong><small><fo nt face="Verdana"> Publicity Code </font></small></strong></td>
<td width="50%" height="25"><in put type="text" size="5" maxlength="5"
name="publicity _code"></td>
</tr>
<tr>
<td width="50%" height="25"><st rong><small><fo nt face="Verdana"> Annual Budget Alloted (<em>Rs</em>)</font></small></strong></td>
<td width="50%" height="25"><in put type="text" size="10" maxlength="10" name="budget"></td>
</tr>
</table>
</div>

<p align="left"><i nput type="button" name="thesubmit " value="Submit"
onclick="everyt hing(form)">&nb sp; </p>

<hr>
<strong><small> <font color="#0080C0" >

<p align="center"> ©</font><font color="#0080C0" face="Verdana"> Response - Corporate
1998-1999</font></small></strong>
</form>
</div>

</body>
</html>
[/HTML]

struts-config.xml
<form-bean

name="BdgtMasFo rm"

type="publicity .BdgtMasForm"/>

<action-mappings>
<!-- Default "Welcome" action -->

<!-- Forwards to Welcome.jsp -->
<action

path="/index"

type="org.apach e.struts.action s.ForwardAction "

parameter="/index.jsp"/>

<action

path="/bdgm"

type="org.apach e.struts.action s.ForwardAction "

parameter="/pages/serview/bdgm.jsp"/>

<action

path="/addbdgt"

type="org.apach e.struts.action s.ForwardAction "

parameter="/pages/admin/addbdgt.jsp"/>



<action

path="/BdgMastAction"

type="publicity .BdgMastAction"

name="BdgtMasFo rm"

scope="request"

validate="true"

input="/pages/admin/addbdgt.jsp">


<forward name="bdgm" path="/pages/serview/bdgm.jsp"/>
</action>

</action-mappings>
love to hear from u guyz..plz help
regards,
ajos
Sep 10 '07 #1
8 12769
r035198x
13,262 MVP
404 should be something about the page not being found.
Either your path is wrong or the server is down when you try to display the JSP.
Sep 10 '07 #2
ajos
283 Contributor
404 should be something about the page not being found.
Either your path is wrong or the server is down when you try to display the JSP.
hi r035198x,
thanx for the response:)
i know its got to do with page not being found..but ive checked the path also the server is working fine...i cant undrstnd wats the problem....this page is working fine if i use servlets and jsp's.im not able to figure it out....even the code seems to be right...plz help
regards,
ajos
Sep 10 '07 #3
r035198x
13,262 MVP
hi r035198x,
....this page is working fine if i use servlets and jsp's...
So when did you say it's not working?
Sep 10 '07 #4
ajos
283 Contributor
So when did you say it's not working?
hi,
this project was previously running in servlets smoothly...im converting it into struts....when i click on the submit button error like-

HTTP Status 404 - /BdgMastAction.d o

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

type Status report

message /BdgMastAction.d o

description The requested resource (/BdgMastAction.d o) is not available.


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

Apache Tomcat/5.5.23
pops up..i cannot figure out wats wrong since it seems to be right(even though its not!!)..wat possibly can be wrong....any suggestions advice r035198x??
Sep 10 '07 #5
r035198x
13,262 MVP
.. r035198x??
Unfortunately (or rather fortunately for me) I don't know any Struts. Maybe someone else will be able to help you out.

P.S It's also quite unfortunate that you picked ajos for a handle.
Sep 10 '07 #6
ajos
283 Contributor
P.S It's also quite unfortunate that you picked ajos for a handle.
hi,
y is that...thats my short name...ive come to know abt the the guy u r reffering to when i joined the forum...i didnt intend to be a imitaion for that guy...or to offend anybdy...my appologies if i have....:)
regards,
ajos
Sep 10 '07 #7
r035198x
13,262 MVP
hi,
y is that...thats my short name...ive come to know abt the the guy u r reffering to when i joined the forum...i didnt intend to be a imitaion for that guy...or to offend anybdy...my appologies if i have....:)
regards,
ajos
Nah, it doesn't offend me. I doubt if it offends that other guy as well.

I just think it's unfortunate that's all.

regards
! a Jos
Sep 10 '07 #8
ajos
283 Contributor
hi frnds,
is ther anybdy who can help me in this regard(struts). ....plz help guyz.......
regards,
ajos
Sep 11 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1978
by: chris fink | last post by:
Hi, What are the appropriate HTTP Status Codes for the following: 1. XML is not well-formed (structure problem).... 2. XML is not valid (as per DTD/XSD/XDR).....missing req'd field, etc I checked out W3C spec and was unable to decide which status codes are best. Any help is appreciated.
0
2641
by: George | last post by:
Hello, I'm running an ASPX application "WebApplication1" which consumes a web service (service1.asmx) hosted on a machine with IP (128.1.7.x) . The web service is located in the intranet. The web methods can be invoked successfully if "WebApplication1" is located in machines with the same subnet (128.1.7.x). However, it fails if "WebApplication1" is hosted on
6
2841
by: Nick Horrocks | last post by:
I have set up a custom error page for 404 errors. However the HTTP status code returned is 302 followed by 200, this causes search engines not to remove old pages from their index. How can I get the correct status code to be returned? Thanks
5
50736
by: rk325 | last post by:
Yes, I've seen many posts about this type of error, and none of the solutions people applied worked for me. So please read this one carefully and help me if you can. I have a web service application installed in a Windows 2000 SP4 Domain control server. It is running IIS 5.0. I can access the WS from its own web page, and, when I access it from the server where it is installed, I can run its methods. However, I cannot access this WS...
1
41714
by: jctwguy | last post by:
G'day all My pc is on a domain and I have a test server in a work group. all the web application and the web service are working fine locally, but when I copy the project using service extension to this test machine it wasnt working at the begining. Created a virtual website for the web service project doesnt work initially and I found solution as I should put HttpGet and HttpPost in webconfig and its perfect.
1
6451
by: google | last post by:
I'm building a small ASPX page in C# to forward HTTP POST requests to another site. When the other site returns an HTTP error such as 404 or 405, I want to return that same HTTP status value to my caller. But when I do so, my caller always reports HTTP error 500. How can I return the actual HTTP status that I received? Here is my code: private void Page_Load(object sender, System.EventArgs e) {
1
4378
by: kommaraju | last post by:
iam a starter to db2 & jdbc.i have a servlet program which connects to ibm db2 using jdbc.when i run this using apache tomcat 4.1.34 , it is showing a error message of HTTP STATUS 500 my jdbc program is as follows import java.sql.*; import java.lang.*; import java.io.*; import java.util.*;
11
8332
by: jjw92 | last post by:
I've been banging my head against the wall with this one for a couple days so I'm hoping someone has some ideas. I have a web service that I created that is called by a .NET class library (which in turn is called by another application). This all works fine in my development environment. Test environment: Windows Server 2003, ASP 6.0, .NET 2.0, Anonymous authentication is enabled. All components (web service, DLL, and calling application)...
0
1773
by: Jazz Tan | last post by:
Good day, i had face some problem that taking me so much of time to think about it. can any one help me find out the solution?? thank in advance. below is the page message that i can see: ---------------------------------------------------------
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8776
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9310
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9236
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6735
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.