This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes problem in my action class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "problem in my action class" Watch "problem in my action class" New topic
Author

problem in my action class

Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
hey i have prepared a project till 2 days before it was working properly but now its not entering the success page


i have to create a new project everytime with a new name then it starts

tell me what can be the problem

thank you
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Can't help without any exception/error logs. Please post them.


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
thanks sagar for your prompt reply but there is no error

as soon as i click my submit button no success is there i remain on mu first page

thank you
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Aditi agarwal wrote:as soon as i click my submit button no success is there i remain on mu first page

Have you confirmed that you specify the correct action path and that action is mapped to correct action class.
Also, paste the relevant code showing the FORM page and struts config file mapping for that action.
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
thak you sagar

actually it was working properly 2 days back before i introdue sessions & hashing Salting method

i think some problem over there

my userlogin.jsp is:-

my userloginaction


now tell me what is the problem & wat should i do to remove that error
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

2 things I want to point out here, they may or may not solves the problem, but very important.
Aditi agarwal wrote:
<%
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevents caching at the proxy server
%>
<%

//session.invalidate();
session = request.getSession(true);
Integer salt = new Integer(ams.form.HashingsaltingForm.generateIntSalt());
String address=request.getRemoteAddr();
session.setAttribute("address",address);
session.setAttribute("salt",salt);

%> [/code]

Using Java code in JSP is very old and unhealthy practice. Avoid it completely.
Aditi agarwal wrote:
my userloginaction
[code=java]
catch(Exception e){}
[/code]

When I see such empty catch block, I get very furious. Thats alos one problem why you didn't get any thing on console or in logs. Pl print the stack trace.

One question, is it production code ?, then beware of SQL injection in below code.

[code] rs=st.executeQuery("select loginname,password from ams_login where loginname= '"+username+"'"); [/code]
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
thanks for your reply sohan & i am sorry for the above mentioned mistakes

I will try that there are no empty catch blocks & also i would like to tell you that i need code in jsp but i will try to avoid it

but one question what i sthis production code i donot understand this.
& if any clue for my problem then please help me

thank you
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Aditi agarwal wrote:thanks for your reply sohan &

sohan, Thanks for the new name. Pl see my signature, 3rd column.
Aditi agarwal wrote:but one question what i sthis production code i donot understand this.

Production code means is that code goes into production server, or you are just trying some code for sake of practice.
Aditi agarwal wrote:& if any clue for my problem then please help me

Try following my advice #2, about try catch block.

Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
I am so sorry sagar

but i think your try catch idea works

thanks
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
any one please reply i need it
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Aditi agarwal wrote:any one please reply i need it

but you said in your previous reply that try.. catch block solves your problem ??
Aditi agarwal
Ranch Hand

Joined: Feb 23, 2011
Posts: 225
yes it worked for some time but agian that problem arises
 
jQuery in Action, 2nd edition
 
subject: problem in my action class
 
Similar Threads
Can I connect to database at runtime from WSAD5.0?
Importing a Java Project from CVS into Eclipse
invoke remote webservice APACHE ODE
Eclipse RAD multiple projects
How to get back R.java after cleaning the project in eclipse?