Ajay Tickle

Greenhorn
+ Follow
since Mar 16, 2008
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 Ajay Tickle

Hi,

I am using Struts 1.1. I am to do some validations in my form for this i have written validation method.

In my struts-config.xml validation = "false"

As per my requirement i have to write two validations methods in form bean. (one is for errors and one is for warnings). I am calling both the methods one by one. One methods perform required validations and add to errors. again i call send method to checks for warnings and add in errors. both the method are are working fine.

Only problem i am facing is JSP page display only errors from from last methods (which ever i call second).

Code is

//Checking warnings
ActionErrors errorsWarning = myForm.validateWarning(mapping,(HttpServletRequest) request);

if (!errorsWarning.isEmpty()) {
saveErrors((HttpServletRequest) request, errorsWarning);
}



//Checking error
ActionErrors errors = myForm.validate(mapping,(HttpServletRequest) request);
if (!errors.isEmpty()) {
saveErrors((HttpServletRequest) request, errors);
}

Is there any way so i could display both errors in my JSP

Thank you
12 years ago
vaibhav,

Check your ActionForm has correct data type. In my case problem was incorrect data type.
12 years ago
HI,

I have to show list in my jsp page. I am using <html:select>

i am getting two lists from data base and it is in employee form bean: first list is for employee no and second list is for name. i want to display employee name in <option> and want to use employee no as VALUE in <option> so list would have employee no as value and name will be displayed to user.

i am not sure how to do it with two lists as i have two different lists, one list for emp no and one list for employee name. Please help me... some code example would be a help for me.

Thank you
12 years ago
Thank you for your time.. i solved the issue
12 years ago
Hi,

When i add <html:select> tag in my jsp i am getting following exception:

Uncaught exception thrown in one of the service methods of the servlet: action. Exception thrown : javax.servlet.ServletException: BeanUtils.populate
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1254)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:966)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:478)
at com.ibm.ws.wswebcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:463)
at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:92)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:744)
at com.ibm.ws.wswebcontainer.WebContainer.handleRequest(WebContainer.java:1425)
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:92)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:465)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java:394)
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:274)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:152)
at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:213)
at com.ibm.io.async.AbstractAsyncFuture.fireCompletionActions(AbstractAsyncFuture.java:195)
at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:136)
at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:193)
at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:725)
at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:847)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1498)
---- Begin backtrace for Nested Throwables
java.lang.IllegalArgumentException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:615)
at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(PropertyUtils.java:1789)
at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(PropertyUtils.java:1684)
at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.java:1713)
at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:1019)
at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
at org.apache.struts.util.RequestUtils.populate(RequestUtils.java:1252)
at org.apache.struts.action.RequestProcessor.processPopulate(RequestProcessor.java:821)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:254)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:763)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

When i add tag and click on Submit button, i am getting above error. I am not sure what is reason for this error. I have declared and added getter and setter method in my form bean also.

When i remove <html:select> tag it works fine and call action class also.

Any reason for this exception ?

Thank you
12 years ago
Hi,

I saw in one example of i18n code

session.setAttribute(Globals.LOCALE_KEY, Locale.GERMAN);

i am confused about Globals.LOCALE_KEY. could you please tell me what is use of Globals.LOCALE_KEY and what it does in code. Is there any other options can we use instead of Globals.LOCALE_KEY.

Thank you
Ajay
12 years ago
Hi,

I am working on multilingual web application in struts. normally struts takes browser's language to display messages from properties file.

I need to provide a list box which will have German and English options. If user select German from list, application should use German language properties file (application should not take language code from browser). If user select English, application should use English language properties file.

How will i make sure struts use user's selected language in list instead of browser language code. currently in my application it is using browser's language code.

Thank you for your help and time
Ajay
12 years ago
Hi,

I want to learn Web Services. I do not have much knowledge on it. I would to know how to start, what should i learn first. I know and working on Servlet, JSP, Struts, Hibernate. DO i need to learn XML first before starting web services.

What software i need to have on my PC. Currently i am using Tomcat for servlet/JSP.

Thank you for your help and answers
Ajay
12 years ago
thanks Merrill it worked for.

thanks a lot for your help
12 years ago
Hi,

I am using struts in my application. to validate users entry in jsp i have my validation method. and i am calling that method in action class. code is below I am not using struts' validations )






above code is working fine. Only problem is it is printing error messages in jsp in one line.

example: Enter Name. Enter Address.


I would like to show every error message on new line in jsp. is it possible.

in jsp i am using <html:errors/> to print message.


thank you for your time and solutions
12 years ago
Hi,

How to get current date and time in format of yyyy-MM-dd HH:mm:ss.S

Thank you
12 years ago
Hi,

I am getting date from database in format of 2008-03-30 14:20:07.0 and i have stored it in String. I want to compare it with current date time. As i am getting it from DB i cannot change the format.

1) Could you please tell me how to compare it with current date time
2) how to compare 2008-03-30 14:20:07.0 if I convert String to java.util.Date


Thank you for help and time
Ajay
12 years ago
Hi,

I have something like this in JSP :

<html:radio property="gender" value="male">MALE</html:radio>
<html:radio property="gender" value="female">FEMALE</html:radio>

1) i want to know how to make "Male" to be default selected when page is loaded
2) I would set the value in form bean and on second page i would display radio buttons to change the value. i would like to know how to make one radio button selected as per the value set in form bean

thank you
ajay
12 years ago
HI,

I am using struts 1.2 in my web application. I have to display one <html:select>.... <html:options> list

list will be build dynamically. User can select any option. base on the user's selection page will be refreshed (need to hit the database and display information in other fields on same page.) I need to know two things:

1) there is one submit button on that page and one action is associated with that submit button. i can call the associated action class once the user finish the form and click the submit button. When user select from list i need to call another action class.

I want to know how to call another action class, (when user select something from list), as list control is inside the same html:form tag.

2) When user selects some value from list i need to refresh the page and populate the other fields.

I would like to know, Lets say there are ten values and user has selected third option, how to keep selected that third option as page is already refreshed?

I am beginner in struts.. any sample code would be a great help for me

Thank you for time and help.

Ajay
12 years ago
JSP
HI,

I am using struts 1.2 in my web application. I have to display one <html:select>.... <html:options> list

list will be build dynamically. User can select any option. base on the user's selection page will be refreshed (need to hit the database and display information in other fields on same page.) I need to know two things:

1) there is one submit button on that page and one action is associated with that submit button. i can call the associated action class once the user finish the form and click the submit button. When user select from list i need to call another action class.

I want to know how to call another action class, (when user select something from list), as list control is inside the same html:form tag.

2) When user selects some value from list i need to refresh the page and populate the other fields.

I would like to know, Lets say there are ten values and user has selected third option, how to keep selected that third option as page is already refreshed?

I am beginner in struts.. any sample code would be a great help for me

Thank you for time and help.

Ajay
12 years ago