struts2

Where to put struts.xml

With Struts2 we have to have struts.xml in the class path, so it no longer works to have it under WEB-INF. So the way I got my project to deploy was to stick it under WEB-INF/classes and have it include ../struts2.xml 2 Problems: 1) Eclipse cleans out the classes folder when I do a rebuild, so it deletes struts.xml 2) Eclipse doesn't sh...

How does struts 2 includes javascript files in a jsp from their struts.jar?

I've noticed that the javascript client-side validation feature of the struts 2 framework uses a javascript file that comes inside the struts2 JAR file. The javascript file gets included somehow in the JSP page apparently by just using a tag from the framework. If I manage to do this it will be extremely helpful for the many javascript ...

struts2: accessing getters of action class in jsp without creating object

Hi all, I am working on struts2. In my action class I have written some accessors (setter-getter). Now, suppose this action class is returning SUCCESS and in struts.xml I am open a jsp page (say abc.jsp) against the result "SUCCESS". I need the values of all getter methods written in action class without creating object of action class i...

Struts2: Adding parameters from a map to a URL tag

I want to add a variable list of parameters to a Struts2 URL tag. I have a map of the parameters (name value pairs) in an object in the session. I'm struggling to find a good approach to this. Here is the relevant JSP code: <s:iterator value="%{#session['com.strutsschool.interceptors.breadcrumbs']}" status="status"> <s:if test=...

struts2:getting value of multiple checkbox and made them checked on another page.

I am working on struts2. I have 3 checkbox in my jsp page (say a.jsp) like <s:checkbox name="authority" fieldValue="ORIGINATOR"/> <s:checkbox name="authority" fieldValue="EVALUATOR"/> <s:checkbox name="authority" fieldValue="EXECUTOR"/> Suppose I checked first two and when I fetched the value of “authority” in my action class in give...

Struts2 Version 2.0.x handling unknown actions

In struts2 version 2.1.x there is a new UnknownHandler that kicks in when a request arrives and the action name cannot be found. The question is...what is the equivalent mechanism if one exists in 2.0.x versions? I recently noticed from examining the log files that exceptions are thrown when the action name is not properly resolved a...

starting a struts2 project in eclipse

Hello everyone, I am in the process of starting a struts2 project. While I was able to use struts2-blank as a quick out-of-the-box project, I have trouble creating my own struts2 project in Eclipse. All necessary jars are located in the web-inf/lib directory, but as soon as I add the following lines to my web.xml <filter> <filter-...

How to get request locale in OGNL?

Hi, I want to know how to get request locale in OGNL? For now I use <s:set var="locale" value='#session.WW_TRANS_I18N_LOCALE?#session.WW_TRANS_I18N_LOCALE.toString():"zh_CN"'/> This must assume that the initial value is "zh_CN". So I need to know how to get request locale in OGNL. Thx ...

Why struts2 FilterDispatcher deprecated?

In API document I found this Since Struts 2.1.3, use StrutsPrepareAndExecuteFilter instead or StrutsPrepareFilter and StrutsExecuteFilter if needing using the ActionContextCleanUp filter in addition to this one. Why ? As I know that StrutsPrepareAndExecuteFilter have some problem in I18n. ...

Difference between '#','%' and '$'

I'm new to struts2 and confused by the '#','%' and '$' element. There are some usages like: ${user.name} %{user.name} <s:radio list="#{key1:value1,key2:value2}" /> Could any give me an explanation and examples? ...

stucked with Getting null values in iReport,JasperReports,Strts 2 plugin , what is the problem ?

I am using jasper reports and Struts2 to make to make some reports in my web application . I am doing all this stuff with NetBeansIDE and iReport 3.5.1 plugin for designing purpose. I am configuring my struts2-jasperreports plugin by following xml code. <result-types> <result-type name="jasper" class="org.apache.stru...

Want to develop Jasper Report with Struts2

Hello All, I am developing project using Spring, Struts2 & Hibernate. Now i want to use a Jasper Report with Struts2. But i am totally new with Jasper Report. Can anyone give simple example or a tutorial or any other link which can help me.. Thanx in advance.. ...

can what I am doing in my webapplication be hacked or broken into easily?

I am presenting the user with some exam. Users are not to proceed into the actual site before they pass this exam. However, there will be some users who will have a choice to bypass the exam until some date (say month from current date). So these users have a window of a month to take the exam. until then they can click 'Proceed' on t...

file uploading using <s:file> in Struts2

Hi all, I am working on struts2 application. I have following in my jsp (say main.jsp) – <s:file name="sampleDocument"/> <s:submit action="uploadSample" value="Upload" /> See here how my struts.xml handling the action - <action name=" uploadSample " class=" UploadFiles"> <result name="success"> /main.jsp</...

can't set Struts2 result type to json

I want to use json with Struts2. However, when I set the action return type to "json", I got "there is no result type defined for type 'json' mapped with name 'success'." Bellow is struts.xml file. <?xml version="1.0" encoding="utf-8"?> <!DOCTYPE struts PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN" "ht...

Which reporting tool to used with struts, spring, hibernate

Hello, I am developing Web Base Application using Spring, Struts2, Hibernate. Now i am in the reporting phase of my system. But i am little bit confused that which tool to use & which not. I had tried Jasper report with struts2 plugin, but facing lots of problem in jrxml file. Now can anyone suggest which reporting tool will be bett...

Performance comparisons of Frameworks to Use for an Auction Web Site

I am a Java guy and therefore would prefer a Java based framework for an auction site that I am planning to develop from scratch. But all my colleagues and friends have pointed out to me that the better sites that are coming up now-a-days are mostly written either using Ruby on Rails, Django or ASP.net MVC framework. I was wondering ...

Getting value without creating object in struts2

I am working on a struts2 application. I have an auto generated field in my action class and I am getting its value in a String variable. Now, after returing "SUCCESS" by this action class, struts.xml is routed to open a jsp page (say abc.jsp). I want to get that String variable (having auto generated field value) at my jsp page without ...

Can getters value flow from action to dao class without passing object in struts2

I am working on struts2 application. I have getter/setter in my action class. Now, I am sending object of my action class (say Action.java) to DAO class (say Dao.java) as a parameter of some method. All is ruuning well, I am getting value of all getters in my Dao.java. Now, I want to do all this without creating and sending the object of...

How do you obtain the value of struts.action.extension in a struts2 interceptor?

I need to access the struts.action.extension value in the struts.xml file from an interceptor. Any suggestions? ...