Struts bean tag problem

Say I've got a bean, i use
<logic:present name="personbean" scope="request">
to load that bean in the jsp page.
what should i do if i want to read a property which is actually a file name string, from that bean and include that string in the jsp page by "<%@ include file=filename %>" (see that filename is the param that i got from the property of the bean)
please help me out here, i think i stuck there
thanks

Hi,
the property "filename" of personaBean must be in scope, in this case request.
You do this in the Action that calls the jsp where you use "filename".
It depends on what sort of StrutsForm you use.
I usually use DynaValidationForm:
DynaValidationForm formD = (DyanValidationForm)form;(ActionForm you pass to the Action as parameter)
formD.set("filename",filename);

Similar Messages

  • Help with struts bean tag

    I populated my data in a hashtable and it contains key & the values are in an arraylist of treemap. How do I display data using struts bean tag? Thanks.

    if you have an arraylist of maps why do you need three iterates?
    <logic:iterate id="treeMap" name="navTable">  //navTable is your ArrayList treeMap will be each map
         <logic:iterate id="element" name="treeMap">  //element is each element as it iterates through treeMap
                         key = <bean:write name="element" property="key" filter="false"/>
                         value = <bean:write name="element" property="value" filter="false"/>
             </logic:iterate>
    </logic:iterate>unless of course I missed something and you really need three iterates.
    of course you need a getNavTable() method, though you probably already have that.

  • Struts Html tag problem in Weblogic 8.1

    Hi
    I am using weblogic8.1 Application server
    I have written a simple web application in struts that accepts
    username and password in "login.jsp" and corresponding "bean" ActionForm
    for the same.
    Below are my application source files......
    login.jsp
    <%@taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
    <%@taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
    <html:html>
    <head>Struts Test</head>
    <body bgcolor="#E6F1FC">
    <html:form action="login.do">
    <table>
    <tr>
    <td><html:text property="uname" value=" "/></td>
    <td><html:submit>SUBMIT</html:submit></td>
    </tr>
    </table>
    </html:form>
    </body>
    </html:html>
    web.xml
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web
    Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
    <web-app>
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
    <param-name>config</param-name>
    <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
    </taglib>
    <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
    </taglib>
    </web-app>
    struts-config.xml
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE struts-config PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN"
    "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd">
    <struts-config>
    <form-beans>
    <form-bean name="LoginFrom" type="com.nit.StrutsEx.LoginFrom"/>
    </form-beans>
    <action-mappings>
    <action path="/login" type="com.nit.StrutsEx.LoginAction" name="LoginFrom" validate="false"
    input="/login.jsp">
    <forward name="success" path="/success.jsp"/>
    </action>
    </action-mappings>
    <message-resources parameter="ApplicationResource" null="false"/>
    </struts-config>
    ActionForm
    package com.nit.StrutsEx;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import org.apache.struts.action.*;
    import javax.servlet.*;
    import java.io.*;
    public class LoginForm extends ActionForm
    private String uname=null;
    public void setUname(String uname){
    this.uname=uname;
    public String getUname(){
    return this.uname;
    public void reset(ActionMapping am, HttpServletRequest req) {
    this.uname=null;
    public ActionErrors validate(ActionMapping am,HttpServletRequest req)
    System.out.println("I am in Validate");
    return null;
    ActionServlet
    package com.nit.StrutsEx;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.struts.action.Action;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import javax.servlet.*;
    import java.io.*;
    public class LoginAction extends Action
    public ActionForward execute(
    ActionMapping am,
    ActionForm af,
    HttpServletRequest req,
    HttpServletResponse res) throws ServletException , IOException
    return am.findForward("success");
    My application runs well under tomcat but when i deploy it on Weblogic 8.1 it gives following error
    Compilation of 'E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java' failed:
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:151: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 4:
    <html:html>
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:168: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 8:
    <html:form action="login.do">
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:203: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 13:
    <td><html:submit>SUBMIT</html:submit></td>
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:216: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 13:
    <td><html:submit>SUBMIT</html:submit></td>
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:226: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 16:
    </html:form>
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:235: cannot resolve symbol
    probably occurred due to an error in /login.jsp line 18:
    </html:html>
    Full compiler error(s):
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:151: cannot resolve symbol
    symbol : variable EVAL_BODY_BUFFERED
    location: interface javax.servlet.jsp.tagext.BodyTag
    if (_int0 == BodyTag.EVAL_BODY_BUFFERED) { //[ /login.jsp; Line: 4]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:168: cannot resolve symbol
    symbol : variable EVAL_BODY_BUFFERED
    location: interface javax.servlet.jsp.tagext.BodyTag
    if (_int1 == BodyTag.EVAL_BODY_BUFFERED) { //[ /login.jsp; Line: 8]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:203: cannot resolve symbol
    symbol : variable EVAL_BODY_BUFFERED
    location: interface javax.servlet.jsp.tagext.BodyTag
    if (_int2 == BodyTag.EVAL_BODY_BUFFERED) { //[ /login.jsp; Line: 13]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:216: cannot resolve symbol
    symbol : variable EVAL_BODY_BUFFERED
    location: interface javax.servlet.jsp.tagext.BodyTag
    if (_int2 == BodyTag.EVAL_BODY_BUFFERED) out = pageContext.popBody(); //[ /login.jsp; Line: 13]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:226: cannot resolve symbol
    symbol : method doAfterBody ()
    location: class org.apache.struts.taglib.html.FormTag
    } while (_html_form0.doAfterBody() == IterationTag.EVAL_BODY_AGAIN); //[ /login.jsp; Line: 16]
    ^
    E:\bea\weblogic81\server\bin\.\myserver\.wlnotdelete\extract\myserver_stest_stest\jsp_servlet\__login.java:235: cannot resolve symbol
    symbol : method doAfterBody ()
    location: class org.apache.struts.taglib.html.HtmlTag
    } while (_html_html0.doAfterBody() == IterationTag.EVAL_BODY_AGAIN); //[ /login.jsp; Line: 18]
    ^
    6 errors
    Wed Jul 25 17:06:07 GMT+05:30 2007
    Please reply the solution

    I don't know about that, but I am using MyFaces and tomahawk with WLS8.1 sp5 jdk1.4.2_05 and it works fine.
    I do remember getting such an error when I moved from Sun RI to MyFaces and all I can recall is that it was a commons library mismatch problem or some classpath problem...

  • Struts Framewrok -- Bean Tag Problem

    Hi all,
    When i want to print uNews.getBody(); (uNews is a bean in request) in my jsp i use this tag,
    <bean:write name="uNews" property="body"/>
    but how can i use this method for writing something like this:
    uNews.getReporter().getID(); that way, using been:write tag, what i already do is:
    <%
              UnapprovedNews uNews = (UnapprovedNews) request.getAttribute("uNews");
              out.println (uNews.getReporter().getUserID());
    %>
    How can i use the struts tags instead of this code?
    Best Regards
    Ehsan

    try this:-
    <bean:define id="reporter" name="uNews" property="reporter"/>
    <bean:write name="reporter" property="userID"/>
    Sumanta Mandal
    ([email protected])

  • Using EL variable in struts bean:message tag(not struts EL tag)

    Is there any work around to use an EL variable inside struts bean:message tag as key:
    I have like this:
    <bean:message key="${bean.keyName}"/>
    which is throwing error , I know this can be resolved by using struts-el tags but i cannot use them for specific reasons.
    I dont want to use bean:define tag to define my 'bean' and then use like this:
    <bean:message key="<%=bean.getKeyName%>"/> (this actually works, but i want to use EL variable)
    Is there any work around to use EL variable and make the message display on the jsp.
    i tried multiple ways like scriplets and jsp:useBean but nothing worked, Please let me know..
    Thanks in advance

    Im pretty sure that EL does not work in the normal struts tag unless its struts-el tag.Have you tried it?
    As I said, in a properly configured JSP2.0 container you can use EL expressions anywhere you could traditionally use a standard runtime expression <%= expr %>.
    What server are you using? What JSP version?
    The Struts-el tags were written so that you could use EL with struts in JSP1.2 containers.
    The c_rt tags were written so you could use runtime expressions with JSTL tags in JSP1.2 containers. Their use was discouraged even then. Now I consider their use absolutely unnecessary.
    Please read this thread: http://forum.java.sun.com/thread.jspa?threadID=629437&tstart=0
    Cheers,
    evnafets

  • WLS 8.1 sp1 with Struts 1.1 JSP with bean tag won't compile

              Hello,
              We are currently porting our application which uses struts 1.1 to WLS 8.1 sp1
              from another app server. Everything seems to deploy correctly and pages which
              use struts tags appear to compile and run fine. However, the pages with struts
              <bean:define> tags are not compiling.
              Example JSP Code:
              <bean:define id="userForm" name="userForm" scope="session" toScope="page" type="UserFormBean"/>
              <% if (userForm.hasUserData()) {hasUser=true;} %>
              WLS Console Output:
              ..jsp_servlet\_jsp\_sailor\__home.java:493: cannot resolve symbol
              symbol : variable userForm
              location: class jsp_servlet._jsp._sailor.__home
              if (userForm.hasUserData()) { //[ /jsp/sailor/home.jsp; Line: 38]
              When I look at the JSP's parsed java code (__home.java:493) I find that nowhere
              in the class is the variable userForm declared.
              Is this a bug in WLS? Does anyone know of a workaround?
              Thanks,
              Scott
              

    Please contact customer support [email protected] and request a patch for
              CR112789. AT_END tags do not work correctly in 81sp1
              --Nagesh
              "Scott Fleming" <[email protected]> wrote in message
              news:3f734c0d$[email protected]..
              >
              > Hello,
              >
              > We are currently porting our application which uses struts 1.1 to WLS 8.1
              sp1
              > from another app server. Everything seems to deploy correctly and pages
              which
              > use struts tags appear to compile and run fine. However, the pages with
              struts
              > <bean:define> tags are not compiling.
              >
              > Example JSP Code:
              >
              > <bean:define id="userForm" name="userForm" scope="session" toScope="page"
              type="UserFormBean"/>
              >
              > <% if (userForm.hasUserData()) {hasUser=true;} %>
              >
              > WLS Console Output:
              >
              > ..jsp_servlet\_jsp\_sailor\__home.java:493: cannot resolve symbol
              > symbol : variable userForm
              > location: class jsp_servlet._jsp._sailor.__home
              > if (userForm.hasUserData()) { //[ /jsp/sailor/home.jsp; Line:
              38]
              >
              > When I look at the JSP's parsed java code (__home.java:493) I find that
              nowhere
              > in the class is the variable userForm declared.
              >
              > Is this a bug in WLS? Does anyone know of a workaround?
              >
              > Thanks,
              > Scott
              

  • Looking for struts bean:write   Equivalent function/ tag in jsf??

    Hi to all,
    I am quite new to jsf. Soi might be asking a stupid question.
    I just wanna to know is there an equivalent tag or simple scriplet that can provide the same function as strut <bean:write>?
    Thanks and regards,
    Chin Tat

    ok i am not a struts programmer but from a quick search i am assuming <bean:write> outputs in html the value of a property in your java bean?
    if this is the case then you simply use
    #{beanName.propertyName}
    i.e
    <h:outputText value="#{beanName.propertyName}"/>
    note your bean will have to be registered in you facesContext as a managed bean to do this (where beanName is the name of your managedBean)
    if bean:write doesn't do this sorry :) forget my answer

  • How to use logic:present tag in struts el tag

    Hi
    I am trying to use struts el tags in the jsp page.I am struggling with the following exception: Cannot find bean: "result" in any scope.I couldn't understand why this error is coming even i had the property "result" in my ActionForm.
    ActionForm:
    package com.finocus.cam.struts.bean;
    import java.util.List;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.struts.action.ActionError;
    import org.apache.struts.action.ActionErrors;
    import org.apache.struts.action.ActionMapping;
    import com.finocus.cam.common.ValidateFormat;
    public class DetailsForm extends org.apache.struts.action.ActionForm {
         private final static String LOG_TAG = DetailsForm.class.getName() + ".";
         private static final long serialVersionUID = 1L;
         // VARIABLES DECLARATION
         private String name = null;
         private String searchField = null;
         private String searchCriteria = null;
         private String phonenumber = "";
         private String email = "";
         private List results = null;
         private String adminUserName = "";
         private String adminUserEmail = "";
         public DetailsForm() {
         // GETTER AND SETTER METHODS
         public String getName() {
              return name;
         public void setName(String name) {
              this.name = name;
         public String getSearchCriteria() {
              return searchCriteria;
         public void setSearchCriteria(String searchCriteria) {
              this.searchCriteria = searchCriteria;
         public String getSearchField() {
              return searchField;
         public void setSearchField(String searchField) {
              this.searchField = searchField;
         public String getEmail() {
              return email;
         public void setEmail(String email) {
              this.email = email;
         public List getResults() {
              return results;
         public void setResults(List results) {
              this.results = results;
         public String getPhonenumber() {
              return phonenumber;
         public void setPhonenumber(String phonenumber) {
              this.phonenumber = phonenumber;
         public String getAdminUserEmail() {
              return adminUserEmail;
         public void setAdminUserEmail(String adminUserEmail) {
              this.adminUserEmail = adminUserEmail;
         public String getAdminUserName() {
              return adminUserName;
         public void setAdminUserName(String adminUserName) {
              this.adminUserName = adminUserName;
         // DUMPING THE VALUES IN THE CONSOLE
         public void dumpValues() {
              StringBuffer sb = new StringBuffer();
              sb.append("Name'");
              sb.append(name);
              sb.append("SearchField");
              sb.append(searchField);
              sb.append("searchCriteria");
              sb.append(searchCriteria);
              sb.append("'");
              sb.append(" ");
              System.out.println(sb.toString());
         // RESET() METHOD IS USED FOR STORE FORM'S CURRENT VARIABLES DECLARATION
         public void reset(ActionMapping actionMapping, HttpServletRequest request) {
              System.out.println("reset() method is called");
              this.email = null;
              this.searchCriteria = null;
              this.searchField = null;
              this.results = null;
         // VALIDATE() METHOD IS USED TO VALIDATE THE FORM DATA
         public ActionErrors validate(ActionMapping actionMapping,
                   HttpServletRequest request) {
              ActionErrors errors = new ActionErrors();
              System.out.println("Validate()is called");
              // Determine if name has been entered.
              if (getName() == null || getName().length() == 0
                        || getName().equals(" ")) {
                   errors.add("accountText", new ActionError("searchText.error"));
              } else if ((getSearchField().equals("name") == true)
                        && (ValidateFormat.isValidText(getName()) == false)) {
                   errors.add("validAccountName", new ActionError("validName.error"));
              if (getSearchField() == null || getSearchField().length() == 0) {
                   errors.add("accountSearchField", new ActionError(
                             "searchField.error"));
              } else if ((getSearchField().equals("email") == true)
                        && (ValidateFormat.isValidEmail(getName()) == false)) {
                   errors
                             .add("validAccountEmail", new ActionError(
                                       "validEmail.error"));
              } else if ((getSearchField().equals("phonenumber") == true)
                        && (ValidateFormat.isValidPhoneNoFormat(getName()) == false)) {
                   errors.add("validPhoneFormat", new ActionError(
                             "validPhoneFormat.error"));
              if ((getSearchField().equals("searchallfields"))
                        && ((ValidateFormat.isValidText(getName()) == false)
                                  && (ValidateFormat.isValidEmail(getName()) == false) && (ValidateFormat
                                  .isValidPhoneNoFormat(getName()) == false))) {
                   errors.add("validNameEmail",
                             new ActionError("validNameEmail.error"));
              return errors;
    Action class:
    package com.finocus.cam.struts.action;
    import java.util.ArrayList;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import javax.servlet.http.HttpSession;
    import org.apache.struts.action.ActionForm;
    import org.apache.struts.action.ActionForward;
    import org.apache.struts.action.ActionMapping;
    import com.finocus.cam.db.CAMDbAccess;
    import com.finocus.cam.struts.bean.DetailsForm;
    public class DetailsAction extends org.apache.struts.action.Action implements
              com.finocus.cam.common.CAMConstants {
         private final static String LOG_TAG = DetailsAction.class.getName() + ".";
         // Global Forwards
         public static final String GLOBAL_FORWARD_search = "login";
         // Local Forwards
         public static final String SUCCESS_search = "success";
         private boolean dumpRequestParams = true;
         public DetailsAction() {
         public ActionForward execute(ActionMapping mapping, ActionForm form,
                   HttpServletRequest request, HttpServletResponse response)
                   throws Exception {
              System.out.println("SearchAccount execute() is called");
              HttpSession session = request.getSession(true);
              ArrayList results = null;
              DetailsForm search = (DetailsForm) form;
              String name = search.getName();
              String searchField = search.getSearchField();
              String searchCriteria = search.getSearchCriteria();
              // Dumping the values of input patameters
              if (dumpRequestParams == true) {
                   request.setAttribute("SearchCriteria", searchCriteria);
                   request.setAttribute("SearchField", searchField);
                   request.setAttribute("Text", name);
                   search.dumpValues();
              // Perform search based on what criteria and search Field was entered.
              CAMDbAccess dbAccess = CAMDbAccess.getInstance();
              if (null != searchCriteria && searchField != null) {
                   System.out.println("Search Criteria =" + searchCriteria
                             + "Selected Option =" + searchField);
                   if (searchCriteria.equals(Search_Account) && searchField != null) {
                        results = dbAccess.searchByAccountInfo(name, searchCriteria,
                                  searchField);
                        System.out.println(" Search criteria :Exact Match was selected.<BR>");
              // Place search results in SearchForm for access by JSP.
              search.setResults(results);
              // Forward control to this Action's input page.
              return mapping.findForward(SUCCESS_search);
    My jsp page:
    <%@ taglib uri="/WEB-INF/tld/struts-bean" prefix="bean" %>
    <%@ taglib prefix="logic" uri="http://struts.apache.org/tags-logic-el" %>
    <%@ taglib uri="/WEB-INF/tld/struts-html" prefix="html" %>
    <html:html>
    <head>
    <title>Search Page</title>
    </head>
    <body colorants="LightGreen">
         <table width="100%" bgcolor="LightGreen">
              <tr>
                   <td align="left"><font color="brown"><h3><b>Search Info</b></h3></font><hr></td>
              </tr>
                   <tr>
              <td align="left"><h4><font color="brown"><b>Search Text:</b></font><%=request.getAttribute("Text")%></h4></td>
                   </tr><tr>
              <td align="left"><h4><font color="brown"><b>Search Field:</b></font><%=request.getAttribute("SearchField")%></h4></td>
              </tr><tr>
                   <td align="left"><h4><font color="brown"><b>Search Criteria:</b></font><%=request.getAttribute("SearchCriteria")%></h4></td>
                   </tr><tr>
                   <html:form action="/results.do">
                        <td><center><html:submit value="AllSearchOptions " /></center></td>
                        </html:form>
                   </tr>
              <tr>
                   <td align="left"><font color="brown"><hr><h2><b>Search Results</b></h2></font></td>
              </tr>
              <tr>
              <td>
              <table border="1" cellspacing="1" cellpadding="3" width="70%"
                   bgcolor="white">
                   <logic:present name="searchbyaccount" property="results">
                   Results exists
                        <c:if test="${size==0 }">
                   <center><font color="red"><b>No Results Found</b></font></center>
                   </c:if>
                   <br>
                        <c:if test="${size>0}">
                        Size is greater than ZERO
                             <table border="1" cellspacing="1" cellpadding="3" width="70%"
                                  bgcolor="white">
                                  <tr>
                                      <th>Customerid</th>
                                       <th>First Name</th>
                                       <th>Last Name</th>
                                       <th>Email</th>
                                       <th>phone Number</th>
                                       <th>Details</th>
                                  </tr>
                                       <c:forEach var="result" items="${results}">
                                        <c:out value="${result}"/>
                                       <tr>
                                            <td><bean:write name="result" property="customerid"></bean:write></td>
                                            <td><bean:write name="result"
                                                 property="accountAdminFirstName"></bean:write></td>
                                            <td><bean:write name="result"
                                                 property="accountAdminLastName" /></td>
                                            <td><bean:write name="result" property="accountability" /></td>
                                            <td><bean:write name="result" property="accountAdminPhone" /></td>
                                            <td><html:form action="/accountDetails.do">
                                                      <html:submit value="Details" />
                                            </html:form></td>
                                       </tr>
                                  </c:forEach>
                             </table>
                        </c:if>
              </logic:present>
              </table>
              </td>
              </tr>
         </table>
    </body>
    </html:html> Please refer me where i done a mistake.Thanks in Advance

    hi all,
    I am doing programs in sturts. My program
    My program purpose is to retrieve data from the
    database.My database is MySql. I know that we can
    write connection code in Action Class, it is ok for
    some less prog's if i want to use the sane connection
    code in more Action Classes it is vasting time and
    so.I don't think it's a good idea to put database code in Action classes. (That's one of the biggest drawbacks of Struts - it's completely tied to Actions, HTTP, and the Web.) Better to move that code into plain old Java objects and let the Actions call them.
    You'll be able to test them without the container or Struts, and you'll be able to reuse those objects in other, non-Web contexts.
    So i want to use <data-sources> tag that is available
    in struts-config.xml. I know that thre is tag withThis is the wrong place to configure a connection pool, too. Struts should have nothing to do with it. What if you change Web frameworks to WebWork or Spring? The connection pool should be configured in the container that hosts your app, not Struts.
    this name, but the problem is i don't know how to use
    this tag. If any budy know how to use this please
    tell me the syntax or any example.
    plese... reply soon..Don't do it. Think about doing it in your container, not Struts.
    %

  • How to use struts Logic tags in weblogic8.1

    hi
              i have used jakarta struts in JDeveloper there i used logic tags
              but the same i have to use in weblogic8.1 ,how should i use it
              i am new to weblogic platform
              it is very urgent
              please

    Hi harish,
              Procedure for using a Struts Tag Libraries in weblogic 8.1 :
              â€¢Copy the tag lib jar files under WEB-INF/lib ( if tag handler supplied as
              classes without package a jar file then we need to copy the classes
              under WEB_INF/classes.
              â€¢ Copy the tld files files under WEB-INF or create a directory under
              WEB-INF and copy tld files under this directory.
              â€¢ We need to give the information about the tag libraries in web.xml by
              adding the following lines to it as,
              <taglib>
              <taglib-uri>bean</taglib-uri>
              <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
              </taglib>
              <taglib>
              <taglib-uri>html</taglib-uri>
              <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
              </taglib>
              <taglib>
              <taglib-uri>logic</taglib-uri>
              <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
              </taglib>
              To use tags in jsp file we need to add taglib directive as ,
              <%@ taglib uri="logic" prefix=“logic"%>
              <%@ taglib uri="html" prefix=“html"%>
              <%@ taglib uri="bean" prefix=“bean"%>
              Every tag can support zero or more number of attributes and a tag may or
              may not support body content
              Every Tag Library Uniquely identified by uri defined in web.xml.
              we can use the tags in jsp according to the tags and attributes which are defined in *.tld files.
              if we look at .tld files we can find several tags and its attributes.
              note :any jar files that are related to struts framework ,place under the lib directory of the webapplication.
              ----- Anilkumar kari

  • File "/WEB-INF/struts-bean" not found

    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: File "/WEB-INF/struts-bean" not found
         at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:105)
         at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:430)
         at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:154)
         at org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:180)
         at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:354)
         at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:381)
         at org.apache.jasper.compiler.Parser.parseElements(Parser.java:795)
         at org.apache.jasper.compiler.Parser.parse(Parser.java:122)
         at org.apache.jasper.compiler.ParserController.parse(ParserController.java:199)
         at org.apache.jasper.compiler.ParserController.parse(ParserController.java:153)
         at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:227)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:369)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:473)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:190)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:594)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:392)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:565)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
         at java.lang.Thread.run(Thread.java:536)

    Thanks for the reply.This is what the jsp has:
    <%@ taglib uri="struts-bean" prefix="bean" %>
    <%@ taglib uri="struts-html" prefix="html" %>
    <html:html locale="true">
    <head>
    <title>Untitled Document</title>
    </head>
    <body bgcolor="#0080FF" text="#000000">
    <html:form action="/Address">
    <html:errors/>
    <!--<form method="POST" action="http://localhost:8084/sru/registration">-->
    <p> </p>
    <p>:
    <label></label>.....
    If it needs struts-bean.tld where should i copy it.I have already done trying to copy it into a folder named tags under
    my directory as such: webapps\sru\WEB-INF\tags\struts-bean.tld.
    Let me know if this is correct or not.
    Edited by: srujan on Apr 1, 2008 7:43 AM

  • HELP - why is form bean tag  not parsing?

    In my struts-config.xml file, I have the tag:
    <form-beans>
    <form-bean name="poolListForm"
    type="com.test.xm.forms.PoolListForm"/>
    </form-beans>
    I have a form, called PoolListForm.
    However, when I start weblogic, I get an error with the form bean (error goes away if I delete the form bean tag from struts-config.xml file. (error log is below).
    Does anyone know what's generating the error below???
    THANKS.
    2004-06-28 13:44:26,320 ERROR: Begin event threw exception
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
    java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
    sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:324)
    at org.apache.commons.beanutils.PropertyUtils.setSimpleProperty(Property
    Utils.java:1789)
    at org.apache.commons.beanutils.PropertyUtils.setNestedProperty(Property
    Utils.java:1684)
    at org.apache.commons.beanutils.PropertyUtils.setProperty(PropertyUtils.
    java:1713)
    at org.apache.commons.beanutils.BeanUtils.setProperty(BeanUtils.java:101
    9)
    at org.apache.commons.beanutils.BeanUtils.populate(BeanUtils.java:808)
    at org.apache.commons.digester.SetPropertiesRule.begin(SetPropertiesRule
    .java:259)
    at org.apache.commons.digester.Rule.begin(Rule.java:200)
    at org.apache.commons.digester.Digester.startElement(Digester.java:1273)
    at weblogic.apache.xerces.parsers.AbstractSAXParser.startElement(Abstrac
    tSAXParser.java:459)
    at weblogic.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement
    (AbstractXMLDocumentParser.java:221)
    at weblogic.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(XMLSch
    emaValidator.java:618)
    at weblogic.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XML
    NamespaceBinder.java:874)
    at weblogic.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamesp
    aceBinder.java:591)
    at weblogic.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDVa
    lidator.java:748)
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartE
    lement(XMLDocumentFragmentScannerImpl.java:747)
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentCo
    ntentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477)
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocume
    nt(XMLDocumentFragmentScannerImpl.java:329)
    at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguratio
    n.java:525)
    at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguratio
    n.java:581)
    at weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
    at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXPar
    ser.java:1175)
    at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
    at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:138)
    at org.apache.commons.digester.Digester.parse(Digester.java:1548)
    at org.apache.struts.action.ActionServlet.parseModuleConfigFile(ActionSe
    rvlet.java:1006)
    at org.apache.struts.action.ActionServlet.initModuleConfig(ActionServlet
    .java:955)
    at org.apache.struts.action.ActionServlet.init(ActionServlet.java:470)
    at javax.servlet.GenericServlet.init(GenericServlet.java:258)
    at weblogic.servlet.internal.ServletStubImpl$ServletInitAction.run(Servl
    etStubImpl.java:993)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:317)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
    118)
    at weblogic.servlet.internal.ServletStubImpl.createServlet(ServletStubIm
    pl.java:869)
    at weblogic.servlet.internal.ServletStubImpl.createInstances(ServletStub
    Impl.java:848)
    at weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubI
    mpl.java:787)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlet(WebAppS
    ervletContext.java:3252)
    at weblogic.servlet.internal.WebAppServletContext.preloadServlets(WebApp
    ServletContext.java:3197)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAp
    pServletContext.java:3174)
    at weblogic.servlet.internal.HttpServer.preloadResources(HttpServer.java
    :688)
    at weblogic.servlet.internal.WebService.preloadResources(WebService.java
    :483)
    at weblogic.servlet.internal.ServletInitService.resume(ServletInitServic
    e.java:30)
    at weblogic.t3.srvr.SubsystemManager.resume(SubsystemManager.java:131)
    at weblogic.t3.srvr.T3Srvr.resume(T3Srvr.java:964)
    at weblogic.t3.srvr.T3Srvr.run(T3Srvr.java:359)
    at weblogic.Server.main(Server.java:32)
    Caused by: java.lang.NoClassDefFoundError: org/apache/struts/action/ActionForm
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    3)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
    at java.lang.ClassLoader.defineClass0(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:12
    3)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClass
    Loader.java:223)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAw
    areClassLoader.java:41)
    at org.apache.struts.config.FormBeanConfig.formBeanClass(FormBeanConfig.
    java:320)
    at org.apache.struts.config.FormBeanConfig.setType(FormBeanConfig.java:1
    91)
    ... 48 more
    2004-06-28 13:44:26,360 ERROR: Parsing error processing resource path
    java.lang.reflect.InvocationTargetException
    at org.apache.commons.digester.Digester.createSAXException(Digester.java
    :2540)
    at org.apache.commons.digester.Digester.createSAXException(Digester.java
    :2566)
    at org.apache.commons.digester.Digester.startElement(Digester.java:1276)
    at weblogic.apache.xerces.parsers.AbstractSAXParser.startElement(Abstrac
    tSAXParser.java:459)
    at weblogic.apache.xerces.parsers.AbstractXMLDocumentParser.emptyElement
    (AbstractXMLDocumentParser.java:221)
    at weblogic.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(XMLSch
    emaValidator.java:618)
    at weblogic.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(XML
    NamespaceBinder.java:874)
    at weblogic.apache.xerces.impl.XMLNamespaceBinder.emptyElement(XMLNamesp
    aceBinder.java:591)
    at weblogic.apache.xerces.impl.dtd.XMLDTDValidator.emptyElement(XMLDTDVa
    lidator.java:748)
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartE
    lement(XMLDocumentFragmentScannerImpl.java:747)
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentCo
    ntentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1477)
    at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocume
    nt(XMLDocumentFragmentScannerImpl.java:329)
    at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguratio

    Caused by: java.lang.NoClassDefFoundError: org/apache/struts/action/ActionForm
    Stupid question, but are the struts jar files in your web-inf/lib directory?

  • Struts message-resource problems in jboss

    Hi,
    I'm fairly new to jsp/servlets and I'm trying to use the struts framework.
    I have a html file with the struts bean taglib defined and the following line :
    <bean:message key="index.title" />
    In struts-config.xml I have the following :
    <message-resources parameter="MyAppResources" />
    And I put MyAppResources.properties in WEB-INF/classes
    I then add the files to myapp.war and deploy it in jboss, but when I try to load the page I get the following exception :
    javax.servlet.ServletException: Cannot find message resources under key org.apache.struts.action.MESSAGE
    Any help would be greatly appreciated!!!

    and if, after deploying, you delete the war file? Does it work then?
    Problem seems to be that in a war file the directories arent as the class loader expects them, I think.

  • Jsp:include fails when referencing a struts bean:define bean

    When I request the jsp listed at the bottom, I get the following error:
              cannot resolve symbol
              symbol : variable pageTemplate
              The jsp works as is in both Tomcat and Resin.
              I know the pageTemplate bean gets defined by struts, because if I remove
              (1), I get the correct output of (2).
              Does WL precompile the pages differently than Tomcat/Resin?
              We know tiles can provide similar functionality, but for various reasons,
              this is the method that seems preferred.
              <%@ page contentType="text/html;charset=UTF-8" language="java" %>
              <%@ page import = "com.stabilia.site.*" %>
              <%@ page errorPage="/error.jsp" %>
              <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
              <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
              <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
              <%@ taglib uri="/WEB-INF/struts-tiles.tld" prefix="tiles" %>
                   <bean:define id="siteConfig" name="siteConfig" scope="session"
                        type="com.stabilia.site.SiteConfiguration"/>
                   <bean:define id="pageTemplate" name="siteConfig"
              property="currentPageTemplate"
                        type="com.stabilia.site.PageTemplate" scope="session"/>
                   (1)<jsp:include page="<%=pageTemplate.getTemplate()%>" />
                   (2)template:<bean:write name="pageTemplate" property="template"/>
              

    I know that in certain versions of WLS the Tag AT_END variables were not getting
              defined properly. Please contact support and ask for a patch referencing this
              with your current version.
              Sam
              Daren Desjardins wrote:
              > To be more specific, I found that I cannot use runtime expressions that
              > involve a bean defined by Struts. If the bean were declared in the
              > following way, it works.
              >
              > <%
              > SiteConfiguration siteconfig = (SiteConfiguration)
              > session.getAttribute(SiteConfiguration.SESSION_KEY);
              > PageTemplate pagetemplate = siteconfig.getCurrentPageTemplate();
              > %>
              > <jsp:include page="<%=pagetemplate.getTemplate()%>" flush="true"/>
              

  • JSP - Nested Jakarta Struts Logic Tags

    Hi,
    Simple question....
    Can Jakarta Struts Logic tags be nested when coding JSP's
    i.e.
    ==========================================
    <logic:iterate id="searchSizeTracker" name="searchSizeTracker" type="uk.co.troutlure.bom.SearchTrackerObject" scope="request">
    <logic:greaterEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <logic:lessEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getMaxPage()%>'>
    <logic:equal name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <jsp:getProperty name="searchSizeTracker" property="page_no"/>
    </logic:equal>
    <logic:notEqual name='searchSizeTracker' property='page_no' value='<%searchActionForm.getCurrentPage()%>'>
    <a href="<%=request.getContextPath()%>/performSearch.do?pageRequired=<bean:write name='searchSizeTracker' property='page_no'/>&action_id=<bean:write name='searchActionForm' property='currentActionId'/>&searchType=<bean:write name='searchActionForm' property='searchType'/>&currentScreen=search_reorder"><jsp:getProperty name="searchSizeTracker" property="page_no"/>
    </a>
    </logic:notEqual>
    </logic:lessEqual>
    </logic:greaterEqual>
    </logic:iterate>
    =========================================
    The above code sample seems to fail to get past the first <logic:greaterEqual tag even though the conditions are met. And the iterator just loops throught the rest of the SearchTrackerObjects.
    I'm not sure whether logic tags can be nested as shown???
    Thanks in advance.

    Yes you should be able to nest logic tags like that.
    However you seem to be wanting to limit the values that are iterated through using the greaterEqual and lessEqual tags.
    I would suggest you use the offset and length attributes on the logic:iterate tag:
    something like:
    <logic:iterate id="searchSizeTracker" name="searchSizeTracker" type="uk.co.troutlure.bom.SearchTrackerObject" scope="request" offset ="<%searchActionForm.getCurrentPage()%>" length="<%searchActionForm.getMaxPage() - searchActionForm.getCurrentPage()%>">Cheers,
    evnafets

  • Struts and JSP problem..help needed

    Hi,
    I am trying to use request.setParameter("formatName") from the JSP page into the ACtion class to display the user entered values.
    I have my struts action classes tagged to be in session scope since the UI is a wizard and i want the values to be carried on until they click finish. on the wizard.
    I want the formatName floating across the wizard, I have another value called."Category" floating since its a dynamically generated variable using the formbean.
    ***************ACTION class****************
    public class CreateFormatReportDefinitionAction extends Action
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
         final Logger logger = Logger.getLogger(this.getClass());
    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward(); // return value
    ClarityReportDefinitionFormBean rdFormBean = (ClarityReportDefinitionFormBean) form;
              HttpSession session = request.getSession();
              List fList = new ArrayList();
              FormatDAO fDAO = new FormatDAO();
              Format fmt = null;
    try {
              logger.log(Level.INFO, "Entering CreateFormatReportDefinition Action...");
              Person person = PersonUtil.getCurrentUser(request);
              logger.debug("Category is: "+rdFormBean.getCategory());
              List formats = fDAO.findFormatsForCategory(rdFormBean.getCategory());
              for(int i=0;i < formats.size(); i++) {
                   fmt = (Format)formats.get(i);
              if(fmt.getOwner().getEmailaddr().equals(person.getEmailaddr())){
              fList.add(fmt);
              rdFormBean.setUserFormatList(fList);
              logger.log(Level.DEBUG,"sessionObject for formName is: "+session.getAttribute("formatName"));
    } catch(Exception e) {
    // Report the error using the appropriate name and ID.
    errors.add("name", new ActionError("id"));
    // If a message is required, save the specified key(s)
    // into the request for use by the <struts:errors> tag.
    if (!errors.isEmpty()) {
    saveErrors(request, errors);
    // Write logic determining how the user should be forwarded.
    forward = mapping.findForward("success");
    // Finish with
    return (forward);
    ***********JSP form for the class****************
    <html:form action="/createFilterAction" >
    <table>
    <tr><td>
    <html:text property="formatName" />
    </td></tr>
              <tr>
                   <td>
    <html:select property="myFormats" onchange="insertSelectedMyFormat()">
    <html:option value="">Select user Formats</html:option>
    <c:forEach var="formats" items="${reportDefFormBean.userFormatList}">
    <html:option value="${formats.name}"><c:out value="${formats.name}"/></html:option>
    </c:forEach>
    </html:select>
    </td>
              </tr>
    </table>
    </html:form>
    ***********JAVASCRIPT**********
    var box = document.reportDefFormBean.myFormats;
    function insertSelectedMyFormat()
         var hisFormat = box.options[box.selectedIndex].value;
         document.reportDefFormBean.formatName.value = hisFormat;
    ********STRUTS_CONFIG.XML*****************
    <form-beans>
         <form-bean name="reportDefFormBean"
                   type="com.ibm.ads.reports.web.formbeans.ClarityReportDefinitionFormBean"></form-bean>
    </form-beans>
    <action name="reportDefFormBean" path="/createFormatReportDefinition"
                   type="com.ibm.ads.reports.web.actions.reportDefinition.CreateFormatReportDefinitionAction"
                   scope="session" validate="false">
                   <forward name="success" path="/createFormatReportDefinition.jsp"/>
    </action>
    I am getting a null for Session.getAttribute("formatName") or even if i change the scope to request, i use request.getPArameter("formatName"), i get null again.
    I dunno what iam missing in this regard, but if anyone has found anything wrong with my code...please help me out.
    any time spent will be appreciated.
    Thank you and regards,
    dev

    Hi,
    I am trying to use request.setParameter("formatName") from the JSP page into the ACtion class to display the user entered values.
    I have my struts action classes tagged to be in session scope since the UI is a wizard and i want the values to be carried on until they click finish. on the wizard.
    I want the formatName floating across the wizard, I have another value called."Category" floating since its a dynamically generated variable using the formbean.
    ***************ACTION class****************
    public class CreateFormatReportDefinitionAction extends Action
    public ActionForward execute(ActionMapping mapping, ActionForm form,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {
    final Logger logger = Logger.getLogger(this.getClass());
    ActionErrors errors = new ActionErrors();
    ActionForward forward = new ActionForward(); // return value
    ClarityReportDefinitionFormBean rdFormBean = (ClarityReportDefinitionFormBean) form;
    HttpSession session = request.getSession();
    List fList = new ArrayList();
    FormatDAO fDAO = new FormatDAO();
    Format fmt = null;
    try {
    logger.log(Level.INFO, "Entering CreateFormatReportDefinition Action...");
    Person person = PersonUtil.getCurrentUser(request);
    logger.debug("Category is: "+rdFormBean.getCategory());
    List formats = fDAO.findFormatsForCategory(rdFormBean.getCategory());
    for(int i=0;i < formats.size(); i++) {
    fmt = (Format)formats.get(i);
    if(fmt.getOwner().getEmailaddr().equals(person.getEmailaddr())){
    fList.add(fmt);
    rdFormBean.setUserFormatList(fList);
    logger.log(Level.DEBUG,"sessionObject for formName is: "+session.getAttribute("formatName"));
    } catch(Exception e) {
    // Report the error using the appropriate name and ID.
    errors.add("name", new ActionError("id"));
    // If a message is required, save the specified key(s)
    // into the request for use by the <struts:errors> tag.
    if (!errors.isEmpty()) {
    saveErrors(request, errors);
    // Write logic determining how the user should be forwarded.
    forward = mapping.findForward("success");
    // Finish with
    return (forward);
    }***********JSP form for the class****************
    <html:form action="/createFilterAction" >
    <table>
    <tr><td>
    <html:text property="formatName" />
    </td></tr>
    <tr>
    <td>
    <html:select property="myFormats" onchange="insertSelectedMyFormat()">
    <html:option value="">Select user Formats</html:option>
    <c:forEach var="formats" items="${reportDefFormBean.userFormatList}">
    <html:option value="${formats.name}"><c:out value="${formats.name}"/></html:option>
    </c:forEach>
    </html:select>
    </td>
    </tr>
    </table>
    </html:form>***********JAVASCRIPT**********
    var box = document.reportDefFormBean.myFormats;
    function insertSelectedMyFormat()
    var hisFormat = box.options[box.selectedIndex].value;
    document.reportDefFormBean.formatName.value = hisFormat;
    }********STRUTS_CONFIG.XML*****************
    <form-beans>
    <form-bean name="reportDefFormBean"
    type="com.ibm.ads.reports.web.formbeans.ClarityReportDefinitionFormBean"></form-bean>
    </form-beans>
    <action name="reportDefFormBean" path="/createFormatReportDefinition"
    type="com.ibm.ads.reports.web.actions.reportDefinition.CreateFormatReportDefinitionAction"
    scope="session" validate="false">
    <forward name="success" path="/createFormatReportDefinition.jsp"/>
    </action>I am getting a null for Session.getAttribute("formatName") or even if i change the scope to request, i use request.getPArameter("formatName"), i get null again.
    I dunno what iam missing in this regard, but if anyone has found anything wrong with my code...please help me out.
    any time spent will be appreciated.
    Thank you and regards,
    dev

Maybe you are looking for

  • IMac on Mountain Lion restarting "because of a problem" every 5 minutes for the last 4 days.

    My iMac has been restarting "because of a problem" every 5 minutes for the last 4 days. This started only since I updated Mountain Lion OS last Thursday (i didnt update TO mountain lion, i already had it and updated to a version that came up in the m

  • Task status not changing in UWL

    Task status is not changed in UWL when the task is executed from UWL . workitems transfered from R/3 by executing a workflow .SAP says real time refresh not supports in this UWL version. please let me know any workaround to solve this issue. Thanks S

  • How to get Glassfish setup in NetBeans 4.1?

    I do "Add server". when I enter the glassfish installation path, the next and finish buttons remain disabled. I know my Glassfish installation is setup correctly as I can view http://locahost:8080. What do I do?

  • Sales Order Generating more than one event when changed

    Hey all, I have to trigger a workflow when a sales order is changed (bus2032.changed) . The event is triggered when any changes are made and the save button is clicked . However my problem lies in the fact that the system produces the event not once

  • Fiori  web service  GetEntity single record show multiple times

    Hi Guys I have created Purchase Order GetEntity Web Service. In single Purchase order there are multiple Products. I have show that products in Line Item. In that line item a single records show multiple times. From Netweaver Geteway  GetEntity  serv