Note that there are some explanatory texts on larger screens.

plurals
  1. POCant access the value of textfield element in action class
    primarykey
    data
    text
    <p>Here is the detail of the question</p> <h2>In struts.......</h2> <pre><code>&lt;action name="ICUGramEntry" class="sfa.view.ICUAction"&gt; &lt;result name="success" type="tiles"&gt;icuGramTiles&lt;/result&gt; &lt;/action&gt; </code></pre> <h2>In ICUAction class.............</h2> <pre><code>package sfa.view; import java.util.Map; import java.util.TreeMap; import com.opensymphony.xwork2.ActionSupport; public class ICUAction extends ActionSupport { /** * */ private static final long serialVersionUID = -5693693076048575455L; private Map&lt;String, String&gt; FieldType; private String rad; public String execute(){ System.out.println("ICUAction.execute()"); setFieldType(new TreeMap&lt;String, String&gt;()); setRad("ABC"); getFieldType().put("003", "RBM"); getFieldType().put("004", "ABM"); getFieldType().put("005", "MSR"); return SUCCESS; } public void setFieldType(Map&lt;String, String&gt; fieldType) { FieldType = fieldType; } public Map&lt;String, String&gt; getFieldType() { return FieldType; } public void setRad(String rad) { this.rad = rad; } public String getRad() { return rad; } } </code></pre> <p>In tiles......</p> <pre><code>&lt;definition name="icuGramTiles" extends="baseLayout"&gt; &lt;put-attribute name="body" value="/icuGram.jsp"/&gt; &lt;/definition&gt; </code></pre> <p>/icuGram.jsp</p> <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt; &lt;html&gt; &lt;head&gt; &lt;%@ taglib prefix="s" uri="/struts-tags"%&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Insert title here&lt;/title&gt; &lt;/head&gt; &lt;script type="text/javascript"&gt; &lt;body&gt; &lt;span class="pageHeader" &gt;ICU GRAM&lt;/span&gt; &lt;s:form action="ICUGramInsert" method="POST" theme="simple"&gt; &lt;jsp:include page="/headerbar.jsp"&gt;&lt;/jsp:include&gt; &lt;s:select id="fieldtype" list="FieldType" name="TYPE" cssClass="smallSelect" cssStyle="width:200px;" "&gt;&lt;/s:select&gt; &lt;s:textfield name="rad"&gt;&lt;/s:textfield&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>i can view the value in textfield on jsp as </p> <blockquote> <p>ABC</p> </blockquote> <p>as set in action </p> <blockquote> <p>setRad("ABC");</p> </blockquote> <p>from here ICUGramInsert action is called </p> <pre><code>&lt;action name="ICUGramInsert" class="sfa.view.ICUGramInsert" &gt; &lt;result type="chain"&gt;/Detail.jsp&lt;/result&gt; &lt;/action&gt; </code></pre> <p>and it goes to sfa.view.DetailAction</p> <pre><code>package sfa.view; import java.util.HashMap; import java.util.List; import java.util.Map; import com.opensymphony.xwork2.ActionSupport; public class ICUGramInsert extends ActionSupport { /** * */ private static final long serialVersionUID = 1L; private String TYPE; public String execute() { System.out.println("DetailAction.execute()...1"+this.getTYPE()); System.out.println("DetailAction.execute()...2"+this.getrad()); return SUCCESS; } public void setTYPE(String tYPE) { TYPE = tYPE; } public String getTYPE() { return TYPE; } } </code></pre> <p>i get the console out put of this.getTYPE() as follows=============> DetailAction.execute()...1null DetailAction.execute()...2null</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload