This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes logic and bean tag in struts Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "logic and bean tag in struts" Watch "logic and bean tag in struts" New topic

logic and bean tag in struts

Swapna latha
Ranch Hand

Joined: Dec 18, 2011
Posts: 70

<%@taglib uri="" prefix="html" %>
<%@taglib uri="" prefix="logic" %>
<%@taglib uri="" prefix="bean" %>
<html:form action="register">
UserName:<html:text property="username"/> <br>
Password: <html:password property="password"/> <br>
<html:submit value="register"/>
<logic:notEmpty name="resultmsg">
Result is: <bean:write name="resultmsg"/>

package surya;
import org.apache.struts.action.*;
import javax.servlet.http.*;
public class RegisterAction extends Action
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest req, HttpServletResponse res) throws Exception
System.out.println("Action class execute() is called");
RegisterForm fm=(RegisterForm)form;
String uname=fm.getUsername();
String pwd=fm.getPassword();


return mapping.findForward("myres");

Whats the use of bean and logic tags here ? I am not getting the correct idea.
Raaja Gotluru
Ranch Hand

Joined: Mar 02, 2010
Posts: 108
Hi Swapna,

The code between logic tag executes only when the tag evaluates to true.

In the above code the value of the bean resultmsg will be diplayed only when the bean resultmsg is not null or when the bean is having some value.
candid java

Joined: Jan 13, 2012
Posts: 14
here i was found the exact answer by this link
I agree. Here's the link:
subject: logic and bean tag in struts
Similar Threads
Verification failed on Username existence check using AJAX
How to display error message
change password
how to do validation in struts1
taglib in JSP not working in struts