It's not a secret anymore!
The moose likes Struts and the fly likes Not getting the variable values. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Not getting the variable values." Watch "Not getting the variable values." New topic

Not getting the variable values.

pankaj semwal
Ranch Hand

Joined: Oct 07, 2008
Posts: 303

The value of workId is coming null in save method .Even i created the setter and getter method of workid.
But the value is not coming null in issueWork method.
Please help me.

This is my action class code
David Newton

Joined: Sep 29, 2008
Posts: 12617

Where is workId supposed to be coming from?

Some general comments:
* misc: You have a Logger; use that instead of System.out.println.
* line 78: Your execute() method is returning "sucess", which is fine if you also misspelled it in the config file.
* lines 85-87: Don't get lazy; write something meaningful, even in your system.outs.
* lines 97-104: Simplify; all conditions result in the "add" result.
* lines 133 & 135: Unnecessary casts (your IDE should warn you about this)
* line 137: It doesn't appear that you're actually returning XML.
* line 139: don't get parameters directly from the request.
* line 145: No need to convert. You should always check for NumberFormatExceptions if you're going to work around the framework and do things manually.
* line 147: Convention generally says to name variables beginning with a lower-case letter. You don't *have* to, but it will help when others read your code.
* line 202: It looks like you're implementing RequestAware; at the very least you should use that to grab parameters directly from the request (although I don't believe you need to in this case).
I agree. Here's the link:
subject: Not getting the variable values.
It's not a secret anymore!