Satish SN

Ranch Hand
+ Follow
since Apr 19, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Satish SN

Hi Padma,
Search for classes12.jar (oracle thin drivers ) file in your system or else try to download one and put the same in the classpath and recompile the java program the reported exception should not come again
Hi Vijay,

Your requirement is not clear from what you have written.

Basically the joins in SQL are used to retrieve data from multiple tables based on common condition.

In your case the browser code and names are stored in two tables that is a bad database design they way you have explained in your problem.

if you could put couple of records from both the tables i can help further in solving your problem
Hi Krishna,

<jsp:setproperty> action tag has limitations that is action tag can set values of primitive datatypes by introspection of java bean like string,int so on

In order to set userdefined class object properties jsp has given
EL shortname for (Expression Language) this is one of the important concepts for SCWCD exam using EL we can set the properties of bean which are user defined
Hi All,

I have cleared SCWCD 1.4 with 85% on 25th April 2007

I would like to thank the following

1. Book Authors of Head First Servlets & JSP
2. Hanumanth Deshmukh SCWCD 1.4 Certificate Guide
3. Javaranch family for their valuable responses

Satish SN
13 years ago
You can read the image from a web application using third party api provided by orielly
If you are using struts then it provides using which
you can read images/files in web application Google it for code using the above approaches.


Satish SN
Hi,

SCWCD 1.4 Voucher which valid till April 2007 is for sale Amt: Rs 5500/-
anybody interested can mail me at skumar.sn@gmail.com
14 years ago
Sac Sha,

there could be multiple reasons

1. did u get outofmemory exception during the upload process on the server side.

2. u did not mention which jar or application frame work ur using means are u using orielly upload jar or using the struts framework both have certain parameters need to be set for large files.
14 years ago
Hi Ashish,

i think u can handle it through javascript

u can write a function on the window close event and call a servlet/jsp through which u can invalidate the user session.

try this out i think it should work
14 years ago
Hi Amit

following link explains the file upload functionality in struts

http://javaboutique.internet.com/tutorials/struthiber/
14 years ago
Hi Amit,

import org.apache.struts.action.ActionForm;
9 import org.apache.struts.action.ActionMapping;
10 import org.apache.struts.action.ActionErrors;
11 import org.apache.struts.action.ActionMessage;
12 import org.apache.struts.upload.FormFile;
13 import javax.servlet.http.HttpServletRequest;
14
15 /***
16 *
17 * @author Sean C. Sullivan
18 *
19 */
20 public class FileUploadForm extends ActionForm
21 {
22 private FormFile file;
23
24 public void setFile(FormFile f)
25 {
26 this.file = f;
27 }
28
29 public FormFile getFile()
30 {
31 return this.file;
32 }
33
34 public void reset(ActionMapping mapping, HttpServletRequest request)
35 {
36 this.file = null;
37 }
38
39 public ActionErrors validate(ActionMapping mapping, HttpServletRequest request)
40 {
41 ActionErrors errors = new ActionErrors();
42
43 if (this.getFile() == null)
44 {
45 errors.add("file", new ActionMessage("error.file.missing"));
46 }
47 else if (this.getFile().getFileName() == null)
48 {
49 errors.add("file", new ActionMessage("error.empty.filename"));
50 }
51 else if (this.getFile().getFileName().length() < 1)
52 {
53 errors.add("file", new ActionMessage("error.empty.filename"));
54 }
55 else if (this.getFile().getFileSize() < 1)
56 {
57 errors.add("file", new ActionMessage("error.file.size"));
58 }
59 return errors;
60 }
61
62 public String toString()
63 {
64 return "file=" + String.valueOf(this.getFile());
65 }
66 }



import org.apache.struts.action.Action;
8 import org.apache.struts.action.ActionMapping;
9 import org.apache.struts.action.ActionForm;
10 import org.apache.struts.action.ActionForward;
11 import org.apache.struts.upload.FormFile;
12
13 import example.filestorage.*;
14
15 import javax.servlet.http.HttpServletRequest;
16 import javax.servlet.http.HttpServletResponse;
17 import java.io.InputStream;
18
19 /***
20 *
21 * @author Sean C. Sullivan
22 *
23 *
24 *
25 */
26 public class FileUploadAction extends Action
27 {
28 public ActionForward execute(ActionMapping mapping,
29 ActionForm form,
30 HttpServletRequest request,
31 HttpServletResponse response) throws Exception
32 {
33 FileUploadForm uploadForm = (FileUploadForm) form;
34
35 FormFile file = uploadForm.getFile();
36
37 ActionForward forward = null;
38
39 InputStream input = null;
40
41 try
42 {
43 int fileSize = file.getFileSize();
44 String fileName = file.getFileName();
45
46 input = file.getInputStream();
47
48 FileStorageDAO dao = DAOFactory.getFileStorageDAO();
49
50 dao.saveFile(fileName, input, fileSize);
51
52 forward = mapping.findForward(Forward.KEY_SUCCESS);
53 }
54 finally
55 {
56 if (input != null)
57 {
58 input.close();
59 }
60 file.destroy();
61 }
62
63 return forward;
64 }
65
14 years ago
Hi Amit,

Struts can be deployed like a normal web application we deploy in tomcat/weblogic/websphere

Create the following directories in the WEB-INF folder

a. Tlds
b. lib

place struts-config.xml and web.xml in the WEB-INF folder

keep all the struts related jars into lib folder

keep all the tlds files which come with struts in Tlds folder

make an entry for tlds in web.xml file as this is important

keep the above WEB-INF folder along with the jsps and other files in the webserver folder of websphere.
14 years ago
Hi Siva,

i think ur line has a formatting problem ie u cannot have double quotes inside a double quotes ie for all the request params u r mentioning in the html:link u should use '' instead of "" u check and try format correctly then u r problem would be solved.
14 years ago
Hi shailesh,

u can use sturts logic tags to solve ur problem

ie u check for null using either notEmpty or equals or notEquals and accordingly u write the html:text entries with property "disabled" set to true so that the textfield will be disabled

hope my clue works out for u
14 years ago
Hi Nishita,

First of all are u clear with validate() method in ActionForm and the validate = true attrib value in struts-config value.

reason being both mean the same.

it works like this if in Action tag u mention validate = 'true' then the corresponding ActionForms validate() method is called where u would implement ur validation logic which returns ActionErrors .

with this i think if u mention validate = 'true' then only ur validate method defined in the ActionForm is invoked other wise it does not invoke it at all.
14 years ago
Hi Sunesh,

i am not very much clear with u r second option ie u want to embed the database data from all tables into a xml file or all the data from a single table into a xml file.

the approach would be to use DOM to create a xml file and embed each value the way u want.

or try to build the xml file using the stringbuffer and manipulating the strings and finally write into a file using java.io
14 years ago
JSP