Re: Doubt with using check box

2009-06-20 Thread Paweł Wielgus
Hi Vishnu,
on the html page you will have a list of checkboxes with the same name
selectedEmployees and a value of an employee identificator. In the
action create settet setSelectedEmloyees(String[] selectedEmployees),
then in execute You can access this table of employee identificators.
Just as a side note, i don't know what type of is your employee
identificator, so i proposed String, but it can also be long.

Best greetings,
Pawel Wielgus.

2009/6/20, Vishnu Vyasan Nelliparmbil vis...@mun.gov.bh:
 Hi Friends,

 I am new to web development and struts. I have a simple question.

 I am using logic:iterate tag to iterate through a list of Employees
 and display their details.
 The list contains the Employee objects.
 Now while displaying Employee details in a table, the row is ending with
 a check box , so that the user can select employees. The check boxes are
 created dynamically since they are inside the iterate tag.

 Now how in Action I know that a specific employee is selected?

 In action form I would get whether the check box is selected or not. But
 how can I relate that to employees in list?

 Thanks in Advance
 vishnu













-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RE: Doubt with using check box

2009-06-20 Thread Vishnu Vyasan Nelliparmbil


Pawel , can you expalin  with a example. I am totally new to struts.

I tried with another way.

Ie by adding a 'selected' field to the EmployeeBean. 

logic:iterate id=EmployeeBean name=EMPLOYEE scope=session
tr
td bean:write name= EmployeeBean property=employee_name //td
td bean:write name= EmployeeBean property=employee_salary //td
tdhtml:checkbox name= EmployeeBean property=selected 
onchange=checkEmployee();  /html:checkbox  
tr
/logic:iterate

Now I am getting the values of selected as false in the Action. Even though I 
have selected it.
I am using a action form for the some other elements in the same view.

Could you guys can through some light on how to make this work?


Regards
Vishnu 



-Original Message-
From: Paweł Wielgus [mailto:poulw...@gmail.com] 
Sent: 20 June 2009 10:40
To: Struts Users Mailing List
Subject: Re: Doubt with using check box

Hi Vishnu,
on the html page you will have a list of checkboxes with the same name
selectedEmployees and a value of an employee identificator. In the
action create settet setSelectedEmloyees(String[] selectedEmployees),
then in execute You can access this table of employee identificators.
Just as a side note, i don't know what type of is your employee
identificator, so i proposed String, but it can also be long.

Best greetings,
Pawel Wielgus.

2009/6/20, Vishnu Vyasan Nelliparmbil vis...@mun.gov.bh:
 Hi Friends,

 I am new to web development and struts. I have a simple question.

 I am using logic:iterate tag to iterate through a list of Employees
 and display their details.
 The list contains the Employee objects.
 Now while displaying Employee details in a table, the row is ending with
 a check box , so that the user can select employees. The check boxes are
 created dynamically since they are inside the iterate tag.

 Now how in Action I know that a specific employee is selected?

 In action form I would get whether the check box is selected or not. But
 how can I relate that to employees in list?

 Thanks in Advance
 vishnu













-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Error when deploying portlets beside a normal Struts2 web app?

2009-06-20 Thread phillips1021

Nils-H:

   I created a Jira Issue (WW-3164) and attached a sample app that you can
use to duplicate the problem I'm encountering.

Bruce


Nils-Helge Garli wrote:
 
 It would be helpful if you could create a sample app and attach it to
 a JIRA issue. Then I'll have a look at it.
 
 Nils-H
 
 

-- 
View this message in context: 
http://www.nabble.com/Error-when-deploying-portlets-beside-a-normal-Struts2-web-app--tp23981728p24124720.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Error when deploying portlets beside a normal Struts2 web app?

2009-06-20 Thread phillips1021

Nils-H:

I did some more trouble-shooting and think I may have found what is causing
the problem.

I noticed that the originator of this thread said his action was causing a
jsp to render that included the s:form tag.

My application's action that would cause the NullPointerException also was
causing a jsp to render that included the s:form tag

I removed the s:form from the jsp and I no longer get the
NullPointerException when using the Struts 2.1.6 plugin.

Some of the exception stack trace seems to indicate the problem is with the
s:form tag when using the Struts 2.1.6 Portlet Plugin:

java.lang.NullPointerException 
org.apache.struts2.components.UIBean.evaluateParams(UIBean.java:792)
org.apache.struts2.components.UIBean.end(UIBean.java:510)
   
org.apache.struts2.views.jsp.ComponentTagSupport.doEndTag(ComponentTagSupport.java:42)
   
org.apache.jsp.jsp.employeeForm_jsp._jspx_meth_s_005ftextfield_005f0(employeeForm_jsp.java:424)
   
org.apache.jsp.jsp.employeeForm_jsp._jspx_meth_s_005fform_005f0(employeeForm_jsp.java:359)
   
org.apache.jsp.jsp.employeeForm_jsp._jspService(employeeForm_jsp.java:121)




phillips1021 wrote:
 
 Nils-H:
 
I created a Jira Issue (WW-3164) and attached a sample app that you can
 use to duplicate the problem I'm encountering.
 
 Bruce
 
 
 Nils-Helge Garli wrote:
 
 It would be helpful if you could create a sample app and attach it to
 a JIRA issue. Then I'll have a look at it.
 
 Nils-H
 
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Error-when-deploying-portlets-beside-a-normal-Struts2-web-app--tp23981728p24124806.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Sam Wun
Dear all,

Can anyone tell me what is wrong with the following errors:



00:05:59,378 ERROR [PortletRequestDispatcherImpl:316]
org.apache.jasper.JasperException:
/html/portlet/onlinepayment_portlet/order.jsp(1,1) File
/WEB-INF/tld/struts-bean.tld not found
org.apache.jasper.JasperException:
/html/portlet/onlinepayment_portlet/order.jsp(1,1) File
/WEB-INF/tld/struts-bean.tld not found
at 
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at 
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
...

I have already defined tag-libs in my web.xml file:
taglib
taglib-urihttp://struts.apache.org/tags-bean/taglib-uri
taglib-location/WEB-INF/tld/struts-bean.tld/taglib-location
/taglib

of course struts-bean.tld is not in my WEB-INF/tld directory, but I
expect it will pick up the file from the lib path like the other
sample does.
I am sure most of you don't have this file in your project directory.

This is the init.jsp file that is included in the order.jsp file:

%@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
%@ 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 %

%@ page import=javax.portlet.PortletRequest %
%@ page import=javax.portlet.PortletSession %


Any idea?
Your help is very much appreciated.
Thanks

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



RequestProcessor and contentType response header

2009-06-20 Thread Avlesh Singh
I am using Struts 1.2.7
I wrote a Filter which intercepts all requests and applies response headers
(based on some external configuration) to it. All response headers applied
in my Filter other than Content-Type were obeyed and sent to the client.
Content-Type was always text/html.
After a lot of debugging, I realized the value for this particular header
are always getting overwritten in the struts' RequestProcessor class.
Underneath is the method which in my case turned out to be the culprit


 protected void processContent(HttpServletRequest request,
HttpServletResponse response) {
 String contentType =
 moduleConfig.getControllerConfig().getContentType();
 if (contentType != null) {
response.setContentType(contentType);
  }
 }


Couple of questions:

   1. Shouldn't this method also check if the response already has a
   contentType header applied or not? Is this a known bug, or am I missing
   something?
   2. I subclassed the RequestProcessor and defined a controller in my
   struts config as controller processorClass=com.me.MyRequestProcessor/.
   The class merely overrides the processContent method to check for an
   existing contentType. Am I doing it correctly, or is there some other way to
   achieve the desired behavour in my case.

Cheers
Avlesh


Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Girish Naik
I would sugest you to remove the taglib configuration in ur web.xml. As it
is matching the uri and trying to load from the local file.

In my previous application i had given :
%@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean %

in my jsp header and
taglib
taglib-uri/tags/struts-bean/taglib-uri
taglib-location/WEB-INF/struts-bean.tld/taglib-location
/taglib
in web.xml
And they are working fine.

So either you can give :
%@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean %

 or (if u have a local tag lib)

%@ taglib uri=/tags/struts-bean prefix=bean %


Regards,
-
Girish Naik
Mobile:-+91-09740091638
girish.n...@gmail.com
Fran Lebowitzhttp://www.brainyquote.com/quotes/authors/f/fran_lebowitz.html
- Life is something to do when you can't get to sleep.

On Sat, Jun 20, 2009 at 7:42 PM, Sam Wun swun2...@gmail.com wrote:

 Dear all,

 Can anyone tell me what is wrong with the following errors:

 

 00:05:59,378 ERROR [PortletRequestDispatcherImpl:316]
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
at
 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at
 org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
 ...

 I have already defined tag-libs in my web.xml file:
taglib
taglib-urihttp://struts.apache.org/tags-bean/taglib-uri

  taglib-location/WEB-INF/tld/struts-bean.tld/taglib-location
/taglib

 of course struts-bean.tld is not in my WEB-INF/tld directory, but I
 expect it will pick up the file from the lib path like the other
 sample does.
 I am sure most of you don't have this file in your project directory.

 This is the init.jsp file that is included in the order.jsp file:

 %@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
 %@ 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 %

 %@ page import=javax.portlet.PortletRequest %
 %@ page import=javax.portlet.PortletSession %


 Any idea?
 Your help is very much appreciated.
 Thanks

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Sam Wun
thanks for the response.
I moved the following taglib lines into the /** ***/ area in the jsp
file, and the recompile/deploy with ant. It still give me the same
errors.

Here is the jsp file load the tld files:
%
/**
%@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
%@ 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 %
 */
%

%@ page import=javax.portlet.PortletRequest %
%@ page import=javax.portlet.PortletSession %

portlet:defineObjects /

style type=text/css
   %@ include file=/css/style.css %
/style


here is the errors again:
01:23:47,290 INFO  [PluginPackageUtil:1347] Checking for available updates
01:23:47,293 INFO  [PluginPackageUtil:1391] Finished checking for
available updates in 3 ms
01:23:54,476 ERROR [PortletRequestDispatcherImpl:316]
org.apache.jasper.JasperException:
/html/portlet/onlinepayment_portlet/order.jsp(1,1) File
/WEB-INF/tld/struts-bean.tld not found
org.apache.jasper.JasperException:
/html/portlet/onlinepayment_portlet/order.jsp(1,1) File
/WEB-INF/tld/struts-bean.tld not found
at 
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at 
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at 
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
at 
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:345)
at 
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:378)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:486)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)



On Sun, Jun 21, 2009 at 1:10 AM, Girish Naikgirish.n...@gmail.com wrote:
 I would sugest you to remove the taglib configuration in ur web.xml. As it
 is matching the uri and trying to load from the local file.

 In my previous application i had given :
 %@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean %

 in my jsp header and
 taglib
        taglib-uri/tags/struts-bean/taglib-uri
        taglib-location/WEB-INF/struts-bean.tld/taglib-location
    /taglib
 in web.xml
 And they are working fine.

 So either you can give :
 %@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean %

  or (if u have a local tag lib)

 %@ taglib uri=/tags/struts-bean prefix=bean %


 Regards,
 -
 Girish Naik
 Mobile:-+91-09740091638
 girish.n...@gmail.com
 Fran Lebowitzhttp://www.brainyquote.com/quotes/authors/f/fran_lebowitz.html
 - Life is something to do when you can't get to sleep.

 On Sat, Jun 20, 2009 at 7:42 PM, Sam Wun swun2...@gmail.com wrote:

 Dear all,

 Can anyone tell me what is wrong with the following errors:

 

 00:05:59,378 ERROR [PortletRequestDispatcherImpl:316]
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
        at
 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
        at
 org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
 ...

 I have already defined tag-libs in my web.xml file:
        taglib
                taglib-urihttp://struts.apache.org/tags-bean/taglib-uri

  taglib-location/WEB-INF/tld/struts-bean.tld/taglib-location
        /taglib

 of course struts-bean.tld is not in my WEB-INF/tld directory, but I
 expect it will pick up the file from the lib path like the other
 sample does.
 I am sure most of you don't have this file in your project directory.

 This is the init.jsp file that is included in the order.jsp file:

 %@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
 %@ 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 %

 %@ page import=javax.portlet.PortletRequest %
 %@ page import=javax.portlet.PortletSession %


 Any idea?
 Your help is very much appreciated.
 Thanks

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Dave Newton

Did you remove the configurations from the web.xml file?

Sam Wun wrote:

Here is the jsp file load the tld files:
%
/**
%@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
%@ 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 %
 */
%


That won't work at all--now your page has no taglibs.


portlet:defineObjects /


Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Sam Wun
Yeah, it works after removed them all :)
but what  have happened? I just don't know why another project works
wtih these lines here, may be there is some xml configuration
difference.

Thanks


On Sun, Jun 21, 2009 at 1:41 AM, Dave Newtonnewton.d...@yahoo.com wrote:
 Did you remove the configurations from the web.xml file?

 Sam Wun wrote:

 Here is the jsp file load the tld files:
 %
 /**
 %@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
 %@ 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 %
  */
 %

 That won't work at all--now your page has no taglibs.

 portlet:defineObjects /

 Dave

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org



-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Girish Naik
as you dont have the files in WEB-INF can you remove the mapping in web.xml
and run again?


Regards,
-
Girish Naik
Mobile:-+91-09740091638
girish.n...@gmail.com
George Carlinhttp://www.brainyquote.com/quotes/authors/g/george_carlin.html
- Electricity is really just organized lightning.

On Sat, Jun 20, 2009 at 8:57 PM, Sam Wun swun2...@gmail.com wrote:

 thanks for the response.
 I moved the following taglib lines into the /** ***/ area in the jsp
 file, and the recompile/deploy with ant. It still give me the same
 errors.

 Here is the jsp file load the tld files:
 %
 /**
 %@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
 %@ 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 %
  */
 %

 %@ page import=javax.portlet.PortletRequest %
 %@ page import=javax.portlet.PortletSession %

 portlet:defineObjects /

 style type=text/css
   %@ include file=/css/style.css %
 /style


 here is the errors again:
 01:23:47,290 INFO  [PluginPackageUtil:1347] Checking for available updates
 01:23:47,293 INFO  [PluginPackageUtil:1391] Finished checking for
 available updates in 3 ms
 01:23:54,476 ERROR [PortletRequestDispatcherImpl:316]
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
at
 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
at
 org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
 at
 org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
at
 org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:345)
at
 org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:378)
at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:486)
at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)



 On Sun, Jun 21, 2009 at 1:10 AM, Girish Naikgirish.n...@gmail.com wrote:
  I would sugest you to remove the taglib configuration in ur web.xml. As
 it
  is matching the uri and trying to load from the local file.
 
  In my previous application i had given :
  %@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean %
 
  in my jsp header and
  taglib
 taglib-uri/tags/struts-bean/taglib-uri
 taglib-location/WEB-INF/struts-bean.tld/taglib-location
 /taglib
  in web.xml
  And they are working fine.
 
  So either you can give :
  %@ taglib uri=http://struts.apache.org/tags-bean; prefix=bean %
 
   or (if u have a local tag lib)
 
  %@ taglib uri=/tags/struts-bean prefix=bean %
 
 
  Regards,
  -
  Girish Naik
  Mobile:-+91-09740091638
  girish.n...@gmail.com
  Fran Lebowitz
 http://www.brainyquote.com/quotes/authors/f/fran_lebowitz.html
  - Life is something to do when you can't get to sleep.
 
  On Sat, Jun 20, 2009 at 7:42 PM, Sam Wun swun2...@gmail.com wrote:
 
  Dear all,
 
  Can anyone tell me what is wrong with the following errors:
 
  
 
  00:05:59,378 ERROR [PortletRequestDispatcherImpl:316]
  org.apache.jasper.JasperException:
  /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
  /WEB-INF/tld/struts-bean.tld not found
  org.apache.jasper.JasperException:
  /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
  /WEB-INF/tld/struts-bean.tld not found
 at
 
 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
 at
 
 org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
  ...
 
  I have already defined tag-libs in my web.xml file:
 taglib
 taglib-urihttp://struts.apache.org/tags-bean
 /taglib-uri
 
   taglib-location/WEB-INF/tld/struts-bean.tld/taglib-location
 /taglib
 
  of course struts-bean.tld is not in my WEB-INF/tld directory, but I
  expect it will pick up the file from the lib path like the other
  sample does.
  I am sure most of you don't have this file in your project directory.
 
  This is the init.jsp file that is included in the order.jsp file:
 
  %@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
  %@ 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 %
 
  %@ page import=javax.portlet.PortletRequest %
  %@ page import=javax.portlet.PortletSession %
 
 
  Any idea?
  Your help is very much appreciated.
  Thanks
 
  -
  To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
  For additional 

Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Sam Wun
Hi,

Thanks for the instruction. It works after removed the struts-bean
lines in web.xml and the lines in jsp files.
But now I can't display message from the struts tags as shown below:
The message This is Order page!! is shown in my portlet page, the
rest of struts tagged message are not shown.

in order.jsp file:

%@ include file=/html/portlet/onlinepayment_portlet/init.jsp %

bean:define id=shipping_address name=OrderForm
property=shipping_address type=java.lang.String /

logic:messagesPresent
span class=es-error
bean:message key=error.shipping_address.invalid/
/span
/logic:messagesPresent

!--
p align=right
   a href=portlet:renderURL portletMode=help /Help/a
/p
--
p align=centre
html:form action=/onlinepayment_portlet/order method=post
focus=shipping_address

table class=stats
tr
  thpThis is Order page!!/p/th
  thbean:message key=form.shipping_address//th
  thhtml:text name=OrderForm property=shipping_address size=50 //th
tr
  thbean:message key=form.billilng_address//th
thhtml:text name=OrderForm property=billing_address size=50 //th
/tr
tr
  thbean:message key=form.email_address//th
 thhtml:text name=OrderForm property=email_address size=50 //th
/tr
tr valign=top
  thbean:message key=form.firstname//th
 thhtml:textarea name=OrderForm property=firstname
rows=12 cols=50 //th
/tr
tr valign=top
  thbean:message key=form.lastname//th
 thhtml:textarea name=OrderForm property=lastname rows=12
cols=50 //th
/tr

/table
/p

p align=left
   html:submitbean:message key=button.submit//html:submit
   /html:form
/p

In the path of 
/usr/liferay-portal-5.2.3/tomcat-6.0.18/webapps/online-payment-5.2.3.1/WEB-INF/classes/resource:
I have a file application.properties:
##
## Custom errors
##
error.shipping_address.invalid=Shipping address is required.
error.name.required=Please enter your name.
error.name.invalid=Invalid input in Name field.
error.emailaddr.required=Please enter your email address.
error.emailaddr.invalid=Invalid input for email address.
error.comment.required=Please enter your inquiry.
error.comment.invalid=Please fill in all fields. Email field must be a
valid email address.

##
## Custom labels and Messages
##
form.firstname=First Name *
form.lastname=Lasat Name *
form.shipping_address=Shipping Address *
form.billing_address=Billing Address *
form.email_address=Email Address*
button.submit=Submit

These messages are supposed mapped into the order.jsp file in run
time. But nothing is shown on the webpage at the moment, except the
message in p/p html tags.

That has happened here? Any idea?

Thanks again.



On Sun, Jun 21, 2009 at 2:44 AM, Girish Naikgirish.n...@gmail.com wrote:
 as you dont have the files in WEB-INF can you remove the mapping in web.xml
 and run again?


 Regards,
 -
 Girish Naik
 Mobile:-+91-09740091638
 girish.n...@gmail.com
 George Carlinhttp://www.brainyquote.com/quotes/authors/g/george_carlin.html
 - Electricity is really just organized lightning.

 On Sat, Jun 20, 2009 at 8:57 PM, Sam Wun swun2...@gmail.com wrote:

 thanks for the response.
 I moved the following taglib lines into the /** ***/ area in the jsp
 file, and the recompile/deploy with ant. It still give me the same
 errors.

 Here is the jsp file load the tld files:
 %
 /**
 %@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
 %@ 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 %
  */
 %

 %@ page import=javax.portlet.PortletRequest %
 %@ page import=javax.portlet.PortletSession %

 portlet:defineObjects /

 style type=text/css
   %@ include file=/css/style.css %
 /style


 here is the errors again:
 01:23:47,290 INFO  [PluginPackageUtil:1347] Checking for available updates
 01:23:47,293 INFO  [PluginPackageUtil:1391] Finished checking for
 available updates in 3 ms
 01:23:54,476 ERROR [PortletRequestDispatcherImpl:316]
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
        at
 org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
        at
 org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         at
 org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
        at
 org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:345)
        at
 org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:378)
        at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:486)
        at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)



 On Sun, Jun 21, 2009 at 1:10 AM, Girish Naikgirish.n...@gmail.com wrote:
  I would sugest you 

Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Sam Wun
I have already defined the following xml codes in the struts-config.xml file:

message-resources parameter=resources.application
null=true/message-resources
plug-in className=org.apache.struts.validator.ValidatorPlugIn
set-property property=pathnames
value=/WEB-INF/validator-rules.xml,/WEB-INF/validation.xml/set-property
/plug-in

and I have created this application.properties in the followiong path:
 # pwd
/usr/liferay-portal-5.2.3/dev/portlets/online-payment/docroot/WEB-INF/classes/resources



On Sun, Jun 21, 2009 at 3:15 AM, Sam Wunswun2...@gmail.com wrote:
 Hi,

 Thanks for the instruction. It works after removed the struts-bean
 lines in web.xml and the lines in jsp files.
 But now I can't display message from the struts tags as shown below:
 The message This is Order page!! is shown in my portlet page, the
 rest of struts tagged message are not shown.

 in order.jsp file:

 %@ include file=/html/portlet/onlinepayment_portlet/init.jsp %

 bean:define id=shipping_address name=OrderForm
 property=shipping_address type=java.lang.String /

 logic:messagesPresent
        span class=es-error
        bean:message key=error.shipping_address.invalid/
        /span
 /logic:messagesPresent

 !--
 p align=right
   a href=portlet:renderURL portletMode=help /Help/a
 /p
 --
 p align=centre
 html:form action=/onlinepayment_portlet/order method=post
 focus=shipping_address

 table class=stats
 tr
  thpThis is Order page!!/p/th
  thbean:message key=form.shipping_address//th
  thhtml:text name=OrderForm property=shipping_address size=50 //th
 tr
  thbean:message key=form.billilng_address//th
    thhtml:text name=OrderForm property=billing_address size=50 
 //th
 /tr
 tr
  thbean:message key=form.email_address//th
     thhtml:text name=OrderForm property=email_address size=50 //th
 /tr
 tr valign=top
  thbean:message key=form.firstname//th
     thhtml:textarea name=OrderForm property=firstname
 rows=12 cols=50 //th
 /tr
 tr valign=top
  thbean:message key=form.lastname//th
     thhtml:textarea name=OrderForm property=lastname rows=12
 cols=50 //th
 /tr

 /table
 /p

 p align=left
   html:submitbean:message key=button.submit//html:submit
   /html:form
 /p

 In the path of 
 /usr/liferay-portal-5.2.3/tomcat-6.0.18/webapps/online-payment-5.2.3.1/WEB-INF/classes/resource:
 I have a file application.properties:
 ##
 ## Custom errors
 ##
 error.shipping_address.invalid=Shipping address is required.
 error.name.required=Please enter your name.
 error.name.invalid=Invalid input in Name field.
 error.emailaddr.required=Please enter your email address.
 error.emailaddr.invalid=Invalid input for email address.
 error.comment.required=Please enter your inquiry.
 error.comment.invalid=Please fill in all fields. Email field must be a
 valid email address.

 ##
 ## Custom labels and Messages
 ##
 form.firstname=First Name *
 form.lastname=Lasat Name *
 form.shipping_address=Shipping Address *
 form.billing_address=Billing Address *
 form.email_address=Email Address*
 button.submit=Submit

 These messages are supposed mapped into the order.jsp file in run
 time. But nothing is shown on the webpage at the moment, except the
 message in p/p html tags.

 That has happened here? Any idea?

 Thanks again.



 On Sun, Jun 21, 2009 at 2:44 AM, Girish Naikgirish.n...@gmail.com wrote:
 as you dont have the files in WEB-INF can you remove the mapping in web.xml
 and run again?


 Regards,
 -
 Girish Naik
 Mobile:-+91-09740091638
 girish.n...@gmail.com
 George Carlinhttp://www.brainyquote.com/quotes/authors/g/george_carlin.html
 - Electricity is really just organized lightning.

 On Sat, Jun 20, 2009 at 8:57 PM, Sam Wun swun2...@gmail.com wrote:

 thanks for the response.
 I moved the following taglib lines into the /** ***/ area in the jsp
 file, and the recompile/deploy with ant. It still give me the same
 errors.

 Here is the jsp file load the tld files:
 %
 /**
 %@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
 %@ 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 %
  */
 %

 %@ page import=javax.portlet.PortletRequest %
 %@ page import=javax.portlet.PortletSession %

 portlet:defineObjects /

 style type=text/css
   %@ include file=/css/style.css %
 /style


 here is the errors again:
 01:23:47,290 INFO  [PluginPackageUtil:1347] Checking for available updates
 01:23:47,293 INFO  [PluginPackageUtil:1391] Finished checking for
 available updates in 3 ms
 01:23:54,476 ERROR [PortletRequestDispatcherImpl:316]
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
 org.apache.jasper.JasperException:
 /html/portlet/onlinepayment_portlet/order.jsp(1,1) File
 /WEB-INF/tld/struts-bean.tld not found
        at
 

Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Dave Newton

Did you un-comment the taglib directives?

Sam Wun wrote:

Hi,

Thanks for the instruction. It works after removed the struts-bean
lines in web.xml and the lines in jsp files.
But now I can't display message from the struts tags as shown below:
The message This is Order page!! is shown in my portlet page, the
rest of struts tagged message are not shown.

in order.jsp file:

%@ include file=/html/portlet/onlinepayment_portlet/init.jsp %

bean:define id=shipping_address name=OrderForm
property=shipping_address type=java.lang.String /

logic:messagesPresent
span class=es-error
bean:message key=error.shipping_address.invalid/
/span
/logic:messagesPresent

!--
p align=right
   a href=portlet:renderURL portletMode=help /Help/a
/p
--
p align=centre
html:form action=/onlinepayment_portlet/order method=post
focus=shipping_address

table class=stats
tr
  thpThis is Order page!!/p/th
  thbean:message key=form.shipping_address//th
  thhtml:text name=OrderForm property=shipping_address size=50 //th
tr
  thbean:message key=form.billilng_address//th
thhtml:text name=OrderForm property=billing_address size=50 //th
/tr
tr
  thbean:message key=form.email_address//th
 thhtml:text name=OrderForm property=email_address size=50 //th
/tr
tr valign=top
  thbean:message key=form.firstname//th
 thhtml:textarea name=OrderForm property=firstname
rows=12 cols=50 //th
/tr
tr valign=top
  thbean:message key=form.lastname//th
 thhtml:textarea name=OrderForm property=lastname rows=12
cols=50 //th
/tr

/table
/p

p align=left
   html:submitbean:message key=button.submit//html:submit
   /html:form
/p

In the path of 
/usr/liferay-portal-5.2.3/tomcat-6.0.18/webapps/online-payment-5.2.3.1/WEB-INF/classes/resource:
I have a file application.properties:
##
## Custom errors
##
error.shipping_address.invalid=Shipping address is required.
error.name.required=Please enter your name.
error.name.invalid=Invalid input in Name field.
error.emailaddr.required=Please enter your email address.
error.emailaddr.invalid=Invalid input for email address.
error.comment.required=Please enter your inquiry.
error.comment.invalid=Please fill in all fields. Email field must be a
valid email address.

##
## Custom labels and Messages
##
form.firstname=First Name *
form.lastname=Lasat Name *
form.shipping_address=Shipping Address *
form.billing_address=Billing Address *
form.email_address=Email Address*
button.submit=Submit

These messages are supposed mapped into the order.jsp file in run
time. But nothing is shown on the webpage at the moment, except the
message in p/p html tags.

That has happened here? Any idea?

Thanks again.



On Sun, Jun 21, 2009 at 2:44 AM, Girish Naikgirish.n...@gmail.com wrote:

as you dont have the files in WEB-INF can you remove the mapping in web.xml
and run again?


Regards,
-
Girish Naik
Mobile:-+91-09740091638
girish.n...@gmail.com
George Carlinhttp://www.brainyquote.com/quotes/authors/g/george_carlin.html
- Electricity is really just organized lightning.

On Sat, Jun 20, 2009 at 8:57 PM, Sam Wun swun2...@gmail.com wrote:


thanks for the response.
I moved the following taglib lines into the /** ***/ area in the jsp
file, and the recompile/deploy with ant. It still give me the same
errors.

Here is the jsp file load the tld files:
%
/**
%@ taglib uri=http://java.sun.com/portlet_2_0; prefix=portlet %
%@ 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 %
 */
%

%@ page import=javax.portlet.PortletRequest %
%@ page import=javax.portlet.PortletSession %

portlet:defineObjects /

style type=text/css
  %@ include file=/css/style.css %
/style


here is the errors again:
01:23:47,290 INFO  [PluginPackageUtil:1347] Checking for available updates
01:23:47,293 INFO  [PluginPackageUtil:1391] Finished checking for
available updates in 3 ms
01:23:54,476 ERROR [PortletRequestDispatcherImpl:316]
org.apache.jasper.JasperException:
/html/portlet/onlinepayment_portlet/order.jsp(1,1) File
/WEB-INF/tld/struts-bean.tld not found
org.apache.jasper.JasperException:
/html/portlet/onlinepayment_portlet/order.jsp(1,1) File
/WEB-INF/tld/struts-bean.tld not found
   at
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
   at
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
at
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:88)
   at
org.apache.jasper.compiler.Parser.processIncludeDirective(Parser.java:345)
   at
org.apache.jasper.compiler.Parser.parseIncludeDirective(Parser.java:378)
   at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:486)
   at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)



On Sun, Jun 21, 2009 at 1:10 AM, Girish Naikgirish.n...@gmail.com wrote:

I would 

Re: Input validation in Struts 2 and extrating the errors in jsp

2009-06-20 Thread Thomas Rene Vervik

Perfect, thanks both, it solve the issue :)



Thomas Rene Vervik wrote:
 
 I manage to do input validation when I have one of the default themes
 selected (xhtml, css_xhtml, etc). But what if I dont want to use
 Freemarker, I want to build the whole HTML in my Jsp, how do I extract
 the error messages the validation framework generate.
 Example, see the code in the code paragraph
 
 
 
 How do I extract the error messages in the Jsp when I have the theme set
 to simple?
 
 
 public class Person{
 private String name;
 Private String email;
 } 
  
 I have the following validation xml file:
 validators
 field name=name
 field-validator type=requiredstring
 messageYou must enter a name/message
 /field-validator
 /field
 field name=email
 field-validator type=requiredstring
 messageYou must enter a email address/message
 /field-validator
 /field
 /validators
  
 And this form:
 s:form action=contact theme=simple
 s:textfield accesskey=name label=Navn key=name
 value=%{name}/
 s:textfield accesskey=email label=Epost key=email
 value=%{email}/
 s:submit value=Send /
 /s:form
 
 Thanks for all help
 

-- 
View this message in context: 
http://www.nabble.com/Input-validation-in-Struts-2-and-extrating-the-errors-in-jsp-tp24120894p24129281.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Custom validation interceptor

2009-06-20 Thread Peter Bliznak
  Hi,I have following requirement:If validation of the page fails 3 times
 in row - invalidate session and redirect to index page.Should I replace default validation interceptor in default stack with my own to achieve what I am after?I there any other way?Any hint would be greatly appreciatedPeter.  

using multiple param in s:url tag

2009-06-20 Thread Bhaarat Sharma
Hello,

I am using param tag inside s:url tag like the following

td class=nav
   s:url action=ActionEditSave method=input id=url
   s:param name=fmrTenant.sSN value=sSN/
  s:param name=fmrTenant.hshid value=hshid/
   /s:url
   a href=s:property value=#url/s:text name=tenant.edit//a
/td

hshid is int
sSN is string

However, in the final URL the two parameters are separated by amp;  This
should not be there.  Does anyone know how to avoid amp;?


Re: using multiple param in s:url tag

2009-06-20 Thread Bhaarat Sharma
according to documentation...if I try to use escapeAmp property in my s:url
tag then I get the following error...

Attribute escapeAmp invalid for tag url according to TLD

On Sat, Jun 20, 2009 at 7:16 PM, Bhaarat Sharma bhaara...@gmail.com wrote:

 Hello,

 I am using param tag inside s:url tag like the following

 td class=nav
s:url action=ActionEditSave method=input id=url
s:param name=fmrTenant.sSN value=sSN/
   s:param name=fmrTenant.hshid value=hshid/
/s:url
a href=s:property value=#url/s:text
 name=tenant.edit//a
 /td

 hshid is int
 sSN is string

 However, in the final URL the two parameters are separated by amp;  This
 should not be there.  Does anyone know how to avoid amp;?



Re: Custom validation interceptor

2009-06-20 Thread Wes Wannemacher
I don't think a custom interceptor is required. You could probably get
this done through hidden parameters or by storing attempts in the
session or something. Do you have this req for one action or all
actions in the app?

On 6/20/09, Peter Bliznak bliz...@rogers.com wrote:
 Hi,
 I have following requirement:
 If validation of the page fails 3 times in row - invalidate session and
 redirect to index page.
 Should I replace default validation interceptor in default stack with my own
 to achieve what I am after?
 I there any other way?
 Any hint would be greatly appreciated

 Peter.



-- 
Wes Wannemacher
Author - Struts 2 In Practice
Includes coverage of Struts 2.1, Spring, JPA, JQuery, Sitemesh and more
http://www.manning.com/wannemacher

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: using multiple param in s:url tag

2009-06-20 Thread Bhaarat Sharma
nevermind..solved it.

had to used 'escape' in s:property tag.

like this: s:property value=#url escape=amp;/

On Sat, Jun 20, 2009 at 7:25 PM, Bhaarat Sharma bhaara...@gmail.com wrote:

 according to documentation...if I try to use escapeAmp property in my s:url
 tag then I get the following error...

 Attribute escapeAmp invalid for tag url according to TLD


 On Sat, Jun 20, 2009 at 7:16 PM, Bhaarat Sharma bhaara...@gmail.comwrote:

 Hello,

 I am using param tag inside s:url tag like the following

 td class=nav
s:url action=ActionEditSave method=input id=url
s:param name=fmrTenant.sSN value=sSN/
   s:param name=fmrTenant.hshid value=hshid/
/s:url
a href=s:property value=#url/s:text
 name=tenant.edit//a
 /td

 hshid is int
 sSN is string

 However, in the final URL the two parameters are separated by amp;  This
 should not be there.  Does anyone know how to avoid amp;?





Re: Custom validation interceptor

2009-06-20 Thread Dave Newton

Peter Bliznak wrote:

I have following requirement: If validation of the page fails 3 times
in row - invalidate session and redirect to index page. Should I
replace default validation interceptor in default stack with my own
to achieve what I am after? I there any other way?


Is this across the entire app or just a single action?

If it's just a single action then this could probably be done via a 
session var or a hidden counter (updated in the actions validate() 
method)... although I'm not sure how you'd tell the workflow interceptor 
to go to the strike three page.


AFAICT the workflow.inputResultName parameter doesn't eval OGNL, so 
you'd have to set the result location in the action--seems messy.


I started off thinking no on the interceptor, but now I'm not so sure.

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: using multiple param in s:url tag

2009-06-20 Thread Dave Newton

Bhaarat Sharma wrote:

had to used 'escape' in s:property tag.

like this: s:property value=#url escape=amp;/


Just FYI, the escape attribute is a boolean (true/false).

I forget when s:url's escapeAmp property was added--knowing what 
version of S2 you're using would be a helpful diagnostic.


Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Custom validation interceptor

2009-06-20 Thread Peter Bliznak
It is across entire app (there are many dozen of actions) - every single action 
has to have same behavior - 3 crosses go and try again.
It's app for changing personal info on government issued documents - sorta 
wizard like thing.
I can see how I can do it by keeping eye of parameters - but I am looking for 
cleanest possible implementation.
But if I decide to modify default stack I am not certain what might be 
consequences for the rest of app.






From: Dave Newton newton.d...@yahoo.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Saturday, June 20, 2009 7:57:24 PM
Subject: Re: Custom validation interceptor

Peter Bliznak wrote:
 I have following requirement: If validation of the page fails 3 times
 in row - invalidate session and redirect to index page. Should I
 replace default validation interceptor in default stack with my own
 to achieve what I am after? I there any other way?

Is this across the entire app or just a single action?

If it's just a single action then this could probably be done via a session var 
or a hidden counter (updated in the actions validate() method)... although I'm 
not sure how you'd tell the workflow interceptor to go to the strike three 
page.

AFAICT the workflow.inputResultName parameter doesn't eval OGNL, so you'd have 
to set the result location in the action--seems messy.

I started off thinking no on the interceptor, but now I'm not so sure.

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Re: Custom validation interceptor

2009-06-20 Thread Dave Newton

Peter Bliznak wrote:

It is across entire app (there are many dozen of actions) - every
single action has to have same behavior - 3 crosses go and try again.
 It's app for changing personal info on government issued documents -
sorta wizard like thing. I can see how I can do it by keeping eye of
parameters - but I am looking for cleanest possible implementation. 
But if I decide to modify default stack I am not certain what might

be consequences for the rest of app.


None, if you do it right.

Since it's across the entire app I'd go the interceptor route--but 
you're still going to have to either use a hidden parameter, keep 
something in session, or whatever. Both have their advantages and 
disadvantages, but are basically the same complexity.


I'd probably consider modifying the s:form template to insert a hidden 
parameter, but that leaves it vulnerable to someone spoofing the 
validation count--if that's an issue. Otherwise you'd have to track a 
session variable, re-initialize it when a form is displayed for the 
first time, and so on.


Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: Custom validation interceptor

2009-06-20 Thread Peter Bliznak
Preciously!..what you said about changing form is exactly what I was thinking.





From: Dave Newton newton.d...@yahoo.com
To: Struts Users Mailing List user@struts.apache.org
Sent: Saturday, June 20, 2009 8:35:50 PM
Subject: Re: Custom validation interceptor

Peter Bliznak wrote:
 It is across entire app (there are many dozen of actions) - every
 single action has to have same behavior - 3 crosses go and try again.
  It's app for changing personal info on government issued documents -
 sorta wizard like thing. I can see how I can do it by keeping eye of
 parameters - but I am looking for cleanest possible implementation. But if I 
 decide to modify default stack I am not certain what might
 be consequences for the rest of app.

None, if you do it right.

Since it's across the entire app I'd go the interceptor route--but you're still 
going to have to either use a hidden parameter, keep something in session, or 
whatever. Both have their advantages and disadvantages, but are basically the 
same complexity.

I'd probably consider modifying the s:form template to insert a hidden 
parameter, but that leaves it vulnerable to someone spoofing the validation 
count--if that's an issue. Otherwise you'd have to track a session variable, 
re-initialize it when a form is displayed for the first time, and so on.

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

confusion about s:select with multiple true

2009-06-20 Thread Bhaarat Sharma
I have been playing around with this sample code:

s:select label=Months
   name=months
   headerKey=-1 headerValue=Select Month
   list=#{'01':'Jan', '02':'Feb'}
   value=#{'01','02'}
multiple=true
required=true/


This works as I want it to.  My question is, if I want values for 'list' and
'value' coming from the action class then should the method for list be
returning a hashMap? and value be returning a list? is that the only way?


Re: confusion about s:select with multiple true

2009-06-20 Thread Dave Newton

Bhaarat Sharma wrote:

I have been playing around with this sample code:

s:select label=Months
   name=months
   headerKey=-1 headerValue=Select Month
   list=#{'01':'Jan', '02':'Feb'}
   value=#{'01','02'}
multiple=true
required=true/

This works as I want it to.  My question is, if I want values for 'list' and
'value' coming from the action class then should the method for list be
returning a hashMap? and value be returning a list? is that the only way?


Did you try using a list for the list attribute? Or check out the docs 
regarding the list, listKey, and listValue attributes?


http://struts.apache.org/2.1.6/docs/select.html

Dave

-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Sam Wun
Opps. I commented out the taglibs in a jsp file.
Added back in, now got antoehr problem with the getters:

14:48:04,429 ERROR [PortletRequestDispatcherImpl:316]
org.apache.jasper.JasperException: javax.servlet.ServletException:
javax.servlet.jsp.JspException: No getter method for property: ship
ping_address of bean: OrderForm
org.apache.jasper.JasperException: javax.servlet.ServletException:
javax.servlet.jsp.JspException: No getter method for property:
shipping_address of bean: OrderForm
at 
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

I have the getters/setters in this java file.
Here are the relevant files:

1/ order.jsp:
%@ include file=/html/portlet/onlinepayment_portlet/init.jsp %

bean:define id=shipping_address name=OrderForm
property=shipping_address type=java.lang.String /

logic:messagesPresent
span class=es-error
bean:message key=error.shipping_address.invalid/
/span
/logic:messagesPresent

!--
p align=right
   a href=portlet:renderURL portletMode=help /Help/a
/p
--
p align=centre
html:form action=/onlinepayment_portlet/order method=post
focus=shipping_address

table class=stats
tr
  thbean:message key=form.shipping_address//th
  thhtml:text name=OrderForm property=shipping_address size=50 //th
tr
  thbean:message key=form.billilng_address//th
thhtml:text name=OrderForm property=billing_address size=50 //th
/tr
tr
  thbean:message key=form.email_address//th
 thhtml:text name=OrderForm property=email_address size=50 //th
/tr
tr valign=top
  thbean:message key=form.firstname//th
 thhtml:textarea name=OrderForm property=firstname
rows=12 cols=50 //th
/tr
tr valign=top
  thbean:message key=form.lastname//th
 thhtml:textarea name=OrderForm property=lastname rows=12
cols=50 //th
/tr

/table
/p

p align=left
   html:submitbean:message key=button.submit//html:submit
   /html:form
/p

2/ OrderForm.java:
package com.ip6networks.onlinepayment.portlet;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 * Search query entry form.
 *
 * @struts.form name=OrderForm
 */
public class OrderForm extends ActionForm{
private String firstname=;
private String lastname=;
private String email_address=;
private String phone_number=;
private String shipping_address=;
private String billing_address=;
/**
 * Sets the query attribute of the OrderForm object
 *
 * @struts.validator type=required msgkey=error.firstname.required
 * @struts.validator type=required msgkey=error.lastname.required
 * @struts.validator type=required msgkey=error.email_address.required
 * @struts.validator type=required msgkey=error.phone_number.required
 * @struts.validator type=required
msgkey=error.shipping_address.required
 * @struts.validator type=required msgkey=error.billing_address.required
 */
public void setFirstName(String fn){
this.firstname = fn;
}
public String getFirstName(){
return this.firstname;
}
public void setLastName(String ln){
this.lastname = ln;
}
public String getLastName(){
return this.lastname;
}
public void setEmailAddress(String email){
this.email_address = email;
}
public String getEmailAddress(){
return this.email_address;
}
public void setShippingAddress(String shipping) {
this.shipping_address = shipping;
}
public String getShippingAddress(){
return this.shipping_address;
}
public void setBillingAddress(String billing) {
this.billing_address = billing;
}
public String getBillingAddress(){
return this.billing_address;
}
public void setPhoneNumber(String ph) {
this.phone_number = ph;
}
public String getPhoneNumber(){
return this.phone_number;
}

public void reset(ActionMapping mapping, HttpServletRequest req) {
this.firstname=;
this.lastname=;
this.phone_number=;
this.email_address=;
this.shipping_address=;
this.billing_address=;
}

...
}

I have already defined a set of getters/setters methods, I don't
understand why it still complained.
Is a problem in my path setting, thus it can't find my OrderForm.class?

Thanks

On Sun, Jun 21, 2009 at 6:13 AM, Dave Newtonnewton.d...@yahoo.com wrote:
 Did you 

RE: Doubt with using check box

2009-06-20 Thread Vishnu Vyasan Nelliparmbil

Can anybody help me on this issue?




-Original Message-
From: Vishnu Vyasan Nelliparmbil [mailto:vis...@mun.gov.bh] 
Sent: 20 June 2009 13:21
To: Struts Users Mailing List
Subject: RE: Doubt with using check box



Pawel , can you expalin  with a example. I am totally new to struts.

I tried with another way.

Ie by adding a 'selected' field to the EmployeeBean. 

logic:iterate id=EmployeeBean name=EMPLOYEE scope=session
tr
td bean:write name= EmployeeBean property=employee_name //td
td bean:write name= EmployeeBean property=employee_salary //td
tdhtml:checkbox name= EmployeeBean property=selected 
onchange=checkEmployee();  /html:checkbox  
tr
/logic:iterate

Now I am getting the values of selected as false in the Action. Even though I 
have selected it.
I am using a action form for the some other elements in the same view.

Could you guys can through some light on how to make this work?


Regards
Vishnu 



-Original Message-
From: Paweł Wielgus [mailto:poulw...@gmail.com] 
Sent: 20 June 2009 10:40
To: Struts Users Mailing List
Subject: Re: Doubt with using check box

Hi Vishnu,
on the html page you will have a list of checkboxes with the same name
selectedEmployees and a value of an employee identificator. In the
action create settet setSelectedEmloyees(String[] selectedEmployees),
then in execute You can access this table of employee identificators.
Just as a side note, i don't know what type of is your employee
identificator, so i proposed String, but it can also be long.

Best greetings,
Pawel Wielgus.

2009/6/20, Vishnu Vyasan Nelliparmbil vis...@mun.gov.bh:
 Hi Friends,

 I am new to web development and struts. I have a simple question.

 I am using logic:iterate tag to iterate through a list of Employees
 and display their details.
 The list contains the Employee objects.
 Now while displaying Employee details in a table, the row is ending with
 a check box , so that the user can select employees. The check boxes are
 created dynamically since they are inside the iterate tag.

 Now how in Action I know that a specific employee is selected?

 In action form I would get whether the check box is selected or not. But
 how can I relate that to employees in list?

 Thanks in Advance
 vishnu













-
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org



Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Girish Naik
can you change the bean id to something different than the property name.
and check again.


Regards,
-
Girish Naik
Mobile:-+91-09740091638
girish.n...@gmail.com
Henny Youngmanhttp://www.brainyquote.com/quotes/authors/h/henny_youngman.html
- I told the doctor I broke my leg in two places. He told me to quit
going
to those places.

On Sun, Jun 21, 2009 at 10:24 AM, Sam Wun swun2...@gmail.com wrote:

 Opps. I commented out the taglibs in a jsp file.
 Added back in, now got antoehr problem with the getters:

 14:48:04,429 ERROR [PortletRequestDispatcherImpl:316]
 org.apache.jasper.JasperException: javax.servlet.ServletException:
 javax.servlet.jsp.JspException: No getter method for property: ship
 ping_address of bean: OrderForm
 org.apache.jasper.JasperException: javax.servlet.ServletException:
 javax.servlet.jsp.JspException: No getter method for property:
 shipping_address of bean: OrderForm
at
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
at
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

 I have the getters/setters in this java file.
 Here are the relevant files:

 1/ order.jsp:
 %@ include file=/html/portlet/onlinepayment_portlet/init.jsp %

 bean:define id=shipping_address name=OrderForm
 property=shipping_address type=java.lang.String /

 logic:messagesPresent
span class=es-error
bean:message key=error.shipping_address.invalid/
/span
 /logic:messagesPresent

 !--
 p align=right
   a href=portlet:renderURL portletMode=help /Help/a
 /p
 --
 p align=centre
 html:form action=/onlinepayment_portlet/order method=post
 focus=shipping_address

 table class=stats
 tr
   thbean:message key=form.shipping_address//th
  thhtml:text name=OrderForm property=shipping_address size=50
 //th
 tr
  thbean:message key=form.billilng_address//th
thhtml:text name=OrderForm property=billing_address size=50
 //th
 /tr
 tr
  thbean:message key=form.email_address//th
 thhtml:text name=OrderForm property=email_address size=50
 //th
 /tr
 tr valign=top
  thbean:message key=form.firstname//th
 thhtml:textarea name=OrderForm property=firstname
 rows=12 cols=50 //th
 /tr
 tr valign=top
  thbean:message key=form.lastname//th
 thhtml:textarea name=OrderForm property=lastname rows=12
 cols=50 //th
 /tr

 /table
 /p

 p align=left
   html:submitbean:message key=button.submit//html:submit
   /html:form
 /p

 2/ OrderForm.java:
 package com.ip6networks.onlinepayment.portlet;

 import javax.servlet.http.HttpServletRequest;

 import org.apache.struts.action.ActionErrors;
 import org.apache.struts.action.ActionForm;
 import org.apache.struts.action.ActionMapping;
 import org.apache.struts.action.ActionMessage;

 /**
  * Search query entry form.
  *
  * @struts.form name=OrderForm
  */
 public class OrderForm extends ActionForm{
private String firstname=;
private String lastname=;
private String email_address=;
private String phone_number=;
private String shipping_address=;
private String billing_address=;
/**
 * Sets the query attribute of the OrderForm object
 *
 * @struts.validator type=required msgkey=error.firstname.required
 * @struts.validator type=required msgkey=error.lastname.required
 * @struts.validator type=required
 msgkey=error.email_address.required
 * @struts.validator type=required
 msgkey=error.phone_number.required
 * @struts.validator type=required
 msgkey=error.shipping_address.required
 * @struts.validator type=required
 msgkey=error.billing_address.required
 */
public void setFirstName(String fn){
this.firstname = fn;
}
public String getFirstName(){
return this.firstname;
}
public void setLastName(String ln){
this.lastname = ln;
}
public String getLastName(){
return this.lastname;
}
public void setEmailAddress(String email){
this.email_address = email;
}
public String getEmailAddress(){
return this.email_address;
}
public void setShippingAddress(String shipping) {
this.shipping_address = shipping;
}
public String getShippingAddress(){
return this.shipping_address;
}
public void setBillingAddress(String billing) {
this.billing_address = billing;
}
public String getBillingAddress(){
return this.billing_address;
}
public void setPhoneNumber(String ph) {
this.phone_number = ph;
}
public String getPhoneNumber(){
return this.phone_number;
}


Re: Doubt with using check box

2009-06-20 Thread Girish Naik
You can look at *Map Backed
ActionForms*http://struts.apache.org/1.x/userGuide/building_controller.htmlSection
4.3.3



Regards,
-
Girish Naik
Mobile:-+91-09740091638
girish.n...@gmail.com
P. J. O'Rourkehttp://www.brainyquote.com/quotes/authors/p/p_j_orourke.html
- If government were a product, selling it would be illegal.

On Sun, Jun 21, 2009 at 10:26 AM, Vishnu Vyasan Nelliparmbil 
vis...@mun.gov.bh wrote:


 Can anybody help me on this issue?




 -Original Message-
 From: Vishnu Vyasan Nelliparmbil [mailto:vis...@mun.gov.bh]
 Sent: 20 June 2009 13:21
 To: Struts Users Mailing List
 Subject: RE: Doubt with using check box



 Pawel , can you expalin  with a example. I am totally new to struts.

 I tried with another way.

 Ie by adding a 'selected' field to the EmployeeBean.

 logic:iterate id=EmployeeBean name=EMPLOYEE scope=session
 tr
td bean:write name= EmployeeBean property=employee_name
 //td
td bean:write name= EmployeeBean property=employee_salary
 //td
tdhtml:checkbox name= EmployeeBean property=selected
 onchange=checkEmployee();  /html:checkbox
 tr
 /logic:iterate

 Now I am getting the values of selected as false in the Action. Even though
 I have selected it.
 I am using a action form for the some other elements in the same view.

 Could you guys can through some light on how to make this work?


 Regards
 Vishnu



 -Original Message-
 From: Paweł Wielgus [mailto:poulw...@gmail.com]
 Sent: 20 June 2009 10:40
 To: Struts Users Mailing List
 Subject: Re: Doubt with using check box

 Hi Vishnu,
 on the html page you will have a list of checkboxes with the same name
 selectedEmployees and a value of an employee identificator. In the
 action create settet setSelectedEmloyees(String[] selectedEmployees),
 then in execute You can access this table of employee identificators.
 Just as a side note, i don't know what type of is your employee
 identificator, so i proposed String, but it can also be long.

 Best greetings,
 Pawel Wielgus.

 2009/6/20, Vishnu Vyasan Nelliparmbil vis...@mun.gov.bh:
  Hi Friends,
 
  I am new to web development and struts. I have a simple question.
 
  I am using logic:iterate tag to iterate through a list of Employees
  and display their details.
  The list contains the Employee objects.
  Now while displaying Employee details in a table, the row is ending with
  a check box , so that the user can select employees. The check boxes are
  created dynamically since they are inside the iterate tag.
 
  Now how in Action I know that a specific employee is selected?
 
  In action form I would get whether the check box is selected or not. But
  how can I relate that to employees in list?
 
  Thanks in Advance
  vishnu
 
 
 
 
 
 
 
 
 
 
 
 

 -
 To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
 For additional commands, e-mail: user-h...@struts.apache.org




Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Sam Wun
Hi,

I changed the property match the get methods, eg. if a getter is
getShippingAddress(), my property is ShippingAddress.
but it still complained ShippingAddress has no getter method:

3:20,454 ERROR [PortletRequestDispatcherImpl:316]
org.apache.jasper.JasperException: javax.servlet.ServletException:
javax.servlet.jsp.JspException: No getter method for property:
ShippingAddress of bean: OrderForm
org.apache.jasper.JasperException: javax.servlet.ServletException:
javax.servlet.jsp.JspException: No getter method for property:
ShippingAddress of bean: OrderForm
at 
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)

 - OrderForm.java:
public class OrderForm extends ActionForm{
private String firstname=;
private String lastname=;
private String email_address=;
private String phone_number=;
private String shipping_address=;
private String billing_address=;

public void setShippingAddress(String shipping) {
this.shipping_address = shipping;
}
public String getShippingAddress(){
return this.shipping_address;
}
...

- order.jsp:
%@ include file=/html/portlet/onlinepayment_portlet/init.jsp %

bean:define id=shipping_address name=OrderForm
property=ShippingAddress type=java.lang.String /

logic:messagesPresent
span class=es-error
bean:message key=error.shipping_address.invalid/
/span
/logic:messagesPresent

!--
p align=right
   a href=portlet:renderURL portletMode=help /Help/a
/p
--
p align=centre
html:form action=/onlinepayment_portlet/order method=post
focus=shipping_address

table class=stats
tr
  thbean:message key=form.shipping_address//th
  thhtml:text name=OrderForm property=ShippingAddress size=50 //th
tr

Thanks


On Sun, Jun 21, 2009 at 3:25 PM, Girish Naikgirish.n...@gmail.com wrote:
 can you change the bean id to something different than the property name.
 and check again.


 Regards,
 -
 Girish Naik
 Mobile:-+91-09740091638
 girish.n...@gmail.com
 Henny 
 Youngmanhttp://www.brainyquote.com/quotes/authors/h/henny_youngman.html
 - I told the doctor I broke my leg in two places. He told me to quit
 going
 to those places.

 On Sun, Jun 21, 2009 at 10:24 AM, Sam Wun swun2...@gmail.com wrote:

 Opps. I commented out the taglibs in a jsp file.
 Added back in, now got antoehr problem with the getters:

 14:48:04,429 ERROR [PortletRequestDispatcherImpl:316]
 org.apache.jasper.JasperException: javax.servlet.ServletException:
 javax.servlet.jsp.JspException: No getter method for property: ship
 ping_address of bean: OrderForm
 org.apache.jasper.JasperException: javax.servlet.ServletException:
 javax.servlet.jsp.JspException: No getter method for property:
 shipping_address of bean: OrderForm
        at
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:522)
        at
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
        at
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
        at
 org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)

 I have the getters/setters in this java file.
 Here are the relevant files:

 1/ order.jsp:
 %@ include file=/html/portlet/onlinepayment_portlet/init.jsp %

 bean:define id=shipping_address name=OrderForm
 property=shipping_address type=java.lang.String /

 logic:messagesPresent
        span class=es-error
        bean:message key=error.shipping_address.invalid/
        /span
 /logic:messagesPresent

 !--
 p align=right
   a href=portlet:renderURL portletMode=help /Help/a
 /p
 --
 p align=centre
 html:form action=/onlinepayment_portlet/order method=post
 focus=shipping_address

 table class=stats
 tr
   thbean:message key=form.shipping_address//th
  thhtml:text name=OrderForm property=shipping_address size=50
 //th
 tr
  thbean:message key=form.billilng_address//th
    thhtml:text name=OrderForm property=billing_address size=50
 //th
 /tr
 tr
  thbean:message key=form.email_address//th
     thhtml:text name=OrderForm property=email_address size=50
 //th
 /tr
 tr valign=top
  thbean:message key=form.firstname//th
     thhtml:textarea name=OrderForm property=firstname
 rows=12 cols=50 //th
 /tr
 tr valign=top
  thbean:message key=form.lastname//th
     thhtml:textarea name=OrderForm property=lastname rows=12
 cols=50 //th
 /tr

 /table
 /p

 p align=left
   html:submitbean:message key=button.submit//html:submit
   /html:form
 /p

 2/ OrderForm.java:
 

Re: File /WEB-INF/tld/struts-bean.tld not found

2009-06-20 Thread Girish Naik
If your getter is 'getShippingAddress()' then your property will be
'shippingAddress' .


Regards,
-
Girish Naik
Mobile:-+91-09740091638
girish.n...@gmail.com
Fran Lebowitzhttp://www.brainyquote.com/quotes/authors/f/fran_lebowitz.html
- Life is something to do when you can't get to sleep.

On Sun, Jun 21, 2009 at 11:09 AM, Sam Wun swun2...@gmail.com wrote:

 getShippingAddress()