Amit Kumar Kaushik

+ Follow
since Jan 12, 2006
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 Amit Kumar Kaushik

i have done the same application once. see the code below and try your hand on it.

1 . ManageTemplateForm is the form object

2. page is a String property in form.

3. Value is the String i want to compare.

<logic-l:equal name="ManageTemplateForm" property="page" value="FirstPage">
<bean:message key=""/>
<bean:message key=""/>
<logic-l:notEqual name="ManageTemplateForm" property="page" value="FirstPage">
<logic-l:equal name="ManageTemplateForm" property="page" value="First">
<bean:message key=""/>
<logic-l:notEqual name="ManageTemplateForm" property="page" value="First">
<html:link href="javascript:linkSelectedPrevious()">
<bean:message key=""/>
15 years ago
change the folloing line and try again.

<form name="frmUploader" action="http:\\localhost:8080\web\UploadServlet" method="POST">


<form name="frmUploader" action="/web/UploadServlet" method="POST">
15 years ago
At the time of iteration on jsp, define a hidden field and put your value in that.

In Action, you can retrieve the value of hidden field.
15 years ago

Try the link given below and all of ur queries will be cleared.

I am thankful for the headaches at work because it means I have a job.

15 years ago
1. Uninstall all versions of jdk from system along with respective Runtime Environments and install jdk1.5 again.

2. If you are using ecpilse then go to Package Explorer and right click on your project-> Properties.

Go to java compiler in properties and set your compiler compliance level to 1.5. click apply and ok.

build the project again and try againg for the same.
15 years ago
Is there any one to help in this?
15 years ago

Check the instruction given below.

Our web application has one limitation , and this limitation is growing day by day. This limitation is because of stateless nature of http protocol. Struts framework has managed this problem specified below.

So please read this article and make required changes into your code. We will make some schedule so that our web application will be bug free in future.

Not Checking for Duplicate Form Submissions

Aside effect of the stateless nature of the HTTP protocol is that the interface

presented in the browser can easily get out of sync with the state of the

model on the server. There is a common pitfall involving this lack of synchronization

that must be dealt with in nearly every application. This occurs

when a user submits values using a form on a given page and then, at some

later point, backtracks to the cached page, edits the now stale values, and

resubmits the form. This has the potential to corrupt the underlying data

store by creating duplicate records, overwriting current data with stale values,

and so on. In the best case, it creates a bad transaction that is rejected by

the data store.

This pitfall potentially affects nearly every JSP containing a form tag. In

most projects, the problems show up during system test. Fortunately for

developers, system testers are generally wise enough to include scenarios

in their test scripts that expose this type of bug. Developers, on the other

hand, rarely test for these conditions.


The code that follows represents a typical naive form implementation that

is trapped in this pitfall. If we don�t do anything special to prevent it, the

user can use the HTML generated by this JSP to submit the same form multiple


<html:form action=�/saveInvoice� method=�post�>





<td><html:text property=�invoiceNumber�/></td>





<td><html:text property=�billingDate�/></td>





<td><html:text property=�amount�/></td>


<td colspan=3 align=�right�><html:submit/></td>




One of the common mechanisms to control this pitfall, and the one that

will be explored in the accompanying solution, is to have forms submit

tokens that the application can check to ensure that the forms are not

submitted more than once.

Solving Pitfall 4.7: Add Tokens to Generated JSP

To solve this pitfall, we will make use of one of the more obscure features

of Struts. The token management facility is provided by the Action and

FormTag classes, comprising a small group of Action methods that provide

for token generation and checking, and largely undocumented code in the

FormTag to render the generated tokens automatically. Taken together,

these two features make it quite easy to check for duplicate submissions.

Our goal here is to ensure that forms are submitted only when they contain

fresh data. In essence, we�re trying to exert some control over the flow

of the application. To do that, we can call on Struts to place tokens in our

forms as necessary, so that we can check the submitted token against a

copy cached on the server.


1. Choose a form.

2. Identify the Action that navigates to the form.

a. Add code to generate a token.

3. Identify the Action that handles submission of the form.

a. Add code to check the generated token and to generate a new

one if the Action is successful.

4. Test the implementation.

5. Continue with other Actions until all form-submission scenarios

have been covered.


The first step in the solution is to choose a form. We will begin this example

by choosing the FindInvoice form. The next step is to identify the

Action that navigates to the form and add code to generate the token. The

Action that navigates to the form is the FindInvoiceAction. This is the code

for that action with the token generation added.

public class FindInvoiceAction extends BaseAction


public ActionForward execute(ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response)

throws IOException, ServletException



saveToken(request); // This is all we need to add

return mapping.findForward(�saveInvoicePage�);



The FormTag class takes care of inserting the token for you if a value for

it has been set, as we did above with saveToken in the FindInvoiceAction.

The next step is to identify the action that handles submission of the

form and add code to that form that will make sure that the tokens match

and then generate a new token if the form submission was successful. Listing

4.5 is the code for the SaveInvoiceAction that has been modified to

check the token.

public class SaveInvoiceAction extends BaseAction


public ActionForward execute(ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response)

throws Exception {

// Check the token. If it doesn�t match the token currently in

// the session, it�s stale.

if (!isTokenValid(request)) {

postGlobalError(Constants.DUPLICATE_FORM_ERROR, request);

return mapping.findForward(�saveInvoicePage�);



// if we got this far, everything worked okay, so generate

Listing 4.5 Checking the token in SaveInvoiceAction. (continues)

// a new token.


return mapping.findForward(�confirmInvoicePage�);



Listing 4.5 (continued)

The final step is to deploy and test the code to make sure it functions

properly. Once you have a working implementation, you can add token

generation and checking wherever else it is needed. Extra care should be

taken in testing the solution to ensure that forms cannot be resubmitted

under any odd combinations of circumstances.
15 years ago
I like to ask you few question?

1. Which version of Struts, you are working on?
2. When are you getting this error? (i mean when you run the application, loading on jsp, validating form)
3. Server and jdk version you are using.
15 years ago
we are using rmi and web server in our application. Flow of the application is :-

client requests web application(tomcat)
web application requests rmi server.

i have a combobox on jsp page containing name of the images, stored on rmi server. I want to display the selected image on jsp. For this client requests the web server and web server requests rmi server. rmi server contains a folder images in which all the images are stored.

How i can get the selected image and display on jsp?
15 years ago
try the following code

<html:file property="imageFile1" styleClass="filebutton" />

and code for style is given below. You can put it in .css file and link in jsp

BORDER-RIGHT: #999999 1px solid;
BORDER-TOP: #999999 1px solid;
FONT-WEIGHT: normal;
FONT-SIZE: 10pt;
COLOR: #000000;
BORDER-LEFT: #999999 1px solid;
BORDER-BOTTOM: #999999 1px solid;
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
15 years ago
I have two fields startX and width. i want to put javascript validation on submit of the form.

width field must be less than startX field. how can i do it using validWhen or any other option? I don't want to write javascript funtion in jsp for the same.
15 years ago