Hi,
I am new to Struts2 and currently working on Struts1.x to Struts2 migration. I need to change logic:equal and logic:present tags in the
Jsp. Here is the problem I am facing:
STConstants.java has some constants such as:
public static final
string ALT_PBR = "fusion";
Customer.java is a POJO having the following fields with getters and setters:
firstname, lastname,addressline1,addressline2,city,state,postalCode
In NewCmpAction.java we have:
Customer cust = new Customer();
//code which sets all the fields in cust object
.
.
//cust object is placed in session
session.put(STConstants.ALT_PBR,cust);
In slsDetail.jsp, I want to check if "cust" objects exists in session, if it exists then if the value of city field in "cust" object is equal to "CA".
In
Struts 1.x we used logic:equal and logic:present but in Struts2 we do not have logic:equal and logic:present and I assume we have to implement this logic using if tag. I tried various combination but it didnt work.
I know if I use #session.fusion.city I will get the city value which I can compare to "CA" but I want to get the value "fusion" by referring to STConstants.ALT_PBR in the jsp. How can I do that? For eg: #session.???.city where ??? = STConstants.ALT_PBR.
Please help.
Also, how can I check if session has "cust" object? or how can I check if it is not present in session.
Thanks,
Prathima