Author |
Message |
|
I opened up one of my applications.
I created the following bean:
final public class AccountTestBean {
private String accountNum;
private String balance;
public AccountTestBean(){}
public String getAccountNum(){return accountNum;}
public String getBalance(){return balance;}
public void setAccountNum(String value){accountNum = value;}
public void setBalance(String value){balance = value;}
}
and this bean:
final public class UserTestBean {
private String firstName;
private String lastName;
private List<AccountTestBean> accounts;
public UserTestBean(){}
public String getFirstName(){return firstName;}
public String getLastName(){return lastName;}
public List getAccounts(){return accounts;}
public void setFirstName(String value){firstName = value;}
public void setLastName(String value){lastName = value;}
public void setAccounts(List value){accounts = value;}
}
I put the following at the end of one of my Actions (ShowCodesAction.java):
UserTestBean user = new UserTestBean();
user.setFirstName("John");
user.setLastName("Doe");
AccountTestBean account = new AccountTestBean();
account.setAccountNum("1");
account.setBalance("$100.00");
List<AccountTestBean> accounts = new LinkedList();
accounts.add(account);
account.setAccountNum("2");
account.setBalance("$200.00");
accounts.add(account);
user.setAccounts(accounts);
output.setValue("USER",user);
Here is the section from my ApplicationManager:
ActionConfig ac = new ActionConfig("/ShowCodes", ShowCodesAction.class);
ac.addConsequence(ShowCodesAction.SUCCESS, new Forward("/codes.jsp"));//output forwarded to view
ac.addConsequence(ShowCodesAction.ERROR, new Redirect("/error.jsp"));
ac.addFilter(new OVFilter("USER"));
addActionConfig(ac);
On codes.jsp I put this:
<%-- I don't need the mtw:bean if I have a VOFilter but do need it
if no VOFilter is used --%>
<%-- <mtw:bean value="USER"> --%>
Name: <mtw:out value="firstName"/> <mtw:out value="lastName"/><br>
<mtw:list value="accounts">
List of Accounts:<br>
<mtw:isEmpty>You have no accounts</mtw:isEmpty>
<mtw:loop>
Account Number:<mtw:out value="accountNum"/><br>
Account Balance:<mtw:out value="balance"/><br>
</mtw:loop>
</mtw:list>
<%-- </mtw:bean> --%>
I get this output:
Name: John Doe
List of Accounts:
Account Number:2
Account Balance:$200.00
Account Number:2
Account Balance:$200.00
I haven't been using OVFilter. I just use the <mtw:bean> instead.
If you use OVFilter you don't need the <mtw:bean> lines.
Hope this helps. Compare to your code and let me know if
you are doing anything different! Rick
|
 |
|
Went to download a copy of the API zip file and got an error. Might have been my connection or the file may be corrupted...thanks, Rick
|
 |
|
Has anyone tried to hook displaytag's i18n to mentawai? I'm using the standard mentawai i18n support with good results. I tried to use the standard displaytag i18n using titleKey but it isn't working. I'd rather tie it to mentawai if possible anyway. Thanks, Rick
|
 |
|
I noticed that I can access some of the Mentawai files directly because
by default they are directly below the document root.
For example, I have the message file master_en_US.i18n in /messages
under the document root to store some dynamic messages.
I can access this file directly with http://appURL/appname/messages/master_en_US.i18n
Can anyone think of a reason this might be an problem for an
application to have these files exposed?
Thanks! Rick
|
 |
|
I agree I could hardcode URLs in my JSPs. In playing with different
options looked like hardcoding URLs in the Redirects in ActionManager.java
would not be a good idea.
I think I'll just go with either all SSL or non-SSL for now.
The debug mode is very helpful!
Right now I'm trying to create a web application framework using
Mentawai which we will then use as a base to create a group of
very similar applications for our clients.
|
 |
|
My apologies if this is in the docs and I can't find it...
I am using Apache Tomcat. In the web.xml I can use transport-guarantee
to force the container to switch to SSL(https). I can force this for
certain pages I define.
But once I am switched to SSL I have no way to get back to http.
It is very easy for a mentawai app to be http all the time or https all the
time, but I can't figure out how to have certain pages (login or payment
pages, for example) in ssl/https and have the other pages automatically
go to http.
I noticed that struts now has an extension to do this as they apparently
faced the same problem.
I could hardcode full URLs in the app to get what I want but would prefer not to.
Could mentawai use an optional filter to check all forward/redirects, forcing
them all to http except for pre-registered pages which would be forced to
https?
Again, my apologies if this is covered in the documentation and I haven't
found it yet! Thanks, Rick Quade
|
 |
|