prasanth jalasutram

Greenhorn
+ Follow
since Dec 15, 2004
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by prasanth jalasutram

hi,

see whether your properties file is available in classpath.WEB-INF\classes folder.


Thanks
Prashant
13 years ago
validation rules are not restricted to any action rather to a actionform.So you can use the same validation rules for diff actions if both actions are using same action form.

For Example:
<form-validation>
<formset>
<form name="checkoutForm">
<field
property="firstName"
depends="required">
<arg0 key="label.firstName"/>
</field>

<field
property="lastName"
depends="required">
<arg0 key="label.lastName"/>
</field>
</form>
</formset>
</form-validation>

Thanks
Prashant
13 years ago
Hi,

Make sure your action class extends validationForm class and implement validate method.

For example:

a)
public class ActionForm extends ValidatorForm{
......
/*
setters and getters are defined here
*/
......
public ActionErrors validate(ActionMapping mapping,
HttpServletRequest request) {
ActionErrors errors = new ActionErrors();
if (userName == null || userName.trim().equals("")) {
errors.add("userName", new ActionError ("error.login.username.null"));
}

return errors;
}

}

b)
add this line in your properties file
error.login.username.null=User name required

c) then in jsp
<form action="login">
.....
<td>Username</td>
<td><html:text property="userName" size="16" maxlength="16"/></td>
<td><html:errors property="userName"/></td>
.......
</form>

Hope this helps.

Thanks
Prasanth
13 years ago
you can search in google for "struts examples".

anyways here is one link

http://www.ninsky.com/struts/
http://www.codeczar.com/products/struts-examples/download.html

Hope above links helps you.

thanks
prasanth
13 years ago
As said you can use struts tags to get persisted.

if in case you are using normal html tags you can use javascript also to achieve this.

<html>
<body>
<form name="form1">
<select name=persistMenu onchange="call1()">
<option value="vijayawada">Vijayawada
<option value="governorpet">Governorpet
</select>

</form>
</body>
</html>

<script language="javascript">
var selectedIndex=0;

function call1() {
selectedIndex=document.forms[0].persistMenu.selectedIndex;
document.forms[0].persistMenu.selectedIndex=selectedIndex;
}


</script>

you can use that onchane event in appropriate place.
13 years ago
hi,

if you are using weblogic8.1 you may use this alternative.

As said by others it should be some problem that your properties file is not loaded in classes folder.recheck your .war file or your files.

but alternately you may use <i18> tag only if you are using weblogic8.1 version.
<%
String language = "en_us";
%>
<i18n:localize language="<%=language%>" bundleName="Messages"/>
<html>
<body>
<i18n:getMessage messageName="greeting"/>
</body>
</html>

Hope it helps you.

thanks
prasanth jalasutram
13 years ago