Arun Ak

Greenhorn
+ Follow
since Jun 21, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Arun Ak

Hi All,

I am happy inform you that I found answer for my question

you can get struts.properties values in one of action class ......



Regards,
Arun
14 years ago
Hi All,

I have application which supports different languages, and I have screen for user which allow him/her to select his preferred language (user allowed to select only language which web application supports).

My question is how do I know what languages resource bundle are available in my deployed web application. (I load resource bundle as struts.custom.i18n.resources=globalMessages) If I know it then I allow user to select one of the supporting language as user preferred language.



Please help me.

Thanks,
Arun
14 years ago
Hi srinivas,

No I dont want to imgrate, I want to use php as an interface for user, php form accept user inputs and struts framework process it.

Regards,
Arun
14 years ago
Hello,

My web application currently using struts 2 frame work, it has got its sessions and works fine, I want use PHP as an interfcae to struts2, user provide all input in php form and my struts frame work executes with php inputs, and finaly php will read struts framework output and present data to user.

I have installed xampp intergated with tomcat and java bridge.

Can any one know how use php pages as an interfcae to struts actions

Thanks & Regards,
Arun
14 years ago
Please refer my previous post in that I added some annotation to my action.
15 years ago
Ok I have resolved my validation issue but entered into new issues

My action class have two method one for loading the form and other one to process the form data.
both method to carry out certain validation such on load check ids if not then dont load the form , while processing form data varify correction of form data.



public Class MyAction extends ActionSupport implements ModelDrivern<MyForm>{

@ConversionErrorFieldValidator(type=ValidatorType.FIELD,fieldName="age",shortCircuit=true,message="Invalid data type",)
@IntRangeFieldValidator(type=ValidatorType.FIELD, fieldName = "age",min="1",max="99")
@RequiredStringValidator(type = ValidatorType.FIELD, fieldName = "name", message = "Supply Name ")
public String processFormData() throws Exception {
---
---
return SUCCESS;
}

@Validations(
expressions = {
@ExpressionValidator(expression="employeeId == -1", message="Employee not selected"),
@ExpressionValidator(expression="deptd == -1", message="Depatment not selected")
}
)

public String loadForm(){
getLearnableForm().setMinimumRelevance(20);
return SUCCESS;

}

}



When I load the form it also validationg the process form action annotation. I want to do validation on load form and other set of validation on process data - as I mentioned in the above code.
Please guide me how to achive
and if you any one know how to remove default message @ConversionErrorFieldValidator (Invalid field value for field "age".)- currently It shows default message and my custom message
Thanks in advance.
Arun
15 years ago
My action class implements ModelDriven interface. I want to validate the form using @RequiredStringValidator.

its not validating "name" . do any one of you know where I made mistake.



Thanks in advance.
Arun
15 years ago
Hi All,

I had written struts2 action class which export pdf file. it works perfectly fine, now I want to write down Junit test case for this action class.Can any one know how to write unit test case for this action class.

my action


thanks,
Arun
15 years ago
<s:hidden name="hiddenname" key="bar" />

ex.
if bar = "testme"
then

hiddenname=testme
15 years ago

<s:select list="listofconcept"
listKey="xx"
listValue="yy"
name="conceptId"
onchange="onChange()"
key="gb.admin.document.manager.permission.documentrepositorylabel"
labelposition="top"
/>
<s:select list="attributeList"
listKey="attId"
listValue="attName"
name="attribute"
onchange="onChange()"
key="gb.admin.document.manager.documentgroup.label"
labelposition="top"
/>

<script>
function onChange(){
document.myform.submit();
}
</script>

on selecting the concept submit the form and get attribute of concept and create attribute select.

Regards,
Arun
15 years ago
<s:form namespace="/admin" enctype="multipart/form-data">

----
<s:file name="file"/>

---
</s:form>

in java bean
Test{

File file;

getFile();
setFile(File file)
}
15 years ago

Ankit Garg wrote:Arun, you can't write files to client machine like that. You'll have to write the file to the ServletOutputStream. You can only control the name of the file. You'll have to modify your code somehow to work with both the Swing and Struts app...



Ok, If file is too large, do you think is it fessaible to write contenet into ServletOutputStream if not can you let me know alternative soluation.

Regards,
Arun
15 years ago
Hi Ankit Garg,

Create pdf method takes one of input as File (Selected file name along with path). then it start writtin pdf content as

public void createAndSavePdf(String targetFileNameWithPath) {

Document document = new Document(PageSize.A4, 50, 50, 100, 72);
PdfWriter writer1 = PdfWriter.getInstance(document, new FileOutputStream(targetFileNameWithPath));
document.open();
----
----
---
document.close();

}

Regards,
Arun
15 years ago
Hello All

My application implemented with two clients swing and struts2

In swing client - when user click on pdf button it opens File chooser using JFileChooser- user select file [e.g c://temp/result.pdf] and on click of open, pdf file created in that location.

Same way I want to implement it in my struts2 web client. on click of pdf button open file chooser , on click of open create pdf file in that location.

My problem in web client is not able to get user selected file path e.g c://temp/result.pdf, please help me.

Regards,
Arun
15 years ago

Ankit Garg wrote:Do you want to save the file on the server or on client machine?? If you want to save the file on client machine, then you cannot control where the file will be saved. When the browser is asked to download a file, it prompts the user about where to store the file. You can control the name of the file using the content-disposition header...



Can you please let me know how can I get actual selected file path on client machine.
1. open FileDailog - user select file, and click ok, in my jsp I get some long file path which is not real path.

For e.g
C://temp/text.pdf - selected by user now I want same path in my action class from jsp.

Regards,
Arun
15 years ago