kartik krishnan

Ranch Hand
+ Follow
since Nov 19, 2006
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 kartik krishnan

Hi

I apologize for a newbie question but I have not found a solution to my predicament anywhere. I am trying to load the string representation of image source in the jspf fragment file but the impression tracker does not load in the jsp file. I am hoping for any help that I can get.

The logic is: if impressionTracker starts with http or https if then use the string as image source if not , just write the impression tracker on the jsp page.

Given below is the source of my origin jsp. In this file, I include another jspf fragment file.



I am including the jspf file source code.

In my jspf file, I am trying to import a Java file as follows
9 years ago
JSP
Hi David,

How do you configure global resources? I looked at this link and I did not find anything useful.

http://struts.apache.org/2.0.14/docs/localization.html
10 years ago

David Newton wrote:The forward action isn't in the same package as your action--it's an XW2/S2 class.



Hi David,

I don't know what that means. Does that mean the forward action does not know where to pick up the messages?

Kartik
10 years ago
Hi All,

I am a newbie on Struts2 and I have come across a problem to which I can not figure out the solution. I have iterating a list and I have property in the object that is to be displayed. If the property for that bean's attribute has to be changed then there is a pull down menu for that purpose. My iterator code is as follows:



I am not able to pre select the value from select tags. The value of status attribute is either OPEN or CLOSED and can not be anything else. Is there anything that I am doing wrong? There has to be a drop down for that attribute in every row. I am not able to get it to preselect.
10 years ago
Newbie question here: I am sure I have missed something but I have pored through the Struts localization tutorial http://struts.apache.org/2.x/docs/localization.html but I can not find a resolution.


In my package structure, I have package.properties file with the following
key value pair:

In my simple login page: the form elements are defined with a key look up..


In my struts.xml, I have defined the action mapping. The first action is a forward action
to the login page.



When I try to load the login_input action, I don't see the messages picked up from package.properties. But when I submit the form and it fails validation, it is picked up from the resource bundle. What is it that I have to do in order to have the messages picked up from resource bundle for a forward action?

Any advice would be useful.

Thanks,

Kartik

10 years ago
As I mentioned earlier, I am unable to validate my form inputs. When I don't select any option from the pull down menu (The default value is ""), even then the action method is executed and result page displayed. I want it to show the configured error message from the xml file. I am not sure what I am doing wrong. Any help would be appreciated.

My form jsp is given below


My validators in WEB-INF/classes are given below:


My action specific validation rule (ActionItemTrackingAction-findByCriteria-validation.xml) is in WEB-INF/classes.



My struts mapping


My action-class is given below:

10 years ago
All the information is here : http://stackoverflow.com/questions/2647594/trouble-with-client-side-validation-using-struts-2-xml-based-validation-rules-no

I apologize for cross posting but this is really critical and I don't know what I am doing wrong. I looked at this and can not figure out where I am going wrong.
Thanks,

Kartik
10 years ago
@Leo: Thanks for replying. I only want the test data during the execution of test method and not persisted in the database. Ideally, the data would be deleted or the entire operation could be rolled back after the test execution is complete.
10 years ago
I have used DbUnit but DBUnit Composite transaction first inserts the database into the database and then deletes it. I call stored procedures with CallableStatements. If it goes wrong, then I have invalid data in my database.
10 years ago
@Scott, Thanks for replying. We have to insert into the database because the database generates some default values for columns not populated with JDBC calls. We need that information to be displayed. One of them is the customer id. The customer id is uniquely associated with a customer and the customer should have that id when logging into our application.
@Jelle Thanks for replying. We are using a same connection instance. The connection is stored as a thread local object and is acquired by the data access layer.

@Jan Thanks for the advice. To clarify if I set the isolation level to READ_UNCOMMITTED, my select query will return the output before commit is called. So if my insert operation is rolled back, then the select query will not return anything. On the other hand, if once commit is executed, the insert operation changes are persisted into the database. Have I understood this correctly?
Hi,

I am working on a web app which requires the user to save some web form information i(say customer) into the database using insert sql query (with PrepraredStatement api). and then load it immediately with some predefined db column values using a select query (again with PreparedStatement api). This must be made transactional. If the insert succeeds but select fails, then the entire operation must be rolled back.

The service layer method is calling both insert and select methods in DAO class. For my connection, I have set autocommit to false and nothing else. After both operations are executed without errors, I call connection.commit() explicitly. If an exception is thrown during insert or select, I call rollback.

My problem is that after I call my select query after running an insert query, I don't see any results. Is there anything I am doing wrong? Do I have to change anything for inserts to work?

Any advice would be appreciated.

Thanks,

Kartik
I guess what I am looking for is a way to set up connection metadata such that if I run an insert query, i should be able to see my changes. After rollback, I should not be able to. Do I have changes to connection' isolation or any other metadata?

Thanks,

Kartik
10 years ago
@Jan,

Thanks for replying. I know it is a little vague but I don't know how to explain it myself. To write a pseudo code, it would be some thing like this



I know that Spring some thing like this but we don't use Spring in our project so any help would be appreciated.

Thanks,

Kartik
10 years ago
Hi,

I apologize for rather vague subject line. I have been asked my manager to write a "test bed" for running tests that call dao classes, some thing like Spring without using Spring. I have managed to set up thread local connection to both Daos and my test class. That way I have the same connection attributes. Now what I would like to do in my test class is have my DAO class make a db call (say insert) and then use the same connection in my test class to query if the insert really worked) and rollback the changes after my test has been executed. That way the database will roll back to its known state after every test run.

I have an AOP interceptor/listener where I can invoke the connection commit/rollback. But I want to be able to see the results of my insert query in the db before I can query the database. I have set auto commit to false. Are they any configurations that I need to make to the connection to make this possible?

Thanks,

Kartik
10 years ago