Struts action forward is NULL
Hi,
I have a Index jsp page. Ihave defined IndexAction as action class for this. I have defined it as <welcome-file> in web.xml.
Also I have action tab in struts-config file:
<action path="/index" type="com.cec.cll.webclient.logical.clr.actionclass.IndexAction" scope="request" validate="false">
< forward name="index" path="/index.jsp"/> </action>
So when I open my application and this jsp page, it goes to action class and fetch the results from database but when action class return the forward, its coming NULL.
forward = mapping.findForward("index");
I could not find why it is not getting mapping for index . Any ideas?
Action class:
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
HttpSession session = request.getSession(true);
List searchList = null;
ActionForward forward = null;
try {
searchList = RingUtilizationHelper
.getGigERingUtilizationForRing(null);
logger.info("inside Index Action...ends");
// sort the result
List orderedUList = sortResult(searchList);
session.setAttribute("results", orderedUList);
forward = mapping.findForward("index");
} catch (Exception ex) {
logger.debug("execute: exception : ", ex);
logger.info("inside Index Action...forward :"+forward);
return forward;
}
Similar Messages
-
JSF forward to old Struts action
Hi, The application which I'm working on is using Struts. However, the tendancy is to migrate to JSF. We are trying to include a bit JSF in our old Struts app.
For the moment this is done like this:
A Struts action is forwarded to a JSF page by specifying this in the struts-config.xml. This works: the JSF page is showed successfully.
However, when we want to 'submit' the JSF, which is specified in the faces-config.xml like this:
<navigation-case>
<from-action>#{Page.theAction}</from-action>
<from-outcome>success</from-outcome>
<to-view-id>/ourFile.do</to-view-id>
</navigation-case>This results in a 404: page not found. When using a browser and navigating to http://<server:port>/<AppRoot>/ourFile.do this file does exists.
Any idea why faces doesn't know this?
ThxSorry for reopening an old thread but now i'm stuck with a similar problem.
Actually i want to redirect to a struts application from my jsf application
for this i'm doing
String url="http://localhost:8080/strutsApp/strutsLogin.do";
res.sendRedirect(url);
this works fine and sends me to the login page.
But i intend to break the login page and enter the welcome page as i'm trying to implement SSO in my application.
Can any one guide me plz???????????????????? -
Forwarding struts action onto servlet....
...that delivers a file back to the client. I have an action that forwards onto a servlet that serves a PDF - the servlet works fine when accessed on its own, but when it is called from the struts action I get the browser download box appear but with the filename of the struts action, ie. 'MyAction.do' and not file type set.
Has anyone tried this before and had any success?
Thanks.Thanks, got that in though...
response.setContentType("application/pdf");
response.setHeader("Content-Disposition", "attachment;filename="+outputFilename);
It seems as if struts is controlling the output to a certain extent (e.g. the filename for download is 'Action.do' rather than my servlet response) even though I've forwarded onto a servlet where I set the above http response headers. -
Struts input forward using dispatch action
I have a insert jsp and another update jsp but one action with the dispatch concept named daction.In case of errors i forward using input forward(), but in config file i have can specify only one path in
<action input ="/insert.jsp"/>
but in case for the update error to pass to update.jsp how to handle...........request.getRequestDispatcher("reqresAction.action").forward(request, response);It's right.
But I believe you forgot about a tag like <dispatcher>FORWARD</dispatcher> in your <filter-mapping>(web.xml).
I use a rediration from servlet to action and it works fine. -
Call struts action from javascript?
Hi all
I'm having problem already discussed here quite a lot, but I have idea to solve it different way. And need to know is it possible or I'm doing mission impossible here :(
I have JSP with 2 drop down lilsts, where the second is populated according to selected value from first - that's basically my problem.
Is it possible to somehow only call my struts action which will return all needed values using javascript and onchange event handler?
I dont have any experience with javascript, and I'm trying to avoid it as much as possible at the moment.
Thanks in advancewell as far your requirement is concern if at all you are planning to implement AJAX try to use the below link which might be of some help...
http://www.it-eye.nl/weblog/2005/12/13/ajax-in-struts-implementing-dependend-select-boxes/
However,I somehow feel there are few loopholes in the author's approach...
i advice to use XmlHttpRequest.reponseXML property there.
However, i've mentioned a sample code snippet for you reference.
XML Response Pattern :
======================
<? xml version="1.1" ?>
<dropdown>
<option>
<val>CUSTOMIZED_VALUE</val>
<text>CUSTOMIZED_VALUE</text>
</option>
</dropdown>Sample.jsp:
===========
<%@page language="java" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Automatic Drop-Down Updation</title>
<script language="javascript">
// Global Variable for XmlHttp Request Object
var xmlhttp
// Timer Variables
var c = 0
var t
/* A function which calls a servlet named AjaxServlet to get XmlData using XmlHttpObject */
function refreshCombo(txt){
xmlhttp = null
// code for initializing XmlHttpRequest Object On Browsers like Mozilla, etc.
if (window.XMLHttpRequest){
xmlhttp = new XMLHttpRequest()
// code for initializing XmlHttpRequest Object On Browsers like IE
else if (window.ActiveXObject) {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP")
if (xmlhttp != null){
// Setting the Action url to get XmlData
url = "dropdown.do?count="+txt;
// Course of Action That Should be Made if their is a change in XmlHttpRequest Object ReadyState NOTE : it is 4 when it has got request from CGI
xmlhttp.onreadystatechange = getResponseAction;
// Open the Request by passing Type of Request & CGI URL
xmlhttp.open("GET",url,true);
// Sending URL Encoded Data
xmlhttp.send(null);
else{
// Only Broswers like IE 5.0,Mozilla & all other browser which support XML data Supports AJAX Technology
// In the Below case it looks as if the browser is not compatiable
alert("Your browser does not support XMLHTTP.")
/* Used for verifing right ReadyState & Status of XmlHttpRequest Object returns true if it is verified */
function verifyReadyState(obj){
// As Said above if XmlHttp.ReadyState == 4 then the Page Has got Response from WebServer
if(obj.readyState == 4){
// Similarly if XmlHttp.status == 200 it means that we have got a Valid response from the WebServer
if(obj.status == 200){
return true
else{
alert("Problem retrieving XML data")
/* Action that has to take place after getting reponse */
function getResponseAction(){
// Verifying State & Status
if(verifyReadyState(xmlhttp) == true){
// Building a DOM parser from Response Object
var response = xmlhttp.responseXML.documentElement
// Deleting all the Present Elements in the Drop-Down Box
drRemove()
// Checking for the Root Node Tag
var x = response.getElementsByTagName("option")
var val
var tex
var optn
for(var i = 0;i < x.length; i++){
optn = document.createElement("OPTION")
var er
// Checking for the tag which holds the value of the Drop-Down combo element
val = x.getElementsByTagName("val")
try{
// Assigning the value to a Drop-Down Set Element
optn.value = val[0].firstChild.data
} catch(er){
// Checking for the tag which holds the Text of the Drop-Down combo element
tex = x[i].getElementsByTagName("text")
try{
// Assigning the Text to a Drop-Down Set Element
optn.text = tex[0].firstChild.data
} catch(er){
// Adding the Set Element to the Drop-Down
document.SampleForm.SampleCombo.options.add(optn)
/* Function removes all the elements in the Drop-Down */
function drRemove(){
var x = document.SampleForm.SampleCombo
for(var i = document.SampleForm.SampleCombo.length - 1 ; i >= 0 ; i--){
x.remove(i)
</script>
</head>
<body onload="syncCount()">
<pre> <h1>Refresh Drop-Down <div id='txt'> </div> </h1></pre>
<form name="SampleForm">
<!-- Drop Down which has country list -->
<select name="x" onchange="refreshCombo(this.value)">
<option value="1">United States</option>
<option value="2">United Kingdom</option>
<option value="3">United Arab Emriates</option>
</select>
<!-- Drop Down which is dependent on Country Drop down get list of states -->
<select name="SampleCombo">
<option value="-1">Pick One</option>
</select>
</form>
</body>
</html>
struts-config.xml:
==================
<action-mappings>
<action path="/dropdown" type="com.controlleraction.AjaxActionClass">
<forward name="error" path="/error.jsp"/>
</action>
</action-mappings>AjaxActionClass.java:
=====================
package com.controlleraction;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class AjaxActionClass extends DispatchAction {
public ActionForward execute( ActionMapping mapping,ActionForm form,HttpServletRequest request,HttpServletResponse response) throws Exception {
String req = new String("");
try{
req = request.getParameter("count");
} catch(Exception exp){
if(!req.equals("")){
response.setContentType("text/xml");
response.setHeader("Pragma","no-cache");
response.setHeader("Cache-Control","no-cache,post-check=0,pre-check=0");
PrintWriter out = response.getWriter();
/*a sample bean where we trying to call a service from Model*/
com.Biz.XmlBean xml = new XmlBean();
String buffer = xml.getXmlData(req);
if(xml.close() == true && buffer.equals("") == false)
out.write(buffer);
return(null);
} else {
return new ActionForward("error");
}XmlBean.java:
=============
* XmlBean.java
import java.sql.*;
import java.util.*;
import java.io.*;
* @author RaHuL
public class XmlBean {
private Connection con = null;
private PreparedStatement pstmt = null;
private ResultSet rs = null;
// Setting CLASSURL path to TYPE I Driver
private String CLASSURL = "sun.jdbc.odbc.JdbcOdbcDriver";
/* Specifing CONNECTION PATH to a DSN named TestDsn
* Please Make Sure you create a DSN Named TestDsn to your database which holds EMP table
private String CONNECTIONURL = "jdbc:odbc:TestDsn";
boolean IS_ESTABLISHED = false;
/** Creates a new instance of XmlBean and also establishes DB Connections */
public XmlBean() {
try{
Class.forName(CLASSURL);
con = DriverManager.getConnection(CONNECTIONURL,"admin","");
IS_ESTABLISHED = true;
} catch(SQLException sqe){
sqe.printStackTrace();
} catch(Exception exp){
exp.printStackTrace();
/* Generates XmlData For the Business Logic Specified */
public String getXmlData(String req){
String XmlBuffer = new String("");
if(IS_ESTABLISHED == true){
try{
pstmt = con.prepareStatement("SELECT stateid,statename FROM STATE_TABLE where countryid = ?");
pstmt.setString(1,req);
rs = pstmt.executeQuery();
if(rs != null){
XmlBuffer = XmlBuffer + "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
XmlBuffer = XmlBuffer + "<!-- Edited by Rahul Sharma -->";
// Root Node
XmlBuffer = XmlBuffer + "<dropdown>";
while(rs.next()){
String value = rs.getString(1);
String text = rs.getString(2);
// Sub-root Node
XmlBuffer = XmlBuffer + "<option>";
// node which holds value of drop-down combo
XmlBuffer = XmlBuffer + "<val>"+value+"</val>";
// node which holds text for drop-down combo
XmlBuffer = XmlBuffer + "<text>"+text+"</text>";
XmlBuffer = XmlBuffer + "</option>";
XmlBuffer = XmlBuffer + "</dropdown>";
}catch(SQLException sqe){
sqe.printStackTrace();
} catch(Exception exp){
exp.printStackTrace();
return(XmlBuffer);
/* Closes the DB Connection Conmpletely */
public boolean close(){
if(IS_ESTABLISHED == true){
try{
pstmt.close();
con.close();
return(true);
} catch(SQLException sqe){
sqe.printStackTrace();
} catch(Exception exp){
exp.printStackTrace();
return(false);
NOTE: I understand i'm not completely coded things as per proper coding standards.please execuse me for that as this example was just given to enable user to learn how XmlHttpRquest,reponseXML
can be used for better purposes instead of devising manual parsing.
where i've used XmlHttpResponse pattern to be in XML. you may make use of other practices like JSON & so on depending on your requirement..
and and if you are more instrested in integrating Struts with AJAX using few frameworks & customized tag based support please go though the below link.
http://struts.sourceforge.net/ajaxtags/index.html
Hope that might help :)
REGARDS,
RaHuL -
Setting ViewObject Stored Procedure Where Clause Param from Struts Action
I adapted/used Steve's example to get stored procedure to populate my ViewObject. However, I could not retrieve any rows after passing whereClause value from Struts action. The param in execureQueryForCollection returns null.
What could be wrong. Thanks.
Here's my code.
ViewObjectImpl:
package org.adb.sls.model;
import java.math.BigDecimal;
import java.sql.CallableStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Timestamp;
import java.sql.Types;
import oracle.jbo.JboException;
import oracle.jbo.domain.Date;
import oracle.jbo.domain.Number;
import oracle.jbo.server.DBTransaction;
import oracle.jbo.server.ViewObjectImpl;
import oracle.jbo.server.ViewRowImpl;
import oracle.jbo.server.ViewRowSetImpl;
import oracle.jdbc.driver.OracleCallableStatement;
import oracle.jdbc.driver.OracleTypes;
// --- File generated by Oracle ADF Business Components Design Time.
// --- Custom code may be added to this class.
public class ViewApplicableLoanTypesImpl extends ViewObjectImpl
* PLSQL block that will execute the REF_CURSOR
private static final String SQL =
"begin ? := sls_loan_types_pkg.get_applcbl_staff_lns_fn(?); end;";
* PLSQL block that will count the REF_CURSOR returned rows
private static final String COUNTSQL =
"begin ? := sls_loan_types_pkg.get_count_applcbl_staff_lns_fn(?); end;";
* This is the default constructor (do not remove)
public ViewApplicableLoanTypesImpl()
* Overridden framework method.
* Wipe out all traces of a built-in query for this VO
protected void create() {
getViewDef().setQuery(null);
getViewDef().setSelectClause(null);
setQuery(null);
* Overidden framework method
protected void executeQueryForCollection(Object qc, Object[] params, int noUserParams)
// input parameter is employee number
String employeeNumber = null;
if (params != null) {
employeeNumber = (String) params[0];
} else
System.out.println("param is null");
storeNewResultSet(qc,retrieveRefCursor(qc,employeeNumber));
super.executeQueryForCollection(qc, params, noUserParams);
protected ViewRowImpl createRowFromResultSet(Object qc, ResultSet rs)
* We ignore the JDBC ResultSet passed by the framework (null anyway) and
* use the resultset that we've stored in the query-collection-private
* user data storage
rs = getResultSet(qc);
* Create a new row to populate
ViewRowImpl r = createNewRowForCollection(qc);
try {
* Populate new row by attribute slot number for current row in Result Set
populateAttributeForRow(r,0, nullOrNewNumber(rs.getBigDecimal(1)));
populateAttributeForRow(r,1, nullOrNewNumber(rs.getBigDecimal(2)));
populateAttributeForRow(r,2, rs.getString(3));
populateAttributeForRow(r,3, nullOrNewNumber(rs.getBigDecimal(4)));
populateAttributeForRow(r,4, rs.getString(5));
catch (SQLException s) {
throw new JboException(s);
return r;
protected boolean hasNextForCollection(Object qc)
ResultSet rs = getResultSet(qc);
boolean nextOne = false;
try {
nextOne = rs.next();
* When were at the end of the result set, mark the query collection
* as "FetchComplete".
if (!nextOne) {
setFetchCompleteForCollection(qc, true);
* Close the result set, we're done with it
rs.close();
catch (SQLException s) {
throw new JboException(s);
return nextOne;
protected void releaseUserDataForCollection(Object qc, Object rs)
* Ignore the ResultSet passed in since we've created our own.
* Fetch the ResultSet from the User-Data context instead
ResultSet userDataRS = getResultSet(qc);
if (userDataRS != null) {
try {
userDataRS.close();
catch (SQLException s) {
/* Ignore */
super.releaseUserDataForCollection(qc, rs);
public long getQueryHitCount(ViewRowSetImpl viewRowSet)
Object[] params = viewRowSet.getParameters(true);
String id = (String)params[0];
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(COUNTSQL,DBTransaction.DEFAULT);
* Register the first bind parameter as our return value of type CURSOR
st.registerOutParameter(1,Types.NUMERIC);
* Set the value of the 2nd bind variable to pass id as argument
if (id == null) st.setNull(2,Types.VARCHAR);
else st.setString(2,id);
st.execute();
return st.getLong(1);
catch (SQLException s) {
throw new JboException(s);
finally {try {st.close();} catch (SQLException s) {}}
* Return a JDBC ResultSet representing the REF CURSOR return
* value from our stored package function.
private ResultSet retrieveRefCursor(Object qc,String id) {
CallableStatement st = null;
try {
st = getDBTransaction().createCallableStatement(SQL,DBTransaction.DEFAULT);
* Register the first bind parameter as our return value of type CURSOR
st.registerOutParameter(1,OracleTypes.CURSOR);
* Set the value of the 2nd bind variable to pass id as argument
if (id == null) st.setNull(2,Types.VARCHAR);
else st.setString(2,id);
st.execute();
ResultSet rs = ((OracleCallableStatement)st).getCursor(1);
* Make this result set use the fetch size from our View Object settings
rs.setFetchSize(getFetchSize());
return rs ;
catch (SQLException s) {
s.printStackTrace();
throw new JboException(s);
finally {try {st.close();} catch (SQLException s) {}}
* Store a new result set in the query-collection-private user-data context
private void storeNewResultSet(Object qc, ResultSet rs) {
ResultSet existingRs = getResultSet(qc);
// If this query collection is getting reused, close out any previous rowset
if (existingRs != null) {
try {existingRs.close();} catch (SQLException s) {}
setUserDataForCollection(qc,rs);
hasNextForCollection(qc); // Prime the pump with the first row.
* Retrieve the result set wrapper from the query-collection user-data
private ResultSet getResultSet(Object qc) {
return (ResultSet)getUserDataForCollection(qc);
* Return either null or a new oracle.jbo.domain.Date
private static Date nullOrNewDate(Timestamp t) {
return t != null ? new Date(t) : null;
* Return either null or a new oracle.jbo.domain.Number
private static Number nullOrNewNumber(BigDecimal b) {
try {
return b != null ? new Number(b) : null;
catch (SQLException s) { }
return null;
Struts Action
package org.adb.sls.view;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import oracle.jbo.ApplicationModule;
import oracle.jbo.ViewObject;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import oracle.adf.model.binding.DCDataControl;
import oracle.adf.model.bc4j.DCJboDataControl;
import oracle.jbo.html.BC4JContext;
public class IndexAction extends DefaultADFAction
protected ActionForward performActionLogic(ActionMapping mapping,
ActionForm form, HttpServletRequest request,
HttpServletResponse response)
throws Exception {
try {
ApplicationModule am = getApplicationModule("SLSApplicableLoanTypesDataControl", request);
if (am == null)
System.out.println("am is null");
ViewObject vo = am.findViewObject("ViewApplicableLoanTypes");
vo.setWhereClauseParam(0,request.getSession().getAttribute("SSO_EMPLOYEE_NUMBER"));
vo.executeQuery();
} catch (Exception e)
e.printStackTrace();
return mapping.findForward("success");
Struts Config
<form-beans>
<form-bean name="DataForm" type="oracle.adf.controller.struts.forms.BindingContainerActionForm"/>
</form-beans>
<action-mappings>
<action path="/index" className="oracle.adf.controller.struts.actions.DataActionMapping" type="org.adb.sls.view.IndexAction" name="DataForm" unknown="false">
<set-property property="modelReference" value="indexUIModel"/>
<forward name="success" path="/home.do"/>
</action>
<action path="/home" className="oracle.adf.controller.struts.actions.DataActionMapping" type="oracle.adf.controller.struts.actions.DataForwardAction" name="DataForm" parameter="/index.uix" unknown="true">
<set-property property="modelReference" value="indexUIModel"/>
</action>
</action-mappings>I just found the solution. I've overridden setWhereClause method.
public void setWhereClauseParams(Object[] values)
ViewObjectImpl vo = (ViewObjectImpl) super.getViewObject();
vo.setWhereClauseParam(0,values[0]);
} -
Struts Actions and events in one jsp?!
Hello,
I have a problem with Struts actions and events in a jsp.
It is a search page and when the user clicks the search button I trigger an event and when the user clicks on a link in the result table (same page) I use an action that opens a new detail jsp. The first search query works well, I get a result, open the detail page, go back (using an action).
Then I start a new search, but struts tries to open the detail page. While debugging I found out, that struts apparantly has no action or event. Why does it work at first time?
Any ideas?
Thanks in advance
BrittaThanks for answer,
I work with actions AND events. I think that`s the problem. When I go back from detail page to search page I use a custom DataForwardAction class with the following method:
public void onCancel(DataActionContext ctx)
DCBindingContainer bc = ctx.getBindingContainer();
HttpServletRequest request = ctx.getHttpServletRequest();
WebUtils.setSession(request);
String ziel = request.getParameter("ziel");
JUCtrlActionBinding action = (JUCtrlActionBinding) bc.findCtrlBinding("Rollback");
action.doIt();
try
ctx.setActionForward(ziel);
catch (Exception e)
ctx.setActionForward("liste_freig");
Ziel has the correct value ("search") and I think the struts config is also correct:
<action path="/material" type="view.actions.materialAction" className="oracle.adf.controller.struts.actions.DataActionMapping" parameter="/material.jsp" name="DataForm">
<set-property property="modelReference" value="generalUIModel"/>
<forward name="liste_freig" path="/liste_freig.do"/>
<forward name="liste_angelegt" path="/liste_angelegt.do"/>
<forward name="list_bewertet" path="/list_bewertet.do"/>
<forward name="liste_abgelehnt" path="/liste_abgelehnt.do"/>
<forward name="liste_onhold" path="/liste_onhold.do"/>
<forward name="search" path="/search.do?action=search"/>
</action>
But when I get back from material page to search page (the first time it works). The location pathname is material.do not search.do When start a new search the material page opens, not, as desired, the search page with new results.
Search Action:
public class searchAction extends DataForwardAction
public searchAction()
protected void prepareModel(DataActionContext ctx) throws Exception
HttpServletRequest request = ctx.getHttpServletRequest();
DataActionMapping acmap = ctx.getActionMapping();
DCBindingContainer bc = ctx.getBindingContainer();
WebUtils.setSession(request);
JUCtrlActionBinding action = (JUCtrlActionBinding) bc.findCtrlBinding("delSearchQuery");
action.doIt();
String sEvent=null;
try
sEvent=request.getParameter("event");
catch (Exception e)
sEvent=null;
if (sEvent==null)
if (request.getParameter("action") != null)
if (request.getParameter("action").equals("material"))
Number mat_no=new Number(request.getParameter("MaterialNumber"));
Number userId=new Number(WebUtils.getUserId(request));
bc = ctx.getBindingContainer();
action = (JUCtrlActionBinding) bc.findCtrlBinding("prepareMaterial");
ArrayList arrayList= new ArrayList();
arrayList.add(0,mat_no);
arrayList.add(1,userId);
action.setParams(arrayList);
action.doIt();
ctx.setActionForward("material");
if (request.getParameter("action").equals("material_datasheet"))
ctx.setActionForward("material_datasheet");
super.prepareModel(ctx);
public void onSearch(DataActionContext ctx)
DCBindingContainer bc = ctx.getBindingContainer();
HttpServletRequest request = ctx.getHttpServletRequest();
WebUtils.setSession(request);
ctx.setActionForward("search");
Struts config:
<action path="/search" className="oracle.adf.controller.struts.actions.DataActionMapping" type="view.actions.searchAction" name="DataForm" parameter="/search.jsp">
<set-property property="modelReference" value="searchUIModel"/>
<forward name="search" path="/search.do?action=search"/>
<forward name="material" path="/material.do?action=material"/>
<forward name="material_datasheet" path="/material_datasheet.do?action=material_datasheet"/>
</action>
I think it`s a Struts bug. Or is there something I don`t see? -
Hi All,
I am getting the following error.. while running a simple application in struts.
Cannot find message resources under key org.apache.struts.action.MESSAGE ?
As I have searched in google but could not find the concreate example so please help and give me a proper answer..
my struts-config.xml file is as .....
<code>
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.0//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_0.dtd">
<struts-config>
<!-- ========== Form Bean Definitions ============ -->
<form-beans>
<form-bean name="login" type="test.struts.LoginForm" />
</form-beans>
<!-- ========== Global Forward Definitions ========= -->
<global-forwards>
</global-forwards>
<!-- ========== Action Mapping Definitions ======== -->
<action-mappings>
<action
path="/login"
type="test.struts.LoginAction"
name="login"
input="/jsp/LoginView.jsp"
validate="true">
<forward name="valid" path="/jsp/MainMenu.jsp" />
<forward name="invalid" path="/jsp/LoginView.jsp" />
</action>
</action-mappings>
<message-resources null="false" parameter="test.struts.MessageResources"/>
</struts-config>
</code>
And my LoginView.jsp file is as:
<code>
<!-- LoginView.jsp -->
<%@ taglib uri="/struts/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/struts/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/struts/WEB-INF/struts-logic.tld" prefix="struts" %>
<HTML>
<HEAD><TITLE><bean:message key="title.login" /></TITLE></HEAD>
<BODY>
<bean:message key="heading.login" />
<html:errors />
<html:form action="/login">
<p>
<bean:message key="label.userId" />:
<html:text property="userId" size="10" />
<br>
<bean:message key="label.passWord" />:
<html:password property="passWord" size="10" />
<br><br>
<html:submit>
<bean:message key="button.submit" />
</html:submit>
</html:form>
</BODY>
</HTML>
</code>
MessageResources.properties is as :
<code>
button.submit=Send for Verification
error.no.userId=<li>User ID is a required field</li>
error.no.passWord=<li>Password is a required field</li>
error.invalid.login=<li>The User ID and/or Password are invalid. Please try again.</li>
errors.footer=</ul><hr>
errors.header=<h3><font color="red">Validation Error</font></h3>You must correct the following error(s) before proceeding:<ul>
label.userId=User ID
label.passWord=Password
heading.login=<H2>Enter your user information</H2>
title.login=Login Screen
title.mainmenu=Welcome
heading.mainmenu=<H1>Welcome!</H1>
label.userType=<H2>You are authorized to use this system as a</H2>
</code>
Please reply soon.
Thanks in advance
AmitindiaHi All,
I am getting the following error.. while running a simple application in struts.
Cannot find message resources under key org.apache.struts.action.MESSAGE ?
As I have searched in google but could not find the concreate example so please help and give me a proper answer.. my struts-config.xml file is as .....
<?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE struts-
config PUBLIC "-//Apache Software Foundation//DTD Struts
Configuration 1.0//EN" "http://jakarta.apache.org/struts/dtds/struts-
config_1_0.dtd"> <struts-config> <!-- ========== Form Bean
Definitions ============ --> <form-beans> <form-bean name="login"
type="test.struts.LoginForm" /> </form-beans> <!-- ========== Global Forward Definitions ========= --> <global-forwards> </global-
forwards> <!-- ========== Action Mapping Definitions ======== --> <action-mappings> <action path="/login" type="test.struts.LoginAction" name="login" input="/jsp/LoginView.jsp" validate="true"> <forward name="valid" path="/jsp/MainMenu.jsp" /> <forward name="invalid" path="/jsp/LoginView.jsp" /> </action> </action-mappings> <message-resources null="false" parameter="test.struts.MessageResources"/> </struts-config>
And my LoginView.jsp file is as:
<!-- LoginView.jsp --> <%@ taglib uri="/struts/WEB-INF/struts-html.tld" prefix="html" %> <%@ taglib uri="/struts/WEB-INF/struts-bean.tld" prefix="bean" %> <%@ taglib uri="/struts/WEB-INF/struts-logic.tld" prefix="struts" %> <HTML> <HEAD><TITLE><bean:message key="title.login" /></TITLE></HEAD> <BODY> <bean:message key="heading.login" /> <html:errors /> <html:form action="/login">
<bean:message key="label.userId" />: <html:text property="userId" size="10" /> <br> <bean:message key="label.passWord" />: <html:password property="passWord" size="10" /> <br><br> <html:submit> <bean:message key="button.submit" /> </html:submit> </html:form> </BODY> </HTML>
MessageResources.properties is as :
button.submit=Send for Verification error.no.userId=<li>User ID is a required field</li> error.no.passWord=<li>Password is a required field</li> error.invalid.login=<li>The User ID and/or Password are invalid. Please try again.</li> errors.footer=</ul><hr> errors.header=<h3><font color="red">Validation Error</font></h3>You must correct the following error(s) before proceeding:<ul> label.userId=User ID label.passWord=Password heading.login=<H2>Enter your user information</H2> title.login=Login Screen title.mainmenu=Welcome heading.mainmenu=<H1>Welcome!</H1> label.userType=<H2>You are authorized to use this system as a</H2>
Please reply soon. Thanks in advance Amitindia -
How to call a struts action from a JSF page
I am working on a small POC that has to do with struts-faces. I need to know how to call a struts ".do" action from a JSF page..
Sameer Jafferis it not possible to call a action from the faces submit button and/or the navigation?
This a simple POC using struts-faces exmaples.
Here is my struts-config and faces-config file.
<struts-config>
<data-sources/>
<form-beans>
<form-bean name="GetNameForm" type="demo.GetNameForm"/>
</form-beans>
<global-exceptions/>
<global-forwards>
<forward name="getName" path="/pages/inputname.jsp"/>
</global-forwards>
<action-mappings>
<action name="GetNameForm" path="/greeting" scope="request" type="demo.GreetingAction">
<forward name="sayhello" path="/pages/greeting.jsp"/>
</action>
</action-mappings>
<controller>
<set-property property="inputForward" value="true"/>
<set-property property="processorClass"
value="org.apache.struts.faces.application.FacesRequestProcessor"/>
</controller>
</struts-config>faces-config
<faces-config>
<managed-bean>
<managed-bean-name>calculate</managed-bean-name>
<managed-bean-class>com.jsftest.Calculate</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>GetNameForm</managed-bean-name>
<managed-bean-class>demo.GetNameForm</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<navigation-rule>
<from-view-id>/calculate.jsp</from-view-id>
<navigation-case>
<from-outcome>success</from-outcome>
<to-view-id>/success.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>failure</from-outcome>
<to-view-id>/failure.jsp</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
<from-view-id>/inputNameJSF.jsp</from-view-id>
<navigation-case>
<to-view-id>/pages/greeting.jsp</to-view-id>
</navigation-case>
</navigation-rule>
</faces-config>in my inputNameJSF.jsp (faces page)
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core" %>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html" %>
<%@ taglib prefix="s" uri="http://struts.apache.org/tags-faces" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Say Hello!!</title>
</head>
<body>
Input Name
<f:view>
<h:form >
<h:inputText value="#{GetNameForm.name}" id = "name" />
<br>
<h:commandButton id="submit" action="/greeting.do" value=" Say Hello! " />
</h:form>
</f:view>
</body>
</html>I want to be able to call the struts action invoking the Action method in the that returns the name
package demo;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
public class GreetingAction extends org.apache.struts.action.Action {
// Global Forwards
public static final String GLOBAL_FORWARD_getName = "getName";
// Local Forwards
private static final String FORWARD_sayhello = "sayhello";
public GreetingAction() {
public ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
String name = ((demo.GetNameForm)form).getName();
String greeting = "Hello, "+name+"!";
request.setAttribute("greeting", greeting);
return mapping.findForward(FORWARD_sayhello);
}Edited by: sijaffer on Aug 11, 2009 12:03 PM -
Problem for Struts action to insert multiple records
I am writting a code for Struts action which inserting a single record to table A and multiple records to table B .The architecture that I applied is Struts+Spring+iBatis.The multiple records are come from a 10-rows table in the design.The name of each column element is same.The field name other than these are just single-row field.
<tr>
<td><input name="date" type="text" size="12" /></td>
<td><input name="billno" type="text" size="8" /></td>
<td><input name="desc" type="text" size="11" /></td>
<td><input name="purpose" type="text" size="20" /></td>
<td><input name="proName" type="text" size="6" /></td>
<td><input name="trainingCost" type="text" size="5" /></td>
<td><input name="travelCost" type="text" size="7" /></td>
<td><input name="entCost" type="text" size="5" /></td>
<td><input name="miscCost" type="text" size="5" /></td>
</tr> I am using three DTO objects to hold the data.claimArray is the ClaimDTO array that hold the multiple record insert to table B.claimdto is the object that hold the single field record to table A.claim_dtldto is the object that hold the single field record to table B.
PK of table A and table B are claimNo and claimDtlNo respectively.claimNo is also FK of table B. HTMLUtil is just an API that I used it for type conversion.There will have two insert statements in iBatis xml, insertClaim & insertClaimDtl to insert data into table A and table B respectively.I not sure what went wrong in the code,the data is not inserted into db.Thank advanced for you guys help..
This is the codes in Action file:
public class InsertClaimAction extends SpringAction {
public ActionForward execute(ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception {
// string arrays that store multiple values
String [] date = new String[10];
String [] billno = new String[10];
String [] description = new String[10];
String [] purpose = new String[10];
String [] proName = new String[10];
String [] trainingCost = new String[10];
String [] travelCost = new String[10];
String [] entCost = new String[10];
String [] miscCost = new String[10];
String staffName = request.getParameter("name");
String claimMy = request.getParameter("monthyear");
String department = request.getParameter("department");
String designation = request.getParameter("designation");
Double excrate = HTMLUtil.str2double(request.getParameter("excrate"),0.0);
Double grandTotal = HTMLUtil.str2double(request.getParameter("grandTotal"),0.0);
Double totalRM = HTMLUtil.str2double(request.getParameter("totalRM"),0.0);
Double totalFC = HTMLUtil.str2double(request.getParameter("totalFC"),0.0);
String fcName = request.getParameter("fcAbbr");
if(request.getParameter("date") != null)
date = request.getParameterValues("date");
if(request.getParameter("billno") != null)
billno = request.getParameterValues("billno");
if(request.getParameter("description") != null)
description = request.getParameterValues("description");
if(request.getParameter("purpose") != null)
purpose = request.getParameterValues("purpose");
if(request.getParameter("proName") != null)
proName = request.getParameterValues("proName");
if(request.getParameter("trainingCost") != null)
trainingCost = request.getParameterValues("trainingCost");
if(request.getParameter("travelCost") != null)
travelCost = request.getParameterValues("travelCost");
if(request.getParameter("entCost") != null)
entCost = request.getParameterValues("entCost");
if(request.getParameter("miscCost") != null)
miscCost = request.getParameterValues("miscCost");
//initialize dto
ClaimDTO claimdto = new ClaimDTO();
ClaimDTO claim_dtldto = new ClaimDTO();
ClaimDTO[] claimArray = new ClaimDTO[10];
claimdto.setClaimNo(claimNo);
claimdto.setStaffName(staffName);
claimdto.setClaimMy(claimMy);
claimdto.setDepartment(department);
claimdto.setDesignation(designation);
claimdto.setExcrate(excrate);
claimdto.setGrandTotal(grandTotal);
claim_dtldto.setClaimDtlNo(claimDtlNo);
claim_dtldto.setClaimNo(claimNo);
claim_dtldto.setTotalRM(totalRM);
claim_dtldto.setTotalFC(totalFC);
claim_dtldto.setFcName(fcName);
for(int i = 0;i < claimArray.length;i++) {
if(claimArray[i] != null) {
claimArray.setDate(date[i]);
claimArray[i].setBillno(billno[i]);
claimArray[i].setDescription(description[i]);
claimArray[i].setPurpose(purpose[i]);
claimArray[i].setProName(proName[i]);
claimArray[i].setTrainingCost(Double.parseDouble(trainingCost[i]));
claimArray[i].setTravelCost(Double.parseDouble(travelCost[i]));
claimArray[i].setEntCost(Double.parseDouble(entCost[i]));
claimArray[i].setMiscCost(Double.parseDouble(miscCost[i]));
//service
ClaimService springservice = (ClaimService)getBean("ClaimService");
springservice.insertClaim(claimdto);
springservice.insertClaimDtl(claim_dtldto,claimArray);
return mapping.findForward("success");Two things; you need to pass #number# as a form field and you
need to pull the correct record out.
Use this:
<cfloop list="#form.fieldnames#" index="fieldName">
<CFSET record = Evaluate("form.record_#number#")>
</cfloop>
Here's some example code: -
Returning xml from a struts action to be used by a ajax client
Hello,
I'm having issues with my ajax call on a WAS server. It functions correctly when run locally on tomcat and WSAD servers.
It looks like the response isnt comming back when the ajax call is made.
My java struts action does the following:
String xml = .....
aResponse.setContentType("text/xml");
aResponse.getWriter().write(xml);
aResponse.getWriter().flush();
return null;Is this the correct way to pass back a response?
do I have to set the header? if so, what should it be?
Thanks,
Con.A JSP is usually easier to construct the XML since you have looping etc. - otherwise OK.
-
How to call struts action manually in onchange property???
Hello!
action defined in struts-config.xml:
<action path="/editLafLm" className="oracle.adf.controller.struts.actions.DataActionMapping" type="oracle.adf.controller.struts.actions.DataForwardAction" name="DataForm" parameter="/editLafLm.jsp">
<set-property property="modelReference" value="editLafLmUIModel"/>
<forward name="Submit" path="/viewLaf.do"/>
</action>
In my JSP the following form:
<html:form action="/editLafLm.do" target="laf" onsubmit="self.close();">
<input type="hidden" name="<c:out value='${bindings.statetokenid}'/>" value="<c:out value='${bindings.statetoken}'/>"/>
<html:select property="StaId1">
<html:optionsCollection label="prompt" value="index" property="StaId1.displayData"/>
</html:select>
<c:out value="${bindings.editingMode}"/>
<input name="event_Submit" type="submit" value=" OK "/>
</html:form>
When i click choose an entry from the Select list and then click the Submit Button all works well (the action forward goes to viewLaf.do)
But i want to use the "onchange" property on the select list:
<html:select property="StaId1" onchange="submit();">
This is not the same as pressing the Submit button because here the action editLafLm.do is done in a new window (and then i have to click the submit button)...
So can i call the action or the action forward manually in the onchange-property so that there is the same behavour as clicking on the submit button???
Thanks
MarkusMarkus,
You can use the click method on the submit button called "event_Submit". The trick is to access it in the elements array of the form.
So instead of:
<html:select property="StaId1" onchange="submit();">you will have
<html:select property="StaId1" onchange="elements[n].click();">where n is the correct index of the 'event_Submit' element in the array of form elements.
If you need to access the form by name you can always count the form name to be DataForm. So from the document it will be:
document.forms.DataForm.elements[8].click()Charles. -
struts:action vs go Questions
Hello,
Can someone help me a little with the functional differences between <struts:action> and <go> in an event handler?
In the �Complete ADF UIX Application�� tutorial a forward link is always created and then the <go> element is used. In looking at the struts-config file these forwards simply seem to be pointers to the actual struts action to be performed.
My question: If I use <struts:action> and not <go> do I need the forward link anymore? If so, why.. what nefarious purpose does it exist for beyond �forwarding� to an actual struts action?
Thanks,
TomHi Tom,
As Bud said the Go element is used to navigate and is an abstraction, meaning that if you set the name to "goHere" in a Model 2 environment it will look for an edge called "goHere", and if you are using Model 1 it will look for a uix page called "goHere.uix". You cannot GO to an action the Go element has to point a forward.
The <struts:action> tag is part of a legacy from JDeveloper 9.0.3 (UIX 2.1) and will eventually be de-supported. The <struts:action> tag is intended to be set to /Action.do
Thanks, Jonas -
The import org.apache.struts.action.ActionError cannot be resolved
Hai anyone,. I' a newbie to struts and want to learn more. I download the example code, and run it. Hey, it work. But when I try to create it by myself by following the tutorial, I got stuck with my all java file when i want to try to compile it with eclipse.It say:
The import org.apache.struts.action.ActionError cannot be resolved
What' wrong?
this is one of the example code, i bolded the error line:
package dummies.struts.music;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.validator.DynaValidatorForm;
* @author Mike Robinson
public class LoginAction extends Action
* Handles request from user
* @param mapping
* @param form
* @param request
* @param response
* @throws Exception
public ActionForward execute( ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response)
throws Exception
// did the user click the Join button?
Boolean bCancel = (Boolean)request.getAttribute("org.apache.struts.action.CANCEL");
if(bCancel != null)
if(bCancel.booleanValue())
return (mapping.findForward("join"));
// create a new LoginBean passing the datasource
LoginBean lb = new LoginBean(getDataSource(request, "musiccollection"));
// check to see if this user/password combination are valid
// will return a non-null UserDTO if valid
UserDTO user = lb.validateUser((String)((DynaValidatorForm)form).get("email"),
(String)((DynaValidatorForm)form).get("password"));
if(user != null)
// save UserDTO in session
request.getSession().setAttribute("user",user);
return (mapping.findForward("success"));
else // username/password not validated
// create ActionError and save in the request
ActionErrors errors = new ActionErrors();
ActionError error = new ActionError("error.login.invalid");
errors.add("login",error);
saveErrors(request,errors);
return (mapping.findForward("failure"));
}Hi i try to build a dynamic web project in eclipse europa version.so i have opned my eclipse editor then right click selected the dynamic web project.onceit is done i wated to add the servelt so i have selcted the sevlet pressed ok then given name for it,next create servlet here iam getting the error lke this
"An error occured when create servlet is finished" and in deatils it displyainf like thi
"java.lang.Error: Unresolved compilation problems:
The import org.eclipse.jst.j2ee.internal cannot be resolved
CreateServletTemplateModel cannot be resolved to a type
CreateServletTemplateModel cannot be resolved to a type
at org.eclipse.jst.j2ee.web.ServletTemplate.<init>(ServletTemplate.java:3)"
can any one help me here i have been stuck from morning doing nothing try to solve this problem
thank u in advance
vijay -
Hi!
anybody could help me?
i am getting java.util.HashMap cannot be cast to org.apache.struts.action.ActionForm error when I run my jsp...
heres my code :
CommentAction.java
package com.provintl.rmis.actions;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.sql.DataSource;
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 com.provintl.rmis.forms.CommentForm;
public class CommentAction extends Action {
Statement stmt = null;
Connection con = null;
javax.sql.DataSource dataSource;
PreparedStatement ps = null;
ResultSet rs=null;
byte updFlg = 0;
Map commentlist = new HashMap();
/* (non-Javadoc)
* @see org.apache.struts.action.Action#execute(org.apache.struts.action.ActionMapping, org.apache.struts.action.ActionForm, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception {
CommentForm commentForm = new CommentForm();
Date date = commentForm.getDaterecord();
String comment = commentForm.getComment();
//TODO : temporary 1 == rose
int userID =1;
int appID =1;
String SelectQry = "SELECT "+
"APPLICANT_TBL.CHFNAME, "+
"APPLICANT_TBL.CHLNAME, "+
"APPLICANT_TBL.INTAPPID, "+
"USERHST_TBL.CHCOMMENT, "+
"USERHST_TBL.DTDATECREATED, "+
" USERHST_TBL.INTHSTID "+
"FROM "+
"APPLICANT_TBL "+
"INNER JOIN USERHST_TBL ON (APPLICANT_TBL.INTAPPID = USERHST_TBL.INTAPPID) " +
"WHERE APPLICANT_TBL.CHFNAME ='"+request.getParameter("first")+"' " +
"AND APPLICANT_TBL.CHLNAME ='"+request.getParameter("last")+"'";
try {
dataSource = (DataSource)getDataSource(request, "RMIS");
con = dataSource.getConnection();
con.setAutoCommit(false);
stmt = con.createStatement();
System.out.println("database connected");
rs = stmt.executeQuery(SelectQry);
System.out.println("database connected");
int ctr = 1;
while(rs.next()){
commentlist.put(ctr,new CommentForm(rs.getString("CHFNAME"),rs.getDate("DTDATECREATED")));
ctr++;
if(updFlg !=0){
String insQry = "INSERT INTO RECRUIT.USERHST_TBL (CHCOMMENT, INTUSERID, INTAPPID)" +
"VALUES ('"+comment+"',"+userID+","+appID+")";
stmt.executeUpdate(insQry);
con.commit();
updFlg = 0;
HttpSession session = request.getSession();
session.setAttribute("commentlist", commentlist);
//con.setAutoCommit(true);
} catch (SQLException se) {
System.out.println("We got an exception while preparing a statement:" +
"Probably bad SQL.");
System.out.println(SelectQry);
se.printStackTrace();
//System.exit(1);
finally {
try {
rs.close();
stmt.close();
con.close();
} catch (SQLException e) {
e.printStackTrace();
return mapping.findForward("comment");
commentform.jsp
=============
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jstl/sql_rt" prefix="sql"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script>
function putLabel(lbl, formName){
if (opener && !opener.closed){
opener.document.addapp.jobposition.value=lbl;
window.close();
</script>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>List of open positions</title>
</head>
<body>
<h2>Job Positions Available</h2>
<%
int ctr = 1; %>
<logic:iterate id="myString" name="commentlist" scope="session">
<table width="100%" border="0">
<%
String bakcolor;
if((ctr % 2) == 0){
bakcolor = "WHITE";
ctr++;
else{
bakcolor = "SILVER";
ctr++;
%>
<tr><td bgcolor="<%= bakcolor %>">
<bean:write name="myString" property="value" />
</td></tr>
${commentlist}
</table>
</logic:iterate>
</body>
</html>
thank you in advance!Shilnag wrote:
Hello guys,
I am new to java... I am trying to develop a web application using
1.Struts1.2
2.tomcat 5.5
3.eclipse 3.2.2Big mistake. Nobody new to Java should jump straight into webapps, let alone using a framework like Struts. Debatably, even Eclipse should be left alone.
It's precisely because of this that you're having problems. Presumably you're following a tutorial or something, but - as demonstrated - as soon as it goes wrong, you're stuck. Learn some core Java first, trust me
Maybe you are looking for
-
Using Calendar.set() method problem
Hi all, First of all sorry to bother with such a trivial(?) matter but I cannot solve it by myself. I have a piece of code which I simply want to handle the current date with the GregorianCalendar object so that the date would be set to the Calendar.
-
My ipad has locked-up, it has frozen while running an app, and will not respond to any button, what do I do? It simply stays on the same screen image, and does not respond to anything. When I plug it into itunes, there is no indication of its prese
-
Can not get my radio to start or show on menu
can not get my radio to start or show on menu
-
Hi I want to design a new process for destruction / scrap, it is like this: 1. We create a subcontract PO - with custom doc type on a material / text 2. This PO has account assignment 3. The components are the materials that need to be destroyed 4. T
-
Apex 4.02 BUG. Form on SQL wizard
One of the last pages of the form on SQL wizard lets you specify what pages to go to after cancel and submit. You can not enter something like &P7_PAGE_ID. here. Because when you finish the wizard you get an invalid number message. You must enter a n