Win a copy of Escape Velocity: Better Metrics for Agile Teams this week in the Agile and Other Processes forum!

will zhang

Ranch Hand
+ Follow
since Sep 11, 2008
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by will zhang

Paul Sturrock wrote:Hibernate doesn't autocommit unless you tell it to. Which storage engine are you using? Not all MySQL engines support transactions.

Thanks for reply. But how to check storage engine?

BTW, We have another project which has exactly the same setting as this one. However, autocommit is off on that project, even if I turn it on.

In other words, in project A, autocommit is on regardless of my setting config.setProperty("hibernate.connection.autocommit", "false");

in project B, autocommit is off regardless of my setting config.setProperty("hibernate.connection.autocommit", "true");

It seems config.setProperty("hibernate.connection.autocommit", "false/true"); doesn't do its job at all.
I'm using hibernate annotations, my database in is MySQL5.0.

I tried to persist a bunch of objects and commit at the end, which means insert all or insert none of them.
For example, I want to insert 10 objects one time, if exception happens at the 9th object, because I didn't do commit, there should be no new data in database. However, I do find the 8 datas. Anyone has experience/solution for this?

BTW, I didn't use Spring. I also used rollback but doesn't work.

The thing is like my save() already commit the transaction without closing the session.

Here's some of my hibernation configuration:

Lorand Komaromi wrote:

will zhang wrote:I export project 2 as a JAR and the result is the same.

Did you add the jar to WEB-INF/lib..?

Adding the jar into WEB-INF/lib solved the problem. Thanks!

I wonder what's the difference between putting jar in build path and putting jar in WEB-INF/lib. Appreciate!
12 years ago
I export project 2 as a JAR and the result is the same.
12 years ago

Lorand Komaromi wrote:

will zhang wrote:In project 1, I include project 2 in order to use interfaces

How do you "include" project 2? When deployed, are the required classes/interfaces in you web application's /WEB-INF/classes and jars in /WEB-INF/lib?

I use eclipse to add project 2 to java build path of project 1. I used this method many times to include another project, it works fine.
12 years ago
Dear all,
Here's my situation:

In project 1, I include project 2 in order to use interfaces (interface A, B, C, D.....) of project 2.
For one of the interfaces, A, the system always claim java.lang.NoClassDefFoundError while others are working fine.

If I move interface A from project 2 to project 1, it works.

I named interface A "", is the name the reason which causes this problem, because in interceptor setting, I have <interceptor-stack name="user">. But after I change the name, still doesn't work.

Anyone can help? Thanks very much.

Error message:
12 years ago
I want to get enum type based on the code(an int)
Here's what I have using switch:

Is there any way I can use instead of switch?

I saw something here:
But I couldn't understand the second method, any hint?

12 years ago
Here is the form from my jsp page:

When using firefox, it works fine. When using internet explorer, the form is submitted twice for the same action.
Example: if the user clicks "Release", public String releaseContract() will be executed twice.

I saw other's form was submitted twice mostly likely because of Javascript, but obviously this case is different.

12 years ago
Dear all,

I want to use a multiple select to ask user select the item they want. The items selected will be on a pdf file which will be sent as attachment of email (user can click "send email" button to send them). The user wants to confirm if the pdf is right before he sends it. Therefore, I create a "PDF" button to ask user to check if the PDF attachment is what he wants to send.

Here is the situation:
Since the "PDF" button and "send email" button will both use the selected item info, I don't want the user to select the same list twice(of course user doesn't want to do that).

I thought to store the selected info in session when the user click "PDF" so that they have the info when he clicks "send email". But user may just click "send email" directly without checking first, then the selected info will be lost.

Any suggestions about this? Thanks
12 years ago
Dear all,

I'm using JQuery UI datepicker in my jsp page, here's the way I'm using:

It works fine if it's a new page. However, it doesn't work in an ajax page.
Anyone can give me some hints? Thanks.

Here's the info(from the same page) I found from firebug, it seems jquery doesn't do its work in the ajax part of the page.
1. ajax part(doesn't work)

2. static part(works)
12 years ago
As the following img shows, when I click the datepicker icon to select the date, the selected date will always appear in the field as upper as possible.
Example: if I click the 1st icon in the 2nd table, the selected date will appear in the 1st field of 1st table.
if I click the 1st icon in the 3nd table, the selected date will also appear in the 1st field of 1st table.

Anyone has similar error or any hint? Thanks

12 years ago

David Newton wrote:You're improperly embedding OGNL escapes; you'd want %{segmentList[#stat.index]} or something like that (if you even need the #; depends on which S2 version you're using).

Thanks, Dave, I tried <s:property value="%{segmentList[#stat.index].comment}" /> and found it displays value well but couldn't pass value back to the segmentList.

I also tried <s:property value="segmentList[#stat.index].comment" />, it's the same with above.

segmentList[stat.index] doesn't work for me, even for the display.
12 years ago

David Newton wrote:It works for <s:property> tags if there's a backing collection; not sure what you mean: property tags aren't form tags.

I tried but it didn't work, I get nothing even in the display.

When I said property tags aren't form tags, I mean user doesn't change value for ><s:property>, also from this catagory:
12 years ago

David Newton wrote:Try using array notation (index inside square brackets, like [n]) if order is important. At some point that may have stopped being a requirement--I noticed that it wasn't strictly necessary, but I don't know if it was always like that, or if it was a change.

Thanks, Dave, I used
and it works for form tags, such as textfield, hidden.

However, it doesn't work for data tags(such as<s:property> tag) and ajax tags(such as <s:datetimepicker> tag).
12 years ago