ec hurley

Greenhorn
+ Follow
since Mar 11, 2005
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ec hurley

I just ported my application to a new PC and now I am getting HTTP Status 404.

web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<listener>
<listener-class>org.apache.struts2.tiles.StrutsTilesListener</listener-class>
</listener>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<security-constraint>
<web-resource-collection>
<web-resource-name>Resources</web-resource-name>
<description>These pages are only accessible by authorized administrators.</description>
<url-pattern>/JSP/login.jsp</url-pattern>
</web-resource-collection>
<auth-constraint>
<description>These are the roles who have access.</description>
<role-name>ValidUser</role-name>
</auth-constraint>
<user-data-constraint>
<description>This is how the user data must be transmitted.</description>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
<login-config>
<auth-method>FORM</auth-method>
<form-login-config>
<form-login-page>/JSP/login.jsp</form-login-page>
<form-error-page>/JSP/error.jsp</form-error-page>
</form-login-config>
</login-config>
<security-role>
<description>webuser</description>
<role-name>ValidUser</role-name>
</security-role>
</web-app>


Struts.xml
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>
<package name="va.fsc" namespace="/" extends="tiles-default">
<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="index">
<result type="tiles">login</result>
</action>
<action name="login" class="va.fsc.actions.loginAction" method="execute">
<result name="login" type="tiles">login</result>
<result name="error" type="tiles">error</result>
<result name="input" type="tiles">login</result>
<result name="success" type="tiles">datepicker</result>
</action>

index.jsp
<%--
Document : index
Created on : Feb 6, 2013, 10:32:24 AM
Author : vafschurlee
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<META HTTP-EQUIV="Refresh" CONTENT="0;URL=index.action">
</head>

<body>
<h2>Loading, please wait ...</h2>
</body>
</html>

I do not understand why the index page is not loading. Please help.
9 years ago
I solved my own problem by setting request attribute in servlet. I eliminated scriptlet code accessing session attributes.
10 years ago
JSP
I have 3 JSP pages containing 1 JSTL c:forEach statement on each page.
Each statement takes a different session array list as input.
My problem is only the first page works. The second and 3rd pages do not display the output of the c:forEach.
What can I do?
10 years ago
JSP
Thank you for your help. The label rendered when I removed user. prefix. When I look at the source in IE. I see the fieldValue displsayed correctly. I have a better understanding of how to use.
15 years ago
Next to the checkbox, as the label
15 years ago
The correct number of checkboxes is rendering. I now need to get the user.fullname to display.
15 years ago
Nothing is rendered. Log contains "Expression parameter.name is undefined on line 21, column 61 in template/xhtml/checkbox.ftl"
15 years ago
I am trying to create checkboxes by iterating thru an ArrayList. The page comes up blank. Userlist is an array of users. "fullname is an element of user. The JSP code is

<s:form action="adminchg">

<s:iterator value="userlist">

<s:checkbox fieldValue="%{user.fullname}" />

</s:iterator>

<s:submit/>

Can someone please help me? I have not been able to get this working.
15 years ago
I found the error. Missing ")" after INQ_MGR.
Removing the quotes did not solve the problem.
Can anyone help? My SQL is giving me an error ORA-00909: invalid number of arguments.

private static final String CUM =
"select SUMMARY_MONTH" +
", SUM(INQ_TOTAL)" +
", SUM(INQ_INVALID)" +
", SUM(RESP_NULL)" +
", SUM(RESP_CACHE)" +
", SUM(RESP_INQ_MGR " +
", SUM(RESP_ACTIVE)" +
", SUM(RESP_INACTIVE)" +
", SUM(RESP_UNDETERMINED)" +
", SUM(RESP_INVALID270)" +
", SUM(RESP_AAA_TOTAL)" +
", SUM(RESP_BADRESP)" +
" from SITE_MONTHLY_SUM" +
" where SUMMARY_MONTH >= TO_DATE('?', 'yyyy/mm/dd')" +
" and SUMMARY_MONTH <= TO_DATE('?', 'yyyy/mm/dd')" +
" GROUP by SUMMARY_MONTH";

public void getCum( java.sql.Date start_date, java.sql.Date end_date)
throws SQLException{
log.info("UserDAOOracleImpl class getCum method");
cumBean cb = (cumBean) sc.getAttribute("cumbean");
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try{
con = getConnection();
log.info("Get Connection successful " + con.toString());
ps = con.prepareStatement(CUM);
ps.setDate(1, start_date);
ps.setDate(2, end_date);
log.info("QUERY = " + CUM);
rs = ps.executeQuery();
I solved my own problem. Once I brought tiles into the mix, I had to use programmatic validation. Thanks for making me think harder.
15 years ago
Thanks for responding.

loginAction:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package va.fsc;

import org.apache.log4j.Logger;
import org.apache.log4j.LogManager;
import com.opensymphony.xwork2.ActionSupport;
import java.util.Map;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.util.ServletContextAware;


/**
*
* @author ehurley
*/
public class loginAction extends ActionSupport
implements SessionAware, ServletRequestAware, ServletResponseAware, ServletContextAware
{
protected Logger log = LogManager.getLogger(va.fsc.loginAction.class);

private ServletContext sc;
private HttpServletRequest req;
private HttpServletResponse res;
private Map sessionMap;

private String username;
private String password;
private String chgpswd;
boolean isInvalidLogin = true;
String encrypted_password;


@Override
public String execute() throws Exception {

LOG.info("Login: execute() method is called, username = " + username);
if (isInvalid(getUsername())) return INPUT;
if (isInvalid(getPassword())) return INPUT;
return SUCCESS;
}

private boolean isInvalid(String value) {
return (value == null || value.length() == 0);
}

public String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}


public String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}

public String getChgpswd() {
return chgpswd;
}

public void setChgpswd(String chgpswd) {
this.chgpswd = chgpswd;
}

public void setServletRequest(HttpServletRequest req){
this.req = req;
}

public void setServletResponse(HttpServletResponse res){
this.res = res;
}

public void setServletContext(ServletContext sc){
this.sc = sc;
}

public void setSession(Map map){
this.sessionMap = map;
}

}

login-Action-Validation-xml
<!DOCTYPE validators PUBLIC
"-//OpenSymphony Group//XWork Validator 1.0.2//EN"
"http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">

<validators>
<field name="username">
<field-validator type="requiredstring">
<message>User Name is Required</message>
</field-validator>
<field-validator type="stringthlength">
<param name="minLength">5</param>
<message>User name must be greater than (5) characters</message>
</field-validator>
</field>
<field name="password">
<field-validator type="requiredstring">
<message>Password is Required</message>
</field-validator>
</field>
</validators>

Struts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
"http://struts.apache.org/dtds/struts-2.0.dtd">

<struts>

<package name="va.fsc" namespace="/" extends="tiles-default">

<result-types>
<result-type name="tiles" class="org.apache.struts2.views.tiles.TilesResult" />
</result-types>
<action name="index">
<result type="tiles">login</result>
</action>
<action name="login" class="va.fsc.loginAction" method="execute">
<interceptor-ref name="validation"/>
<result name="input" type="tiles">login</result>
<result name="chgpswd" type="tiles">chgpswd</result>
<result name="success" type="tiles">welcome</result>
</action>
<action name="chgpswd" class="va.fsc.chgpswdAction" method="execute">
<result name="input" type="tiles">chgpswd</result>
<result name="success" type="tiles">welcome</result>
</action>
<action name="expired" class="va.fsc.chgpswdAction" method="execute">
<result name="input" type="tiles">expired</result>
<result name="success" type="tiles">welcome</result>
</action>
<action name="visnlink">
<result type="tiles">fiscalyr</result>
</action>
<action name="fiscalyr" class="va.fsc.fiscalyrAction" method="execute">
<result name="success" type="tiles">finished</result>
</action>
<action name="logoff">
<result type="tiles">login</result>
</action>
</package>


</struts>
15 years ago
I am using Stuts 2 w/ Tiles 2. The validation is not working for me. I will post the code if anyone can help.
15 years ago
Yes, it is in the WAR
15 years ago