Java Mailing List Archive

http://www.gg3721.com/

Home » Struts Users Mailing List »

user Digest 18 Mar 2008 15:19:37 -0000 Issue 7933

user-digest-help

2008-03-18


Author LoginPost Reply

user Digest 18 Mar 2008 15:19:37 -0000 Issue 7933

Topics (messages 184382 through 184411):

Re: Struts2 Annotation based Validation
 184382 by: Lukasz Lenart
 184385 by: Tauri Valor
 184386 by: Tauri Valor
 184388 by: Lukasz Lenart
 184391 by: Tauri Valor
 184393 by: Lukasz Lenart

Re: Custom validation with Struts2
 184383 by: Lukasz Lenart
 184389 by: Filippov, Andrey
 184394 by: Lukasz Lenart
 184406 by: Laurie Harper

Re: struts 1.2 html:select and submit button
 184384 by: Antonio Petrelli

Re: <s:date>
 184387 by: meeboo
 184390 by: Alexis Pigeon

More WebLogic troubles.
 184392 by: Alex Shneyderman
 184395 by: Alex Shneyderman

[S2] DEBUG NPE
 184396 by: Hoying, Ken

Re: Something odd with deployment to WL 10
 184397 by: Crocker, Patrick

Re: Strtus 2.0.11 AJAX TabbedPanel with Remote tabs: How to load the result page in another tab
 184398 by: Jeromy Evans

Re: authentication question
 184399 by: mojoRising
 184401 by: Jeromy Evans
 184407 by: Laurie Harper
 184408 by: Mike Jennings

Re: [struts] Struts 2 and JSP 2.0 tags
 184400 by: Kalpesh Modi

Re: Struts 1.3 : DynaValidatorActionForm missing input form data on  errors display
 184402 by: Laurie Harper

Re: [S2] variable of variable in OGNL?
 184403 by: Laurie Harper

Re: Can validation be evaluated ahead of time to paint JQuery  validation rules?
 184404 by: Laurie Harper

Re: Struts 1 return stream (documents)
 184405 by: Laurie Harper
 184410 by: Griffith, Michael *

Checking Field Error
 184409 by: Stefan Schwarz
 184411 by: Dave Newton

Administrivia:

---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)

----------------------------------------------------------------------

Attachment: user_184382.ezm (zipped)
> But when I enter the value in the textbox and click submit again, the
> validation error for next is displayed correctly but entered value
> disappears in the textbox which is abnormal .

Maybe you are redirecting to the next page? Could you paste snippet
for your struts.xml and jsp?


Regards
--
Lukasz

Attachment: user_184385.ezm (zipped)

Hi Lukasz,

Thanks for responding..

Snippet of Jsp:


<form name="myForm" method="post" action="MyAction.do" validate="true"/>


<tr>
                 <td width="115">First Name</td>
                 <td width="142"><input type="text" name="firstName" id="firstName"
class="form_field"></td>
                 
                 <td>
                 
                 <s:fielderror>
                  <s:param>firstName</s:param>
                 </s:fielderror>
                 </td>
 


My Struts-config:

<action name="MyAction" class="activationPendingAction">
     <result name="input" type="tiles">MyForm</result>
     <result name="failure" type="tiles">MyForm</result>
     <result name="success" type="tiles">SuccessPage</result>
   </action>





Thats the snippet of my code.


Thanks,
Tauri.


Lukasz Lenart wrote:
>
>> But when I enter the value in the textbox and click submit again, the
>> validation error for next is displayed correctly but entered value
>> disappears in the textbox which is abnormal .
>
> Maybe you are redirecting to the next page? Could you paste snippet
> for your struts.xml and jsp?
>
>
> Regards
> --
> Lukasz
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184386.ezm (zipped)

I get the following log in my console:


2008-Mar-18 16:21:17,671 - DEBUG freemarker.cache - Could not find template
in cache, creating new one;
id=[template/xhtml/fielderror.ftl[en_US,UTF-8,parsed] ]
2008-Mar-18 16:21:17,671 - DEBUG freemarker.cache -
template/simple/fielderror.ftl[en_US,UTF-8,parsed] cached copy not yet
stale; using cached.



Does it have anything to do with caching of the page?


Thanks,
Tauri.




Tauri Valor wrote:
>
> Hi Lukasz,
>
> Thanks for responding..
>
> Snippet of Jsp:
>
>
> <form name="myForm" method="post" action="MyAction.do" validate="true"/>
>
>
> <tr>
>                  <td width="115">First Name</td>
>                  <td width="142"><input type="text" name="firstName"
> id="firstName" class="form_field"></td>
>                  
>                  <td>
>                  
>                  <s:fielderror>
>                   <s:param>firstName</s:param>
>                  </s:fielderror>
>                  </td>
>  
>
>
> My Struts-config:
>
> <action name="MyAction" class="activationPendingAction">
>      <result name="input" type="tiles">MyForm</result>
>      <result name="failure" type="tiles">MyForm</result>
>      <result name="success" type="tiles">SuccessPage</result>
>    </action>
>
>
>
>
>
> Thats the snippet of my code.
>
>
> Thanks,
> Tauri.
>
>
> Lukasz Lenart wrote:
>>
>>> But when I enter the value in the textbox and click submit again, the
>>> validation error for next is displayed correctly but entered value
>>> disappears in the textbox which is abnormal .
>>
>> Maybe you are redirecting to the next page? Could you paste snippet
>> for your struts.xml and jsp?
>>
>>
>> Regards
>> --
>> Lukasz
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>
>>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184388.ezm (zipped)
> <form name="myForm" method="post" action="MyAction.do" validate="true"/>
> <tr>
>                                                 <td width="115">First Name</td>
>                                                 <td width="142"><input type="text" name="firstName" id="firstName"
> class="form_field"></td>
>
>                                                 <td>
>
>                                                 <s:fielderror>
>                                                  <s:param>firstName</s:param>
>                                                 </s:fielderror>
>                                                 </td>

But as I see, you don't use <s:textfield> for your form and that's way
you don't see values in the form. If you want to add html tags as
above, use theme=simple and s:textfield


Regards
--
Lukasz

http://www.linkedin.com/in/lukaszlenart

Attachment: user_184391.ezm (zipped)

Thanks Lukasz it worked for textfields using <s:textfield>

But I have the same problem when I use it for <s:password>

this is my listbox:


   
   <tr>
       <td> <s:select label="Country" name="country" headerKey="1"
headerValue="Please Select"
       list="#{'AU':'Australia',        
       'CN':'China',
       'HK':'Hong Kong',
       'IN':'India',
       'ID':'Indonesia',
       'JP':'Japan',
       'MY':'Malaysia',
       'NZ':'New Zealand',
       'PL':'Philippines',
       'SG':'Singapore',
       'KR':'South Korea',
       'TW':'Taiwan',
       'TH':'Thailand'}"/></td>
     </tr>


And my password fields:

 <tr>
       <td><s:password name="pwd" label="Your Password"/></td>
     </tr>

     <tr>
       <td><s:password name="confirmPassword" label="Confirm your Password"
/></td>
     </tr>





Please suggest.

Thanks,
Tauri


I used

Lukasz Lenart wrote:
>
>> <form name="myForm" method="post" action="MyAction.do" validate="true"/>
>> <tr>
>>                                                
>> <td width="115">First Name</td>
>>                                                
>> <td width="142"><input type="text" name="firstName" id="firstName"
>> class="form_field"></td>
>>
>>                                                
>> <td>
>>
>>                                                
>> <s:fielderror>
>>                                                
>> <s:param>firstName</s:param>
>>                                                
>> </s:fielderror>
>>                                                
>> </td>
>
> But as I see, you don't use <s:textfield> for your form and that's way
> you don't see values in the form. If you want to add html tags as
> above, use theme=simple and s:textfield
>
>
> Regards
> --
> Lukasz
>
> http://www.linkedin.com/in/lukaszlenart
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184393.ezm (zipped)
> <td><s:password name="pwd" label="Your Password"/></td>

By default s:password tag don't shows value of your password, you can
change such behaviour by adding attribute showPassword=true, but you
should consider security issue.


Regards
--
Lukasz

http://www.linkedin.com/in/lukaszlenart

Attachment: user_184383.ezm (zipped)
>         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);

Remove this part above

>                 this.setCardNo(tmpInt);

You don't have to do this, it will be done by Struts2

>                 System.out.println("Card no (validation) = " + cardNo);
>                 if (cardNo < 1 || cardNo > 999999) {
>                     addFieldError("cardNo", "Must be int");
>                     System.out.println("INPUT...");
>                 }

That's all you have to have in your validate() method (if cardNo has
getter and setter defined in action class)
Remove also validate=true from your form, because you don't use client
side validation.


Regards
--
Lukasz

http://www.linkedin.com/in/lukaszlenart

Attachment: user_184389.ezm (zipped)
Thanks a lot for your answer. Concerning request =
ServletActionContext.getRequest(); and tmp =
request.getParameter("cardNo"); - I am doing it cause I did not manage
to use getCardNo() method - it always return 0 in the case of int. Here
is my action class - probably you will help me again..))

JAVA class:

package com.my.intra4.actions;

import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.hsqldb.lib.Set;

import com.opensymphony.xwork2.ActionSupport;
import com.my.intra4.ejb.cf.session.PersonalInfoInterface;
import com. my.intra4.ejb.cf.session.UserManagerInterface;
import com. my.intra4.ejb.wtt.CardsVO;
import com. my.intra4.ejb.wtt.WTT;
import com. my.intra4.util.Functions;
import com. my.intra4.util.GetPropsSingle;
import com. my.intra4.util.Menu;

public class EmployeeCard extends ActionSupport implements
ServletRequestAware {

 private static final long serialVersionUID = 564633345679L;
 private HttpServletRequest request;
 private HttpServletResponse response;
 private ArrayList<Menu> menu_items = null;
 private ArrayList<Menu> page_menu_items = null;
 private ArrayList<Menu> page_menu_manager_items = null;
 private String actionName;
 private PersonalInfoInterface pInfoInterface = null;
 private String fio;
 private String EmpNo;
 private CardsVO card;
 private Integer cardNo;
 private String cardN;
 boolean addCard = false;
 boolean editCard = false;
 private String UserId;
 private int fieldName;
 private UserManagerInterface uManagerInterface = null;

 public String getUserId() {
   return UserId;
 }

 public void setUserId(String userId) {
   UserId = userId;
 }

 public UserManagerInterface getUManagerInterface() {
   return uManagerInterface;
 }

 public void setUManagerInterface(UserManagerInterface
managerInterface) {
   uManagerInterface = managerInterface;
 }

 public boolean isAddCard() {
   return addCard;
 }

 public void setAddCard(boolean addCard) {
   this.addCard = addCard;
 }

 public boolean isEditCard() {
   return editCard;
 }

 public void setEditCard(boolean editCard) {
   this.editCard = editCard;
 }

 public Integer getCardNo() {
   return this.cardNo;
 }

 public void setCardNo(Integer cardNo) {
   this.cardNo = cardNo;
 }

 public void validate() {
   // request = ServletActionContext.getRequest();
   // String tmp = "";
   try {
     // tmp = request.getParameter("cardNo");
     // Integer i = this.getCardNo();
     // System.out.println("Card no from get = " +
i);
     // 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 > 9999) {
     //
     // addFieldError("cardNo", "Must be int");
     //          
     // Map map = request.getParameterMap();
     // Set set = (Set) map.keySet();
     // Iterator it = (Iterator) set.iterator();
     //          
     // while (it.hasNext()) {
     // String elem = (String) it.next();
     //            
     // System.out.println("Param " + i + " = " +
map.get(elem));
     //            
     // }
     //    
     //          
     // System.out.println("INPUT...");
     // }
     // }

     System.out.println("Card no (validation) = " +
getCardNo());
     if (getCardNo() != null && (getCardNo() < 0 ||
getCardNo() > 999999)) {
       addFieldError("cardNo", "Must be int");
       System.out.println("INPUT...");
     }

   } catch (Exception e) {

     e.printStackTrace();
   }

 }

 public String execute() throws Exception {

   System.out.println("Start execution...");
   actionName = Functions.getActionName();
   request = ServletActionContext.getRequest();
   // request = ServletActionContext.getRequest();
   this.menu_items = Functions.formMenu();
   this.page_menu_items =
Functions.formPageMenu(this.request);
   this.page_menu_manager_items =
Functions.formEmplManagerMenu();

   // String tmp = "";
   // try {
   // tmp = request.getParameter("cardNo");
   // Integer i = this.getCardNo();
   // System.out.println("Card no from get = " + i);
   // 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 > 9999) {
   //
   // this.addFieldError("cardNo", "Must be int");
   // System.out.println("INPUT...");
   // return "input";
   // }
   // }
   // } catch (Exception e) {
   //
   // e.printStackTrace();
   // }

   EmpNo = request.getParameter("EmpNo");
   uManagerInterface =
GetPropsSingle.getInstance().getUserManager();
   UserId =
uManagerInterface.getUserId(request.getRemoteUser())
       .toString();

   pInfoInterface =
GetPropsSingle.getInstance().getPersonalInfo();
   WTT WTTObject =
GetPropsSingle.getInstance().getWTTObject();

   fio =
pInfoInterface.getEmployeeInfo(Long.parseLong(EmpNo))
       .getSurname()
       + " "
       +
pInfoInterface.getEmployeeInfo(Long.parseLong(EmpNo))
           .getName()
       + " "
       +
pInfoInterface.getEmployeeInfo(Long.parseLong(EmpNo))
           .getPatronymic();

   String tmpAddCard = request.getParameter("addCard");
   String tmpEditCard = request.getParameter("editCard");
   String tmpAddCardFinal =
request.getParameter("addCardFinal");
   String tmpEditCardFinal =
request.getParameter("editCardFinal");

   if (tmpAddCardFinal != null && tmpAddCardFinal != "") {
     CardsVO tmpCard = new CardsVO();
     cardN = request.getParameter("cardNo");
     if (cardN != null && cardN != "") {
       tmpCard.setId(Long.parseLong(cardN));
 
tmpCard.setEmployeId(Long.parseLong(EmpNo));
       WTTObject.addCard(tmpCard);
       response =
ServletActionContext.getResponse();
 
response.sendRedirect(request.getContextPath()
           +
"/GetEmployee.action?employeeId=" + EmpNo);
     }
   }

   if (tmpEditCardFinal != null && tmpEditCardFinal != "")
{
     CardsVO tmpCard = new CardsVO();
     cardN = request.getParameter("cardNo");
     tmpCard =
WTTObject.getCardByEmpID(Long.parseLong(EmpNo));
     if (cardN != null && cardN != "") {
       tmpCard.setId(Long.parseLong(cardN));
 
tmpCard.setEmployeId(Long.parseLong(EmpNo));
       WTTObject.setCard(tmpCard);
       response =
ServletActionContext.getResponse();
 
response.sendRedirect(request.getContextPath()
           +
"/GetEmployee.action?employeeId=" + EmpNo);
     }
   }

   addCard = false;

   if (tmpAddCard != null && tmpAddCard != "") {
     addCard = true;
   }

   editCard = false;

   if (tmpEditCard != null && tmpEditCard != "") {
     editCard = true;
   }

   if (editCard == true) {
     card =
WTTObject.getCardByEmpID(Long.parseLong(EmpNo));
     cardN = String.valueOf(card.getId());
     cardNo =
Integer.parseInt(String.valueOf(card.getId()).trim());
   }
   if (addCard == true) {
     cardN = "";
   }

   return "SUCCESS";
 }

 public String getEmpNo() {
   return EmpNo;
 }

 public void setEmpNo(String empNo) {
   EmpNo = empNo;
 }

 public String getFio() {
   return fio;
 }

 public void setFio(String fio) {
   this.fio = fio;
 }

 public String getActionName() {
   return actionName;
 }

 public void setActionName(String actionName) {
   this.actionName = actionName;
 }

 public void setServletRequest(HttpServletRequest request) {
   // TODO Auto-generated method stub
   this.request = request;
 }

 public ArrayList<Menu> getMenu_items() {
   return menu_items;
 }

 public void setMenu_items(ArrayList<Menu> menu_items) {
   this.menu_items = menu_items;
 }

 public ArrayList<Menu> getPage_menu_items() {
   return page_menu_items;
 }

 public void setPage_menu_items(ArrayList<Menu> page_menu_items)
{
   this.page_menu_items = page_menu_items;
 }

 public ArrayList<Menu> getPage_menu_manager_items() {
   return page_menu_manager_items;
 }

 public void setPage_menu_manager_items(
     ArrayList<Menu> page_menu_manager_items) {
   this.page_menu_manager_items = page_menu_manager_items;
 }

 public CardsVO getCard() {
   return card;
 }

 public void setCard(CardsVO card) {
   this.card = card;
 }

 public HttpServletResponse getResponse() {
   return response;
 }

 public void setResponse(HttpServletResponse response) {
   this.response = response;
 }

 public int getFieldName() {
   return fieldName;
 }

 public void setFieldName(int fieldName) {
   this.fieldName = fieldName;
 }

 public String getCardN() {
   return cardN;
 }

 public void setCardN(String cardN) {
   this.cardN = cardN;
 }

}


-----Original Message-----
From: Lukasz Lenart [mailto:lukasz.lenart@(protected)]
Sent: Tuesday, March 18, 2008 11:09 AM
To: Struts Users Mailing List
Subject: Re: Custom validation with Struts2

>         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);

Remove this part above

>                 this.setCardNo(tmpInt);

You don't have to do this, it will be done by Struts2

>                 System.out.println("Card no (validation) = "
+ cardNo);
>                 if (cardNo < 1 || cardNo > 999999) {
>                     addFieldError("cardNo", "Must be int");
>                     System.out.println("INPUT...");
>                 }

That's all you have to have in your validate() method (if cardNo has
getter and setter defined in action class)
Remove also validate=true from your form, because you don't use client
side validation.


Regards
--
Lukasz

http://www.linkedin.com/in/lukaszlenart

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



Attachment: user_184394.ezm (zipped)
I'm not sure were is the problem but I've just checked such simple
example below and everything is ok. Maybe you should consider to use
Long instead of Integer, because when you enter more then 2147483647
to the field you will get some strange value back to the input
(because you loose precision ;-)

class EmployeeAction extends ActionSupport {

private Integer cardNo; // getter & setter

public void validate() {
    if (cardNo == null) {
       addFieldError("cardNo", "Should be integer!");
    } else if ( cardNo < 1 || cardNo > 999999) {
       addFieldError("cardNo", "Should be integer!");
    }
}

}

JSP

<s:textfield label="Card Number" name="cardNo" />


Regards
--
Lukasz

http://www.linkedin.com/in/lukaszlenart

Attachment: user_184406.ezm (zipped)
Lukasz Lenart wrote:
> I'm not sure were is the problem but I've just checked such simple
> example below and everything is ok. Maybe you should consider to use
> Long instead of Integer, because when you enter more then 2147483647
> to the field you will get some strange value back to the input
> (because you loose precision ;-)
>
> class EmployeeAction extends ActionSupport {
>
> private Integer cardNo; // getter & setter
>
> public void validate() {
>      if (cardNo == null) {
>         addFieldError("cardNo", "Should be integer!");
>      } else if ( cardNo < 1 || cardNo > 999999) {
>         addFieldError("cardNo", "Should be integer!");
>      }
>   }
> }
>
> JSP
>
> <s:textfield label="Card Number" name="cardNo" />
>
> Regards


You may also want to consider declarative validation [1], either using
an XML file or annotations. Struts has built-in support for validating
an integer input is in a given range [2].

As to the problem of getCardNo() always returning 0, that shouldn't
happen; you may have a conversion error happening, or perhaps something
else is mis-configured somewhere. Struts should call setCardNo() for you
to pass the form data in.

L.

[1] http://struts.apache.org/2.0.11/docs/validation.html
[2] http://struts.apache.org/2.0.11/docs/int-validator.html


Attachment: user_184384.ezm (zipped)
2008/3/18, Sonu S <sonu.in@(protected)>:
> 1) there is one submit button on that page and one action is associated with
> that submit button. i can call the associated action class once the user
> finish the form and click the submit button. When user select from list i
> need to call another action class.
>
> I want to know how to call another action class, (when user select something
> from list), as list control is inside the same html:form tag.

Use Javascript.

> 2) When user selects some value from list i need to refresh the page and
> populate the other fields.
>
> I would like to know, Lets say there are ten values and user has selected
> third option, how to keep selected that third option as page is already
> refreshed?


You have two options:
1) the simplest (but I don't like it because it can cause some side
effects): use a session-scoped form bean;
2) the action is called on the "onchange" event of the <select> tag.
The new value of the select tag itself is submitted. You process it
and you reput it inside the HttpServletRequest. In the JSP page, you
can process it (e.g. with the use of EL) to show the previously
selected value.

HTH
Antonio

Attachment: user_184387.ezm (zipped)

Has anyone had success with <s:date /> and setting the struts.date.format
property?


meeboo wrote:
>
> Hi all
>
> I have set my struts.date.format properties but they seem to have no
> effect at all. The set value is
> struts.date.format=yyyy-MM-dd but when using the <s:date> tag the format
> is for example "Jan 14, 2008 8:00:00 AM". All my other properties take
> effect so there's no problem with setting other values via the
> struts.properties file.
>
> In this case am trying to print a java.util.Date object with <s:date
> name="starts" />. It will print out fine if I for instance use <s:date
> name="myDate" format="%{@com.test.StrutsSupport@(protected)}" />
>
> I've also noticed that since you can't nest S2 tags the <s:date> tag
> becomes pretty useless because you can't use it within <s:url> actions. Is
> there a way around this?
>
> Thanks!
>

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184390.ezm (zipped)
Hi,

On 18/03/2008, meeboo <deepstar@(protected):
>
> Has anyone had success with <s:date /> and setting the struts.date.format
> property?
>
> meeboo wrote:
> >
> > Hi all
> >
> > I have set my struts.date.format properties but they seem to have no
> > effect at all.

[snip]

> > I've also noticed that since you can't nest S2 tags the <s:date> tag
> > becomes pretty useless because you can't use it within <s:url> actions. Is
> > there a way around this?

I can't help you with your issue about setting the struts.date.format
property (I never needed the <s:date> tag so far), but as for
"nesting" S2 tags, most often it can easily be done using the
<s:param> tag. See the examples in the tag reference [1].

HTH,
alexis

[1] http://struts.apache.org/2.0.11/docs/url.html

Attachment: user_184392.ezm (zipped)
It seems that anything I do today with WL and struts 2 does not seem
to be working :-(

So, now I have an interceptor (S2 interceptor). I would like to wire a
spring managed service on it. So, I use spring plugin + autowire by
name convention. There is nothing fancy really just a declaration.
but when I run the application in my local jetty setup everything
works normally. I deploy to local WLS (but I do not think this would
be anything different if I deployed remotely) The service does not get
autowired.

Anyone has a clue as to what's wrong with this?

I setup my WL server to prefer classes and libs in WEB-INF so the
classloading issues that might be should not be a problem. There is
something that WL does that seems unconventional I wonder if anyone
had similar experiences and what you guys were doing to tame the beast
?

Thanks,
Alex.

Attachment: user_184395.ezm (zipped)
Well upon further investigation ... the following does not work on WL
but works on jetty

<!-- Listeners -->
<context-param>
 <param-name>contextConfigLocation</param-name>
 <param-value>classpath*:applicationContext*.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

WL becomes happy if this is specified:

<!-- Listeners -->
<context-param>
 <param-name>contextConfigLocation</param-name>
 <param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

The first is the sample from archetype. So, does anyone know why WL is
this retarded and how to make it load ctx from the classpath ?

Alex.

On Tue, Mar 18, 2008 at 12:05 PM, Alex Shneyderman
<a.shneyderman@(protected):
> It seems that anything I do today with WL and struts 2 does not seem
> to be working :-(
>
> So, now I have an interceptor (S2 interceptor). I would like to wire a
> spring managed service on it. So, I use spring plugin + autowire by
> name convention. There is nothing fancy really just a declaration.
> but when I run the application in my local jetty setup everything
> works normally. I deploy to local WLS (but I do not think this would
> be anything different if I deployed remotely) The service does not get
> autowired.
>
> Anyone has a clue as to what's wrong with this?
>
> I setup my WL server to prefer classes and libs in WEB-INF so the
> classloading issues that might be should not be a problem. There is
> something that WL does that seems unconventional I wonder if anyone
> had similar experiences and what you guys were doing to tame the beast
> ?
>
> Thanks,
> Alex.
>

Attachment: user_184396.ezm (zipped)

I have created a template which utilizes parameters that are passed into
it to generate HTML conditionally based on those parameters. For
example:

 <s:component theme="scaTheme" templateDir="template"
template="Header.jsp">
   <s:param name="titleKey"
value="%{'title.appNpc'}" />
   <s:param name="helpPage"
value="%{'Non_Premier_Contract_Home_Page.htm'}" />
 </s:component>

However, I do not wish to require that all the parameters be required.
For example, it would be ok if the "helpPage" parameter was not
specified. At runtime, everything works fine if I do not specify the
"helpPage" parameter. However if I place my logging level at DEBUG, I
my log is cluttered with NPEs like the one below. I cannot seem to find
any kind of syntax to reference the parameter to even test if it is null
without generating this NPE in DEBUG. Does anyone know if it is
possible to avoid these NPEs? I make heavy use of templates with
optional parameters and it is really cluttering up the logs when trying
to debug. Am I doing something wrong? Should this maybe be readdressed
in the Struts code base? I understand why the DEBUG statement is
logged. Just not sure since it is a DEBUG statement, if the stack trace
is warranted.

Thanks in advance!


2008-03-14 14:30:14,364 DEBUG (http-127.0.0.1-8080-2:)
[com.opensymphony.xwork2.util.DefaultObjectTypeDeterminer] Error while
retrieving generic property class for property=parameters
java.lang.NullPointerException
 at
com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer.getClass(Gener
icsObjectTypeDeterminer.java:222)
 at
com.opensymphony.xwork2.util.GenericsObjectTypeDeterminer.getKeyClass(Ge
nericsObjectTypeDeterminer.java:44)
 at
com.opensymphony.xwork2.util.XWorkMapPropertyAccessor.getKey(XWorkMapPro
pertyAccessor.java:136)
 at
com.opensymphony.xwork2.util.XWorkMapPropertyAccessor.getProperty(XWorkM
apPropertyAccessor.java:68)
 at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643)
 at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
 at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
 at ognl.SimpleNode.getValue(SimpleNode.java:210)
 at ognl.ASTChain.getValueBody(ASTChain.java:109)
 at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
 at ognl.SimpleNode.getValue(SimpleNode.java:210)
 at ognl.ASTNotEq.getValueBody(ASTNotEq.java:49)
 at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
 at ognl.SimpleNode.getValue(SimpleNode.java:210)
 at ognl.ASTAnd.getValueBody(ASTAnd.java:56)
 at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
 at ognl.SimpleNode.getValue(SimpleNode.java:210)
 at ognl.Ognl.getValue(Ognl.java:333)
 at
com.opensymphony.xwork2.util.OgnlUtil.getValue(OgnlUtil.java:194)
 at
com.opensymphony.xwork2.util.OgnlValueStack.findValue(OgnlValueStack.jav
a:238)
 at
org.apache.struts2.components.Component.findValue (Component.java:322)
 at org.apache.struts2.components.If.start (If.java:85)
 at
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTag
Support.java:54)
 at
org.apache.jsp.template.scaTheme.Header_jsp._jspx_meth_s_005fif_005f0(He
ader_jsp.java:273)



-----------------------------------------
***Note:The information contained in this message may be privileged and
confidential and protected from disclosure. If the reader of this
message is not the intended recipient, or an employee or agent
responsible for delivering this message to the intended recipient, you
are hereby notified that any dissemination, distribution or copying of
this communication is strictly prohibited. If you have received this
communication in error, please notify the Sender immediately by replying
to the message and deleting it from your computer. Thank you. Premier
Inc.

Attachment: user_184397.ezm (zipped)
I don't have a good answer for you... But I have experienced this with
WebLogic 9.2 MP2. Oddly, WebLogic 9.2 MP1 does not experience this
issue.

After adding the jar(s) to satisfy any NoClassDefFoundError exceptions,
I noticed that the Struts2 web application ran incredibly slow on MP2,
whereas it ran just fine on MP1.

Any other WebLogic developers out there experience any of these issues?

- Patrick.


-----Original Message-----
From: Alex Shneyderman [mailto:a.shneyderman@(protected)]
Sent: Tuesday, March 18, 2008 2:45 AM
To: Struts Users Mailing List
Subject: Re: Something odd with deployment to WL 10

I have done a bit more digging and

somehow, somehwere there is a call to

com.opensymphony.xwork2.inject.ContainerImpl.addInjectors(Class,
List<Injector>)

the class in arguments list is
org.apache.struts2.views.velocity.VelocityManager

So somehow xwork is instructed to add injectors to that class.

The other mystery is of course why it does not happen with jetty.

So, if anyone got some clue as to what needs to be adjusted for an
exception to go away (besides adding un-needed dep) I am all ears.

Thanks,
Alex.

On Tue, Mar 18, 2008 at 8:06 AM, Alex Shneyderman
<a.shneyderman@(protected):
> hmm it seems that there is an unresolved issue:
>
> https://issues.apache.org/struts/browse/WW-2228
>
> any idea beyond what is in the comments? I mean I understand that
> sitemesh has velocity as optional jar but it is optional for a reason,

> I do not understand why an exception needs to be thrown.
>
> odd.
>
> On Tue, Mar 18, 2008 at 7:54 AM, Alex Shneyderman
>
> <a.shneyderman@(protected):
>
>
> > I get an exception while deploying WAR to WL 10. Here is the stack
trace:
> >
> > java.lang.NoClassDefFoundError:
Lorg/apache/velocity/app/VelocityEngine;
> >      at java.lang.Class.getDeclaredFields0(Native Method)
> >      at
java.lang.Class.privateGetDeclaredFields (Class.java:2259)
> >      at java.lang.Class.getDeclaredFields (Class.java:1715)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl.addInjectors(ContainerImpl.
java:102)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java
:84)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$1.create(ContainerImpl.java
:82)
> >      at
com.opensymphony.xwork2.inject.util.ReferenceCache$CallableCreate.call(R
eferenceCache.java:155)
> >      at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
> >      at java.util.concurrent.FutureTask.run (FutureTask.java:123)
> >      at
com.opensymphony.xwork2.inject.util.ReferenceCache.internalCreate(Refere
nceCache.java:81)
> >      at
com.opensymphony.xwork2.inject.util.ReferenceCache.get(ReferenceCache.ja
va:121)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$ConstructorInjector.<init>(
ContainerImpl.java:329)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$5.create(ContainerImpl.java
:299)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$5.create(ContainerImpl.java
:298)
> >      at
com.opensymphony.xwork2.inject.util.ReferenceCache$CallableCreate.call(R
eferenceCache.java:155)
> >      at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:269)
> >      at java.util.concurrent.FutureTask.run (FutureTask.java:123)
> >      at
com.opensymphony.xwork2.inject.util.ReferenceCache.internalCreate(Refere
nceCache.java:81)
> >      at
com.opensymphony.xwork2.inject.util.ReferenceCache.get(ReferenceCache.ja
va:121)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl.getConstructor(ContainerImp
l.java:562)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl.inject (ContainerImpl.java:4
60)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$7.call(ContainerImpl.java:5
01)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl
.java:549)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl.inject (ContainerImpl.java:4
99)
> >      at
com.opensymphony.xwork2.config.impl.LocatableFactory.create(LocatableFac
tory.java:32)
> >      at
com.opensymphony.xwork2.inject.ContainerBuilder$4.create(ContainerBuilde
r.java:134)
> >      at
com.opensymphony.xwork2.inject.Scope$2$1.create(Scope.java:49)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$ParameterInjector.inject(Co
ntainerImpl.java:431)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl.getParameters(ContainerImpl
.java:446)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl.access$000(ContainerImpl.ja
va:48)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$MethodInjector.inject(Conta
inerImpl.java:288)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:1
17)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl$2.call(ContainerImpl.java:1
15)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl.callInContext(ContainerImpl
.java:542)
> >      at
com.opensymphony.xwork2.inject.ContainerImpl.injectStatics(ContainerImpl
.java:114)
> >      at
com.opensymphony.xwork2.inject.ContainerBuilder.create(ContainerBuilder.
java:494)
> >      at
com.opensymphony.xwork2.config.impl.DefaultConfiguration.reload(DefaultC
onfiguration.java:145)
> >      at
com.opensymphony.xwork2.config.ConfigurationManager.getConfiguration(Con
figurationManager.java:52)
> >      at
org.apache.struts2.dispatcher.Dispatcher.init_PreloadConfiguration(Dispa
tcher.java:395)
> >      at
org.apache.struts2.dispatcher.Dispatcher.init (Dispatcher.java:452)
> >      at
org.apache.struts2.dispatcher.FilterDispatcher.init(FilterDispatcher.jav
a:201)
> >      at
weblogic.servlet.internal.FilterManager$FilterInitAction.run(FilterManag
er.java:320)
> >      at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSu
bject.java:321)
> >      at weblogic.security.service.SecurityManager.runAs(Unknown
Source)
> >      at
weblogic.servlet.internal.FilterManager.loadFilter(FilterManager.java:88
)
> >      at
weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.jav
a:57)
> >      at
weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppSe
rvletContext.java:1725)
> >      at
weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContex
t.java:2890)
> >      at
weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:9
48)
> >      at
weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:353)
> >      at
weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateD
river.java:204)
> >      at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriv
er.java:26)
> >      at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDr
iver.java:60)
> >      at
weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModule
Driver.java:200)
> >      at
weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleLis
tenerInvoker.java:117)
> >      at
weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateD
river.java:204)
> >      at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriv
er.java:26)
> >      at
weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDr
iver.java:60)
> >      at
weblogic.application.internal.flow.StartModulesFlow.activate(StartModule
sFlow.java:26)
> >      at
weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:
635)
> >      at
weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriv
er.java:26)
> >      at
weblogic.application.internal.BaseDeployment.activate(BaseDeployment.jav
a:212)
> >      at
weblogic.application.internal.DeploymentStateChecker.activate(Deployment
StateChecker.java:154)
> >      at
weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppCo
ntainerInvoker.java:80)
> >      at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.activ
ate(AbstractOperation.java:566)
> >      at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.activ
ateDeployment(ActivateOperation.java:136)
> >      at
weblogic.deploy.internal.targetserver.operations.ActivateOperation.doCom
mit(ActivateOperation.java:104)
> >      at
weblogic.deploy.internal.targetserver.operations.StartOperation.doCommit
(StartOperation.java:139)
> >      at
weblogic.deploy.internal.targetserver.operations.AbstractOperation.commi
t(AbstractOperation.java:320)
> >      at
weblogic.deploy.internal.targetserver.DeploymentManager.handleDeployment
Commit(DeploymentManager.java:816)
> >      at
weblogic.deploy.internal.targetserver.DeploymentManager.activateDeployme
ntList(DeploymentManager.java:1223)
> >      at
weblogic.deploy.internal.targetserver.DeploymentManager.handleCommit(Dep
loymentManager.java:434)
> >      at
weblogic.deploy.internal.targetserver.DeploymentServiceDispatcher.commit
(DeploymentServiceDispatcher.java:161)
> >      at
weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallback
Deliverer.doCommitCallback(DeploymentReceiverCallbackDeliverer.java:181)
> >      at
weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallback
Deliverer.access$100(DeploymentReceiverCallbackDeliverer.java:12)
> >      at
weblogic.deploy.service.internal.targetserver.DeploymentReceiverCallback
Deliverer$2.run(DeploymentReceiverCallbackDeliverer.java:67)
> >      at
weblogic.work.SelfTuningWorkManagerImpl$WorkAdapterImpl.run(SelfTuningWo
rkManagerImpl.java:464)
> >      at
weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
> >      at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
> >
> >
> > The project is built with maven and when I deploy with jetty:run
> > everything work Ok. This is my dependency:tree output:
> >
> > ...
> > [INFO] [dependency:tree]
> > [INFO] mypackage:webclient:war:0.5-SNAPSHOT
> > [INFO] +- org.testng:testng:jar:jdk15:5.6:test
> > [INFO] | \- junit:junit:jar:3.8.1:test > [INFO] +-
> org.apache.struts:struts2-core:jar:2.0.11:compile
> > [INFO] | +- com.opensymphony:xwork:jar:2.0.4:compile
> > [INFO] | +- commons-logging:commons-logging:jar:1.0.4:compile
> > [INFO] | +- opensymphony:ognl:jar:2.6.11:compile
> > [INFO] | +- freemarker:freemarker:jar:2.3.8:compile
> > [INFO] | \- com.sun:tools:jar:1.5.0:system > [INFO] +-
> org.apache.struts:struts2-spring-plugin:jar:2.0.11:compile
> > [INFO] | +- org.springframework:spring-beans:jar:2.0.5:compile
> > [INFO] | +- org.springframework:spring-core:jar:2.0.5:compile
> > [INFO] | +- org.springframework:spring-context:jar:2.0.5:compile
> > [INFO] | | \- aopalliance:aopalliance:jar:1.0:compile
> > [INFO] | \- org.springframework:spring-web:jar:2.0.5:compile
> > [INFO] +-
> org.apache.struts:struts2-sitemesh-plugin:jar:2.0.11:compile
> > [INFO] | \- opensymphony:sitemesh:jar:2.2.1:compile
> > [INFO] +-
> org.apache.struts:struts2-codebehind-plugin:jar:2.0.11:compile
> > [INFO] +- javax.servlet:servlet-api:jar:2.4:provided
> > [INFO] +- javax.servlet:jsp-api:jar:2.0:provided
> > [INFO] +- commons-fileupload:commons-fileupload:jar:1.1.1:compile
> > [INFO] | \- commons-io:commons-io:jar:1.1:compile
> > ...
> >
> > Doe anyone have a clue as to what's going on with this?
> >
> > TIA,
> > Alex.
> >
>



***********************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************

Attachment: user_184398.ezm (zipped)
Put a div inside tab2 and make that inner div the target.

If you target the tab you're trying overwrite the markup for the tab
widget. By targeting a div inside the tab you can replace just the
content of tab.

You may also prefer to make the inner div a remote div and the tab
non-ajax because you get better control.

ie. in the jsp below, the target is a div inside the second tab

<s:tabbedPanel id="incorpContainer">
    <s:div theme="ajax" id="dInc1" label="Company" href="%{incUrl1}"
executeScripts="true"></s:div>
    <s:div id="dInc2" label="Employee">
      <s:div theme="ajax" id="theTarget" href="%{incUrl2}" executeScripts="true"></div>
    </s:div>



manisha5 wrote:
> Hi,
> I just started working on Struts 2 + Ajax. I am stuck on one problem. Can
> somebody help me?
>
> I have main page which has tabbedPanel with 3 remote tabs.
> When i click submit in remote page in tab1, i want to load result page in
> tab2.
>
> I gave tab2 div id as target for the submit but the page does not load
> inside tabbedPanel.
>
>
> Struts.xml snippet:
>
>      <action name="continue" class="com.foo.action.ContinueAction">
>         <result name="success">/load_content.jsp</result>
>      </action>
>
> Sample code:
>
> index.jsp:
>
> <s:url id="incUrl4" value="/corpinfo_content.jsp"/>
> <s:url id="incUrl2" value="/AjaxTest.action" />
> <s:url id="incUrl1" value="/main_content.jsp" />
>
>
>    <s:tabbedPanel id="incorpContainer">
>      <s:div theme="ajax" id="dInc1" label="Company" href="%{incUrl1}"
> executeScripts="true"></s:div>
>      <s:div theme="ajax" id="dInc2" label="Employee" href="%{incUrl2}"
> executeScripts="true"></s:div>
>      <s:div theme="ajax" id="dInc4" label="Corporate Info"
> href="%{incUrl4}" executeScripts="true"/>
>     </s:tabbedPanel>
>
> main_content.jsp:
>
>           <s:url id="continueAct" value="Continue.action"></s:url>
>           <s:a href="%{continueAct}" targets="dInc2" >
>             images/Continue.jpg </s:a>
>
>
> Any help or suggestion is appreciated.
> Thanks
> Manisha
>  


Attachment: user_184399.ezm (zipped)

Is this considered the Best Practice: Keeping all JSP's under the WEB-INF
directory? We have not done that on my project, I am curious if there are
plus' and minus' to this?

Thanks,
John



The easiest way is to always have the user call an action to get a JSP,
even if it is a simple page. You then also ensure that all data
necessary for that page has been obtained. The, by placing the JSP's in
the WEB-INF directory you will prevent access directly from a browser
(only from the s2 dispatcher).

Otherwise, I would suggest a servlet filter or header code for all JSPs
that make the necessary checks.

/Ian

--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184401.ezm (zipped)
I've been told that some older containers don't allow you to forward to
JSP's behind /WEB-INF. It wouldn't surprise me.
Other than that I've found Ian's suggestion to be the most effective way
to ensure users can't access JSPs directly, IMO a must for Tiles, html
fragments and any page using struts tags.

The only issue I've experienced is when (bad) scriptets within the JSP
manipulate the request object directly, which is assumed to use the
/xxx.jsp URI but is actually /WEB-INF/results/xxx.jsp.

Many would argue that best practice is to not use JSPs at all. Another
group would argue that Acegi should be used rather than rolling your own
filter.

Hope that helps.

mojoRising wrote:
> Is this considered the Best Practice: Keeping all JSP's under the WEB-INF
> directory? We have not done that on my project, I am curious if there are
> plus' and minus' to this?
>
> Thanks,
> John
>
>
>
> The easiest way is to always have the user call an action to get a JSP,
> even if it is a simple page. You then also ensure that all data
> necessary for that page has been obtained. The, by placing the JSP's in
> the WEB-INF directory you will prevent access directly from a browser
> (only from the s2 dispatcher).
>
> Otherwise, I would suggest a servlet filter or header code for all JSPs
> that make the necessary checks.
>
> /Ian
>
>  


Attachment: user_184407.ezm (zipped)
Plus: nothing under WEB-INF can be referenced by a browser, so JSPs
stored there can't be called directly.

Minus: nothing under WEB-INF can be referenced by a browser, so JSPs
stored there can't be called directly... :-)

It depends on your requirements. But generally you will want to route
requests for all but the simplest of pages through an action. By placing
the corresponding JSP under WEB-INF, you ensure it can never be accessed
*except* through an action.

L.

mojoRising wrote:
> Is this considered the Best Practice: Keeping all JSP's under the WEB-INF
> directory? We have not done that on my project, I am curious if there are
> plus' and minus' to this?
>
> Thanks,
> John
>
>
>
> The easiest way is to always have the user call an action to get a JSP,
> even if it is a simple page. You then also ensure that all data
> necessary for that page has been obtained. The, by placing the JSP's in
> the WEB-INF directory you will prevent access directly from a browser
> (only from the s2 dispatcher).
>
> Otherwise, I would suggest a servlet filter or header code for all JSPs
> that make the necessary checks.
>
> /Ian
>


Attachment: user_184408.ezm (zipped)
I use Acegi security to make sure that all of my pages are secure. I
find it very flexiable, but not always easy to configure.

If you are already using spring as you IoC, then you might as well take
advantage of Acegi.

Jeromy Evans wrote:
> I've been told that some older containers don't allow you to forward to
> JSP's behind /WEB-INF. It wouldn't surprise me.
> Other than that I've found Ian's suggestion to be the most effective way
> to ensure users can't access JSPs directly, IMO a must for Tiles, html
> fragments and any page using struts tags.
>
> The only issue I've experienced is when (bad) scriptets within the JSP
> manipulate the request object directly, which is assumed to use the
> /xxx.jsp URI but is actually /WEB-INF/results/xxx.jsp.
>
> Many would argue that best practice is to not use JSPs at all. Another
> group would argue that Acegi should be used rather than rolling your own
> filter.
>
> Hope that helps.
>
> mojoRising wrote:
>> Is this considered the Best Practice: Keeping all JSP's under the WEB-INF
>> directory? We have not done that on my project, I am curious if there are
>> plus' and minus' to this?
>>
>> Thanks,
>> John
>>
>>
>>
>> The easiest way is to always have the user call an action to get a
>> JSP, even if it is a simple page. You then also ensure that all data
>> necessary for that page has been obtained. The, by placing the JSP's
>> in the WEB-INF directory you will prevent access directly from a
>> browser (only from the s2 dispatcher).
>>
>> Otherwise, I would suggest a servlet filter or header code for all
>> JSPs that make the necessary checks.
>>
>> /Ian
>>
>>  
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
> --------------------------------
> Spam/Virus scanning by CanIt Pro
>
> For more information see
> http://www.kgbinternet.com/SpamFilter.htm
>
> To control your spam filter, log in at
> http://filter.kgbinternet.com


Attachment: user_184400.ezm (zipped)
Thanks Dale very much for your help.

Dale Newfield <Dale@(protected):
> Is there anyway to use the JSP 2.0 tag files and the Struts 2.0 tags together.

Yes, all you have to do is add the taglib at the top of your .tag file
so that you can refer to the s: tags. The difficulty comes in passing
arguments. At first I was only able to successfully pass the top of the
VS, but that's brittle (and only really supports 1 argument well), so
I've changed over to passing objects as tag attributes. In order to do
this you must pass using EL, not OGNL.

I found that arguments from one .tag file to another didn't work
correctly in tomcat6. (But it does in tomcat5.5 and in glassfish.)

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)



   
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

Attachment: user_184402.ezm (zipped)
eod wrote:
> Hi,
>
> I'm seeing input form data disappear if the validation fails & the page is
> re-displayed; have Googled around but found nothing specific to dyna forms,
> so I'm hoping someone has come across this & know what the issue is; I had
> tried setting the action's scope to session as a test, but the form data
> still disappears.
>
> The form is declared as a DynaValidatorActionForm b/c I hope to re-use it in
> later actions.
> I'm using an initial setup action w/ validation off which forwards to the
> page in question that captures user data.
>
> Thanks in advance for any help.
>
> Here are the relevant form, actions & validation declarations :
>
> struts-config.xml :
>
>    <form-bean name="shippingBillingAddressForm"
> type="org.apache.struts.validator.DynaValidatorActionForm">    
>       <form-property name="firstName" type="java.lang.String" />
>       <form-property name="lastName" type="java.lang.String" />
>       <form-property name="address1" type="java.lang.String" />
>       <form-property name="address2" type="java.lang.String" />
>       <form-property name="city" type="java.lang.String" />
>       <form-property name="state" type="java.lang.String" />
>       <form-property name="zip" type="java.lang.String" />
>       <form-property name="phone" type="java.lang.String" />
>       <form-property name="shipping" type="java.lang.String" />      
>      </form-bean>
>
>    <!-- setup action that navigates to the shipping page; existance
>        is solely to render the initial shipping page w/o validaton errors
> showing -->
>    <action path="/shippingSetup" name="shippingBillingAddressForm"
>        input="shipping.page"                        
>        validate="false"
>        scope="request">
>      <forward name="toShipping" path="shipping.page"/>
>      </action>
>    <action path="/shipping" name="shippingBillingAddressForm"
>        input="shipping.page"                        
>        validate="true"
>        scope="request">
>      <forward name="toBilling" path="billing.page"/>
>      </action>
>
> validation.xml :
>
>   <formset>
>
>    <form name="/shipping">
>         <field property="firstName" depends="required">
>         <arg0 key="addressForm.firstName"/>  
>         </field>
>    </form>
> ....

What does shipping.page refer to? A Tiles definition? The 'input'
attribute of your form handling action should probably point back to the
setup action.

L.


Attachment: user_184403.ezm (zipped)
GF wrote:
> I have something like
> %{#application.one.two.three}
>
> is it possible to do something like:
>
> %{#application.%{stringVariable}.two.three}

Perhaps something like %{#application[stringVariable].two.three}?

L.


Attachment: user_184404.ezm (zipped)
matt.payne wrote:
> I really like the treatment the JQuery
> http://jquery.bassistance.de/validate/demo/ validation plugin (not struts
> plugin), gives for a user experience. I would really like the rules to come
> from back end rules and decorate the form fields the same way if the back
> end bounces a validation error.
>
> Is there anyway to evaluate the validation config ahead of time, so jquery
> rules can be written?

I don't know what you mean by 'evaluate the validation config ahead of
time,' but depending on what JQuery code you need to generate I would
imaging you could do it either in the JSP or, perhaps a more general
solution, by re-writing the client-side validation Javascript (assuming
you want to use JQuery to perform client-side validation, not just to
render errors from server-side validation).

L.


Attachment: user_184405.ezm (zipped)
The techniques shown in the earlier examples would work equally well in
the byte stream example. How you determine the source of the data to
send back to the browser is really up to you.

- configure it statically in struts-config.xml (as per the first two
exxamples

- take it from a request parameter

- derive it from some other user or request data

L.

bhaarat Sharma wrote:
> Quick question
>
> in all other examples on that page they show how the fileName is
> retrieved. But for Byte Array Example they do not mention anything
> regarding the fileName.
>
> How are we suppose to supply the fileName?
>
>
> On Mon, Mar 17, 2008 at 10:41 PM, Dave Newton <newton.dave@(protected):
>> --- bhaarat Sharma <bhaarat.s@(protected):
>>
>>> Thanks! I remember you helped me with similar problem in S2 as well
>> I'm very good at using the work of others to make me look good ;)
>>
>> Dave
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>


Attachment: user_184410.ezm (zipped)
Forgive me if I am on the wrong track here, I think I picked up this
thread in the middle... but I think I would answer:

> How are we suppose to supply the fileName?

By setting a response header:

response.setHeader("Content-Disposition", "inline;filename="foo.xyz");

MG

-----Original Message-----
From: news [mailto:news@(protected)
Sent: Tuesday, March 18, 2008 9:48 AM
To: user@(protected)
Subject: Re: Struts 1 return stream (documents)

The techniques shown in the earlier examples would work equally well in
the byte stream example. How you determine the source of the data to
send back to the browser is really up to you.

- configure it statically in struts-config.xml (as per the first two
exxamples

- take it from a request parameter

- derive it from some other user or request data

L.

bhaarat Sharma wrote:
> Quick question
>
> in all other examples on that page they show how the fileName is
> retrieved. But for Byte Array Example they do not mention anything
> regarding the fileName.
>
> How are we suppose to supply the fileName?
>
>
> On Mon, Mar 17, 2008 at 10:41 PM, Dave Newton <newton.dave@(protected)>
wrote:
>> --- bhaarat Sharma <bhaarat.s@(protected):
>>
>>> Thanks! I remember you helped me with similar problem in S2 as well
>> I'm very good at using the work of others to make me look good ;)
>>
>> Dave
>>
>>
>>
>>
>>
---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@(protected)
>> For additional commands, e-mail: user-help@(protected)
>>
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)


Attachment: user_184409.ezm (zipped)

Hi,

I've been looking for a check (in a JSP) if a certain field has an error
assigned.

I know (so far) that I can display the error message by using:

<s:fielderror>
  <s:param value="%{'<fieldName>'}" />
</s:fielderror>

That's not what I'm looking for. I want to display a block if the field has
an error like:

<s:if test="...<CheckIamLookingFor>...">
  display this...
  display that...
</s:if>

Is there a way?

thx,
Stefan
--
Sent from the Struts - User mailing list archive at Nabble.com.


Attachment: user_184411.ezm (zipped)
--- Stefan Schwarz <cmsi@(protected):
> I want to display a block if the field has an error like:
>
> <s:if test="...<CheckIamLookingFor>...">
>    display this...
>    display that...
> </s:if>
>
> Is there a way?

JavaDocs are your friend. ActionSupport's getFieldErrors method [1] returns a
map keyed from the input field name.

Dave

[1]
http://struts.apache.org/2.0.11.1/struts2-core/apidocs/com/opensymphony/xwork2/ValidationAware.html#getFieldErrors()

©2008 gg3721.com - Jax Systems, LLC, U.S.A.