Oleg Vakil

Greenhorn
+ Follow
since May 25, 2011
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 Oleg Vakil

David Wimmer wrote:I did not want to bother a long time. So I've done all my actions in the default namespace and it works.




Nice. But I think, problem is not connected to default namespace.
I tried default namespace too, it did not work.
best regards
Oleg
11 years ago
Ok
I just solved this problem for my task. I will put xmls, but more important was a location of struts.xml.
Curious, I was forced put it to sources!


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="default" extends="struts-default">
<action name="sayhello" class="mypackage.Hello">
<result>/response.jsp</result>
</action>
</package>
</struts>
Although Netbeans complaining on mistakes in this xml....

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>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

my jspps:
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix = "s" uri="/struts-tags" %>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>

<s:form method="post" action="sayhello">
<s:textfield name="name" label="Your name"/>
<s:submit/>
</s:form>
</body>
</html>

and second one
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix = "s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
I am <s:property value="message"/>
</body>
</html>

Be lucky

Also look at project's structure!
11 years ago
hello
1) I had something like your problem for getter with ArrayList as return type.
As remember, I have used SelectItem without problem. If you need list for select,
it is Ok to use SelectItem

2) Also I propose to rename public String getSchoolLevelIdList(int aIndex) to other name..
11 years ago
Hello David,
I have exactly the same problem...
I am trying to start simplest my name example , basing on a lot of examples...
I dont want double your thread...
After near one day reading how simple and effective Struts2:-))) I have decided ask EXperts and saw your thread!

I will put my struts and web xmls..

web
<?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>
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>

struts
<?xml version="1.0" encoding="UTF-8"?>
<struts>
<constant name="struts.devMode" value="true" />
<package name="Struts2App" namespace="/">
<action name = "sayhello" class="mypackage.Hello">
<result>/response.jsp</result>
</action>

</package>
</struts>

index.jsp
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib prefix = "s" uri="/struts-tags" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
<s:form action="sayhello" >
<s:textfield name="name" label="Your name"/>
<s:submit/>
</s:form>
</body>
</html>

regards and be Lucky with Struts2!
11 years ago
Hello, I am coding upload application and use:
JSF 1.x- 2, Tomcat 6.0/ Firefox
My problem is a misterious behavior of t:inputFileUpload ( an x:inputFileUpload too). My jsp is a rather simple still

<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/tomahawk" prefix="t" %>
<jsp:useBean id="FileUploadForm" scope="application" class="FUF.FileUploadForm"/>
<html>
<head>
<title>t:inputFileUpload example</title>
</head>
<body>
<f:view>
<h:form id="welcomeForm" enctype="multipart/form-data">
<t:inputFileUpload id="fileupload" value=
"#{FileUploadForm.upFile}" size="20" />

<h:commandButton value="Load the file" action=
"#{FileUploadForm.upload}" />
<t:outputText value="#{FileUploadForm.result}"
style="color:green;font-weight:bold"/>

</h:form>
</f:view>
</body>
</html>
nothing special in upload method, it corresponds to miscellaneous examples.
But with enctype="multipart/form-data" upload method is not calling, I have System.out.println on a top of UPLOAD;
without enctype UPLOAD is calling but FileUploadForm.upFile is null, so I am not able to upload file.
Thanks for any explanations..a lot of thanks. I tried it a lot of times, may be, somebody hav the same problem. Information about problems with t:inputFileUpload is available, but doesnot help to solve a problem.

What is a rteliable alternative to t:inputFileUpload ?
Thanks again

11 years ago
JSF