Sandy Chatterjee

Ranch Hand
+ Follow
since Jun 27, 2012
Sandy likes ...
Mac Hibernate Java
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 Sandy Chatterjee

In Struts 1
Form data can be validated on the client side as well as on the server side using the Validator Framework,
which was developed as a third-party add on to Struts. This framework generates the java script and it can be
used to validate the form data on the client browser. Server side validation of your form can be carried out by
subclassing your form class with DynaValidatorForm class. The Validator Framework uses 2 xml configuration
files validator-rules.xml (defines reusable standard validation routines, which are usable in validator.xml) and
validator.xml (defines validation applicable to a form bean).

Regards,
Sandy
11 years ago



Thanks for your reply. I knew it was wrong but I was confused when it was supported by a second user.
Anyways tell me one thing


In the above code is 'myproperties.configured.resources.key' a key in the Resource Bundle?
Because I don't think so.
It has to be initialized in the Action class' execute() method by the following way:

where 'error.name.required' is defined in Resource Bundle.

Correct me if I am wrong as the guy who has posted this question is being misguided by wrong answers.

Regards,
Sandy
11 years ago
Already answered your Query in the previous thread

Regards,
Sandy
11 years ago
Hi,

Create a package named DAO. And create a class named CompareDao.java

Below is the code for CompareDao.java


Here is the code for HibernatePlugin.java

and HibernateUtils.java

Action class will be the same Action class mentioned by you. Just add the following line to your Action class:

Hope it's clear to you now. If you have any confusions reply back to me.

Also I have answered your previous queries.

Regards,
Sandy
11 years ago
Hi,

I am back.

in our HibernateUtils.class we have a function called createSession() but when it comes to use that function in our action class we simply call the openFactory()/createFactory() function and then use that typecasted object for creating new connection/ to use openSession() menthod and that Thread safe session instance remain unused as that creatSession() is never called in action class


In the above example we have not used the HibernateUtils.java. If you check the Action class you will not find any import statement for HibernateUtils.java.
So, don't be confused. Its by mistake I have pasted the code for HibernateUtils.java.
11 years ago
Thanks Shankar and Vidya for your reply.


I knew about <logic:messages> tag. But the thing which was bothering me was the post by Bharat Kasodariya


He has used something called message. That was really a new thing for me to learn.
Also Vidya wanted to explain which was not exactly clear to me.
I just wanted to know about the above code.

@Vidya


As per my knowledge, here in logic:present tag the attribute "name" defines a scripting variable to be used as the variable being tested for existence.
Here we are testing that particular variable is present in the scope or not...? And then if it is present in a scope it will enter into the body of the tag and then bean:write attribute displays the values of the properties in the form.


I understood what you want to mean but what Raghava Chary asked was that he wanted to check a value is present or not from the message ResourceBundle. Where is the Message here. Is that 'anyname'?
11 years ago

I'm trying upload a pdf file. and When debugging the project I realized that the FormBean returns the variable "thefile" null.


Even pdf file is uploading in my system.

I'm using NetBeans 7.1.2 and Struts 1.3.10, with the JDK jdk1.7.0_05 also I'm using GlassFish Server 3.1.2.


I am using NetBeans 6.5 ,struts 1.2, JDK 1.5 and Glassfish 3.1.
But I don't think it has something to do with the version.
Do one thing start a completely new project in NetBeans and check.

Regards,
Ssandy
11 years ago
Your code is running perfectly fine in my Development Environment.
I am uploading .jpeg and .txt files.
Could you tell me what kind of files are you trying to Upload.

Regards,
Sandy
11 years ago
Still waiting for reply from Bharat Kasodariya and Vidya Gupta
11 years ago
It depends on the logic you have applied in your Action class.
Also how you are trying to display multiple rows in your jsp.
Normally for handling multiple Lists we use

inside the Iterator tag.
Setting indexed="true" sets an unique index to your scripting variable.
Its needs some explanation and right now I don't have much time.
Anyways I am trying for a simpler solution, just be patient.
I'll get back to you as soon as possible.
For any clarification reply back to me.

Regards,
Sandy

11 years ago
I'll get back to you shortly. Little busy now.

Regards,
sandy
11 years ago

private UploadForm validator;


Make the declaration inside the execute() method of the Action Class.
Its advised to do it in Thread Safe manner.

Regards,
Sandy
11 years ago

The best way to maintain session in struts application is create a session obj in ActionServlet....
bcz ActionServlet is responsible for taking request and providing response.....
so creating a session is ActionServlet is the best way


A Session object is already created. We don't have to create it.
In the Action class we retrieve it by using
request.getSession() from the HttpRequest object. I guess this is what sneha meant.
By the way could you please clarify how do you create session object in ActionServlet.
As we only create it when one is not present by using the following:
11 years ago

<logic:present name="message">

<bean:write name="message" />

</logic:present>


@Vidya

As per my knowledge the 'name' attribute of the <logic:present> tag is the name of any bean in a particular scope.
So, according to the code 'message' is a bean which is stored in some scope.
Is the 'message' bean the message resource bundle bean.
If so then how can we check a particular message is present or not.
Please explain.
11 years ago