Re: IS struts 2 websphere compatible?

2008-09-10 Thread Priyanka.dandekar

YES, you can backport struts 2 core and dependancy jar files to JDK 1.4 and
use them. 

Here are the details of backporting 

http://struts-2-developers.blogspot.com/2008/08/backporting-struts-2-to-jdk14-using.html
Backporting Struts 2 to JDK 1.4 

Regards,
Priya


Praveen, Galagali (IE10) wrote:
 
 Hi,
 
  
 
 If struts2 needs jdk version 5 and if websphere 5.x or 6.x is not
 compatible with jdk 1.5 can we still use struts 2 for our application
 and still get it work fine ? 
 
  
 
 Thanks,
 
 Praveen
 
  
 
 
 

-- 
View this message in context: 
http://www.nabble.com/IS-struts-2--websphere-compatible--tp9017881p19425010.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Custom validation with Struts2

2008-09-10 Thread Priyanka.dandekar

If Integer Range Validator does not work for you then you shoud consider
regular expression validation for same, its can be done by restricting
number of digits and allowing only numeric characters.

Here is an example of similar problem 
http://struts-2-developers.blogspot.com/2008/08/struts-2-integer-validation-example.html
Struts 2 Integer Validation  


fil78 wrote:
 
 Hello everybody,
 
  
 
 I need to validate only 1 field on the jsp. It value should be between 1
 and 99. Initially I started to implement through int validation but it
 seemed to go wrong - it works with some limitation - maximum value should
 not exceed 1000 or something like that. I am trying to implement
 validation through overriding validate() method. I use tiles together with
 Struts 2.0.11. I could not tune it to work correctly. Could someone help,
 please?
 
  
 
 Here are my snippets:
 
  
 
  
 
 Struts.xml:
 
  
 
     action name=EmployeeCard
 
   class=com.tsystems.tintra4.actions.EmployeeCard
 
   interceptor-ref name=i18n /
 
   interceptor-ref name=roles
 
     WTT_CARDS_EDITOR
 
   /interceptor-ref
 
   !-- interceptor-ref name=workflow/--
 
   interceptor-ref name=workflow/
 
   result type=tiles
 name=SUCCESSdef_page_employee_card/result
 
   result type=tiles name=input
 
     def_page_employee_card
 
   /result
 
     /action
 
  
 
  
 
 Jsp:
 
  
 
 %@ page language=java contentType=text/html; charset=UTF-8
 
     pageEncoding=UTF-8%
 
 %@ taglib prefix=s uri=/struts-tags %
 
  
 
 !--Reference to the Employee profile--
 
  
 
 div
 
 s:url id=url_fio action=GetEmployee includeParams=none
 
   s:param name=employeeIds:property value=%{EmpNo}//s:param
 
 /s:url
 
 s:a href=%{url_fio}
 
   s:property value=%{fio}/
 
 /s:a
 
 /div
 
 br/
 
  
 
 !--Adding new card--
 
  
 
 s:if test=addCard == true
 
 s:text name=card_adding_proccess/s:text
 
 s:fielderror/
 
 s:form method=GET validate=true
 
   s:textfield name=cardNo
 label=%{getText('card_add_edit_field')}/s:textfield
 
   s:textfield name=EmpNo value=%{EmpNo}/s:textfield
 
   s:hidden name=editCard value=%{true}/s:hidden
 
   s:hidden name=addCardFinal value=%{true}/s:hidden
 
   s:submit value=%{getText('button_submit')}/
 
 /s:form
 
 /s:if
 
  
 
 !--Editing new card--
 
  
 
 s:if test=editCard == true
 
 s:text name=card_editing_proccess/s:text
 
 s:fielderror/
 
 s:form method=GET validate=true
 
   s:textfield name=cardNo
 label=%{getText('card_add_edit_field')}/s:textfield
 
   s:hidden name=EmpNo value=%{EmpNo}/s:hidden
 
   s:hidden name=editCard value=%{true}/s:hidden
 
   s:hidden name=editCardFinal value=%{true}/s:hidden
 
   s:submit value=%{getText('button_submit')}/
 
 /s:form
 
 /s:if
 
  
 
 JAVA Action:
 
  
 
 public void validate() {
 
     request = ServletActionContext.getRequest();
 
     String tmp = ;
 
     try {
 
   tmp = request.getParameter(cardNo);
 
   Integer i = this.getCardNo();
 
   if (tmp != null  tmp.length()  0) {
 
     int tmpInt = Integer.parseInt(tmp);
 
     this.setCardNo(tmpInt);
 
     System.out.println(Card no (validation) =  +
 cardNo);
 
     if (cardNo  1 || cardNo  99) {
 
  
 
  addFieldError(cardNo, Must be int);
 
  
 
  
 
  System.out.println(INPUT...);
 
     }
 
   }
 
     } catch (Exception e) {
 
  
 
   e.printStackTrace();
 
     }
 
  
 
   }
 
  
 
 Thanx a lot.
 
  
 
 Best regards, Filippov Andrey
 
 
 

-- 
View this message in context: 
http://www.nabble.com/Custom-validation-with-Struts2-tp16115973p19425117.html
Sent from the Struts - User mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Struts 2 onchange event to get values from databases

2008-08-23 Thread Priyanka.dandekar



Johnson nickel wrote:
 
 Thanks for your quick response.
 I have created Jsp and action and struts.xml. you are mistaken
 me(imlazy), i'm not
 asking  the code for my requirement.
 
  I want to display the userdetails, at the time of  Onchange
 event. I don't want 
 to use javascript. My details are getting from db. If you provide some
 examples in AJAX 
 than it will be helpful.
 
 Johan Snyman wrote:
 
 Dude,
 
 Here is an example which shows how you can populate a drop down using
 AJAX
 
 http://struts-2-developers.blogspot.com/2008/07/struts-2-ajax-drop-down-example.html
 
 Hope this helps
 
 Regards,
 Priya
 
 
 Me thinks you're lazy for not going through the tutorials supplied on the
 documentation site: http://struts.apache.org/2.x/docs/home.html
 
 You'll have to set up 'n struts.xml file (saved in WEB-INF/classes
 folder)
 that looks something like this:
 
 !DOCTYPE struts PUBLIC
 -//Apache Software Foundation//DTD Struts Configuration 2.0//EN
 http://struts.apache.org/dtds/struts-2.0.dtd;
 struts
 !-- constant name=struts.devMode value=false / --
 constant name=struts.enable.DynamicMethodInvocation value=false
 /
 
 package name=mypackage  extends=struts-default
 
 action name=display class=com.imlazy.DisplayUserDetails
   resultuserdetails,jsp/result
 /action
 /struts
 
 You'll have to implement the action class, which has the values you want
 to
 pass to your jsp declared with getters and setter for each of them
 (JavaBean
 style):
 
 package com.imlazy;
 
 import **;
 
 @SuppressWarnings(serial)
 public class DisplayUserDetails extends ActionSupport {
 
private String userName;
private String userAddress;
private ListString userNameList;
// etc
 
   @Override
   public String execute() throws Exception {
 // HERE YOU DO YOUR DB ACCESS AND WHATEVER TO POPULATE YOUR FIELDS
   }
 
   public String getUserName() {
 return userName;
   }
 
   public void setUsername(String userName) {
 this.userName = username;
   }
 
   // Other getters and setters
 }
 
 And finally your jsp that will be displaying the fields:
 
 %@ page contentType=text/html;charset=UTF-8 language=java %
 %@ taglib prefix=s uri=/struts-tags %
 
 html
   head
   titleUser Details/title
   /head
 
   body
 s:form
   s:combobox label=Users list=HERE YOU MUST DEFINE THE LIST
 headerKey=-1 /
   
  s:textfield key=userName
   !-- HERE FOLLOWS YOUR OTHER FIELD --
 /s:form
   /body
 /html
 
 
 
 This is just touching what you need to do and know. Most important is to
 understand. Go through the tutorial, know what you need to get an action
 to
 display what you want to display (choose one user and just display the
 values for that user). Only then start thinking about AJAX and how you
 should be changing what is displayed as the combobox is changed.
 
 
 
 Jo
 
 
 
 
 
 -Original Message-
 From: Johnson nickel [mailto:[EMAIL PROTECTED] 
 Sent: 31 January 2008 07:35 AM
 To: user@struts.apache.org
 Subject: RE: Struts 2 onchange event to get values from databases
 
 
 
  I am very new to Struts 2 and Ajax. If u have any samples please send
 it. 
 
 Johan Snyman wrote:
 
 Hi Johnson (and others),
 I'm not really as retarded as I sound in the previous mail, just
 distracted
 while I was composing the mail. Please contact me if you find it as
 difficult to follow as I did after reading the first reply...
 
 Jo
 
 
 
 
 -Original Message-
 From: Johan Snyman [mailto:[EMAIL PROTECTED] 
 Sent: 30 January 2008 03:43 PM
 To: 'Struts Users Mailing List'
 Subject: RE: Struts 2 onchange event to get values from databases
 
 Hi Johnson,
 
 I'm no Struts expert but from my experience you have two ways of
 implementing what you want to achieve.
 
 1. You can populate your dropdown box and have the fields empty. On your
 element you can set the onchange to call a javascript function that
 calls
 the same action, but passing it the content of your combobox, to do your
 database lookup on the server side and then pass the info to your
 userdetails.jsp where you can set your fields.
 
 2. You can use AJAX to do the call asynchrononously, that is the value
 is
 passed to an action on the server and without the values passed back and
 filled into your fields. Nowadays you'll find plenty of tutorials and
 examples out there. Check out the following:
 
 http://struts.apache.org/2.x/docs/ajax.html
 (the official Struts AJAX guide)
 
 http://www.roseindia.net/struts/struts2/struts2ajax/index.shtml
 (easy login example)
 

 http://www.javaworld.com/javaworld/jw-08-2007/jw-08-ajaxtables.html?fsrc=rss
 -index
 (although is a rather tough example to follow if you're new to AJAX)
 
 http://www.planetstruts.org/struts2-showcase/showcase.action
 (showcase examples)
 
 Hope this helps
 
 Jo
 
 
 
 -Original Message-
 From: Johnson nickel [mailto:[EMAIL PROTECTED] 
 Sent: 30 January 2008 03:26 PM
 To: user@struts.apache.org