prabakaran perumal

Greenhorn
+ Follow
since Jan 24, 2007
Merit badge: grant badges
For More
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 prabakaran perumal

Hi all

I checked, everthing is working fine.

This is a good example for array of text or etc.. in action form

code.
jsp page
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>

<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean" %>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html" %>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic" %>
<html:html>
<head>

<title>GL Test</title>
</head>
<body>
<html:form action="/GlTest">
<% for(int i=0; i<2; i++){ %>
<html:text property='<%= "arrayForm[" + i + "].glCode"%>'/>
<html:text property='<%= "arrayForm[" + i + "].operatingUnit"%>'/>
<% }%>
<html:submit/>
</html:form>

</body>
</html:html>


action class

package com.scb.gltest;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class GlTestAction extends Action {

public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
try {
System.out.println("This is my test for array of index");
GlTestForm glTestForm = (GlTestForm) form;

if (glTestForm != null) {
for (int i = 0; i < 2; i++) {
ArrayForm arrayform = glTestForm.getArrayForm(i);
System.out.println("gl code ="+ arrayform.getGlCode());
System.out.println("operating unit ="+arrayform.getOperatingUnit());

}
}

} catch (Exception e) {
e.printStackTrace();
}
return mapping.findForward("success");
}
}

action form
package com.scb.gltest;

import org.apache.struts.action.ActionForm;

public class GlTestForm extends ActionForm {

ArrayForm arrayForm[] = new ArrayForm[2];

public GlTestForm() {
// TODO Auto-generated constructor stub
for (int i = 0; i < 2; i++) {
arrayForm[i] = new ArrayForm();
}

arrayForm[0].setGlCode("mytestGL1");
arrayForm[0].setOperatingUnit("mytestoperting1");
arrayForm[1].setGlCode("mytestGL2");
arrayForm[1].setOperatingUnit("mytestoperting2");

}

public ArrayForm[] getArrayForm() {
return arrayForm;
}

public void setArrayForm(ArrayForm[] arrayForm) {
this.arrayForm = arrayForm;
}

public ArrayForm getArrayForm(int index) {
return this.arrayForm[index];
}

public void setArrayForm(int index,ArrayForm arrayForm) {
this.arrayForm[index].setGlCode(arrayForm.getGlCode());
this.arrayForm[index].setOperatingUnit(arrayForm.getOperatingUnit());
}


}
15 years ago
In the above mentioned code, is there any option to get the values in the action class after submitting form. or i need to use javascript to collect all the data and set into hidden field.
15 years ago
we have overrided the actionservlet class. while starting tomcat, two times my actionservlet called
15 years ago
You need to submit the data using html forms then only you can store to session objects.
I think, container creates new thread for each request. There is no ambiguity between two requests.
Hi Ben,

You are right.As per your request i changed.
16 years ago
we have deployed tomcat 5.5 at clustering environment. could you please suggest which is best cache solution to maintain java cache in our clustering Env

Some of the cache solutons

1)jofti
2)ehcache
3)jbosscache
4)jcs
16 years ago
We have planned to implement some java caching solution at tomcat clustering env.

Can please suggest which is the best soluton to deploy at clustering env.
[ October 10, 2007: Message edited by: prabakaran perumal ]
16 years ago
I have extended struts Actionservlet to myservlet class.

myservlet class init method two times called.i don't know why.

Please update your comments.

init method code

public void init() throws ServletException {
try {
/** Get the ServletContext * */
ServletContext servletContext = this.getServletContext();


/** Initialize the logger * */
loadInitLogging();

/** Initialize the PropertyFileReader * */
loadPropertyFileReader(servletContext);

/** Logs the JDBC information * */
displayJDBCInfo();

/** Loads the Master Table values * */
loadMasterTableValues();


/** This method tiggers 12 AM of everyday
* and reloads the master table values
*/
//TimerJob.invokeTimer();


} catch (Exception e) {
LOG.error("Unexcepted error occurred", e);
LOG.error(e.getMessage());
}

super.init();
}
[ July 10, 2007: Message edited by: prabakaran perumal ]
16 years ago
Hi Ragul

Please post the code
16 years ago
I wish to know how to digest SHA-1 mesaage and communicate with LDAP server using JNDI.

we need to import some jar file for accessing below class
import sun.misc.BASE64Encoder;

so where can we download that jar.


Please post your comments
17 years ago
sorry, Even if we put as a parameter also.
Green,
Form name is programmer certificate scjp. Why can't I put scjp question if i have doubt on that.

Satou,

Even if I put char as a return type I am getting error.
You have been requested before not to post real SCJP questions on this forum.
[ March 01, 2007: Message edited by: Barry Gaunt ]
public class Kirving{
private final int i = 10;
public static void main(String argv[]){
Kirving ki = new Kirving();
ki.go(3);
}
public void go(int z){
int i=z;
}
}

The above code compiled without error.My question is i is private variable declared but again same i is used inside go mehtod that means i was hidded inside go method or not?