Author Login
Post Reply
user Digest 18 Mar 2008 06:46:01 -0000 Issue 7931
Topics (messages 184343 through 184372):
Re: Struts2 Annotation based Validation
184343 by: Jeromy Evans
184344 by: Lukasz Lenart
[S2] Calling getMethod with parametr
184345 by: bugs_
Re: <s:property in <s:*> not interpreted
184346 by: Dave Newton
Re: [OT] XML Preprocessing
184347 by: Roger Varley
184348 by: Chris Pratt
184354 by: Dave Newton
Re: How to initialize business service objects?
184349 by: Frank Fischer
184350 by: Griffith, Michael *
184351 by: Piero Sartini
184352 by: Randy Burgess
184353 by: Rushikesh Thakkar
184355 by: Dave Newton
184358 by: Frank Fischer
184359 by: Dave Newton
184360 by: Griffith, Michael *
Struts 2 and JSP 2.0 tags
184356 by: Kalpesh Modi
Re: [struts] Struts 2 and JSP 2.0 tags
184357 by: Dale Newfield
uploaded image file contentType (IE vs Firefox)
184361 by: akash agrawal
184362 by: Dave Newton
184363 by: akash agrawal
184364 by: Dave Newton
Struts 1 return stream (documents)
184365 by: bhaarat Sharma
184366 by: Dave Newton
184367 by: bhaarat Sharma
184368 by: Dave Newton
184369 by: bhaarat Sharma
struts 1.2 html:select and submit button
184370 by: Sonu S
184372 by: Sudhan Maharjan
Re: Issue In Autocompleter
184371 by: Ozzy
Administrivia:
---------------------------------------------------------------------
To post to the list, e-mail: user@(protected)
To unsubscribe, e-mail: user-digest-unsubscribe@(protected)
For additional commands, e-mail: user-digest-help@(protected)
----------------------------------------------------------------------

Attachment:
user_184343.ezm (zipped)Lukasz Lenart wrote:
> Hi,
>
> Error messages are stored in request, you have to subclass
> ActionSupport and add some mechanism to store messages in session.
>
>
> Regards
>
In Struts2 error messages are stored in the ValueStack in an object
implementing ValidationAware.
If your action extends ActionSupport, then means they're available as a
property of your action.
You can read them from any object in the ValueStack using OGNL. Have a
look at ValidationAware.
eg. to iterate through action errors:
<s:iterator value="actionErrors"></s:iterator>
They're not available in the request object. They are available in the
session object only if something puts them there for you (which is not
the default case).
The actionError tag applies a template. You may be better off creating
a custom template.
regards,
Jeromy Evans

Attachment:
user_184344.ezm (zipped)> In Struts2 error messages are stored in the ValueStack in an object
Yes, I made mistake, I've mean in request scope, not in request object ;-)
Regards
--
Lukasz

Attachment:
user_184345.ezm (zipped)
In Struts 1 is this:
In the ActionForm is this method:
public boolean getTechnologyCheckbox(String key) throws
ValueNotDefinedException {
return sessionData.getTechnologyById(key).isSelected();
}
In the jsp page is:
<html:checkbox property="<%=propertyName%>" styleClass="textinput"/>
<%=propertyName%> is for example
"technologyCheckbox(thermal_desorption)"
so as result it render:
<input type="checkbox" name="technologyCheckbox(thermal_desorption)"
value="on"
checked="checked" class="textinput">
It call method getTechnologyCheckbox("thermal_desorption") from
ActionForm, and it works fine.
I need rewrite this in Struts 2.
In Struts 2 action I have methods:
public boolean getTechnologyCheckbox(String key) throws
ValueNotDefinedException {
return sessionData.getTechnologyById(key).isSelected();
}
public boolean isTechnologyCheckbox(String key) throws
ValueNotDefinedException {
return sessionData.getTechnologyById(key).isSelected();
}
In jsp page i have:
<s:checkbox name="%{#attr.propertyName}" cssClass="textinput" />
so as result it render for example:
<input type="checkbox" name="technologyCheckbox(thermal_desorption)"
value="true"
id="technologies_technologyCheckbox(thermal_desorption)"
class="textinput"/>
But this doesn't work. It never call method
getTechnologyCheckbox("thermal_desorption") or
isTechnologyCheckbox("thermal_desorption").
That's why chech box is never checked.
Please. Can anybody help me?
--
Sent from the Struts - User mailing list archive at Nabble.com.

Attachment:
user_184346.ezm (zipped)--- GF <ganfab@(protected):
> > ...unless you use the XML syntax available from JSP 2.0 and later ;-)
> And in this case, how can you resolve the <div id="<s:property... ?
<div id="${aProperty}"...>
Dave

Attachment:
user_184347.ezm (zipped)I've never tried to do this since, normally, you want the XML processor to
handle entities such as the & symbol - and if either the input XML or output
XML contains these symbols unaltered then you don't have legal XML.
If you really need to leave these unprocessed, then perhaps you can replace
the SAX EntityResolver with your own implementation?
Perhaps if you could explain what you're trying to do?
Regards
On Monday 17 March 2008 05:39:07 Chris Pratt wrote:
> Sorry I missed the normal Friday free-for-all with my Off Topic
> question, but I'm hoping someone around here has already solved the
> problem I'm staring at.
>
> I am trying to pre-process a stream of HTML/XML. My first thought was
> to just use SAX (with TagSoup for the HTML) and watch for the tokens I
> needed to modify while passing the rest through, but all the XML tools
> I can find are geared towards processing XML, not pre-processing it.
> So they help you out by automatically converting entities to their
> values and other things that completely get in the way of
> pre-processing. Has anybody else had to solve this problem? If so,
> any pointers would be GREATLY appreciated. Thanks.
> (*Chris*)

Attachment:
user_184348.ezm (zipped)On Mon, Mar 17, 2008 at 8:02 AM, Roger Varley
<roger.varley@(protected):
> I've never tried to do this since, normally, you want the XML processor to
> handle entities such as the & symbol - and if either the input XML or output
> XML contains these symbols unaltered then you don't have legal XML.
>
> If you really need to leave these unprocessed, then perhaps you can replace
> the SAX EntityResolver with your own implementation?
>
> Perhaps if you could explain what you're trying to do?
>
Unfortunately the EntityResolver just finds files containing external
entities, so that doesn't seem to help much.
What I'm trying to do is read a stream of HTML and make changes to
certain tags ,like adding a target="_blank" to the <a> tags and
setting the src attributes for <img>, <link> and others so they can't
be loaded, for a mail viewer web application. I'd prefer not to
change the stream in any ways other than the intentional changes, so
that I don't run into any weird bugs down the line. But I haven't
found a good technique to do that yet.
(*Chris*)

Attachment:
user_184354.ezm (zipped)--- Chris Pratt <thechrispratt@(protected):
> What I'm trying to do is read a stream of HTML and make changes to
> certain tags ,like adding a target="_blank" to the <a> tags and
> setting the src attributes for <img>, <link> and others so they can't
> be loaded, for a mail viewer web application. I'd prefer not to
> change the stream in any ways other than the intentional changes, so
> that I don't run into any weird bugs down the line. But I haven't
> found a good technique to do that yet.
While I'd imagine there are HTML libraries that don't convert entities (you
might check out http://htmlparser.sourceforge.net/, at least) you can always
use regular expressions. If your input is well-formed I'd imagine that XSLT
would also work, but then you'd have to use XSLT, and we'd all stand around
and laugh and point.
I don't know if you're trying to do this from within a Java application or as
a standalone tool, but if standalone, I'd probably just use one of the
[J]Ruby alternatives; I do a lot of massaging with a combination of regex and
some of the XML/HTML libraries.
Dave

Attachment:
user_184349.ezm (zipped)
Hi all
first i'd like to thank all of you that have given me valuable feedback to
my question.
Following the answers from Dave and Jeromy i decided to go the "hard" way
with Spring and DI. After reading some manuals (thanks to GF, good reading)
i managed to load the Spring ContextLoaderListener and even define an POJO
bean that serves as my BusinessLogicService. From the Tomcat logs i can see
that an instance of that Service is created.
As far as i read/unterstood, i now would only have to create a setter method
on my Action class and Spring then would automatically inject the related
dependcy to my Action class. So far, this doesn't seem to work, so i guess,
i must be missing something.
My applicationContext.xml looks quite simple (and seems to work, since the
DispatcherService is created on startup):
-----------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="autodetect">
<bean id="DispatcherService"
class="com.demo.businesslogic.DispatcherService"/>
</beans>
-----------
The Struts config looks like:
-----------
<?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="customerAgent" extends="struts-default">
<action name="login" method="login" class="com.demo.CustomerAction">
<result name="input">/CustomerLogin.jsp</result>
<result name="success">/CustomerChat.jsp</result>
</action>
<action name="logout" method="logout"
class="com.demo.CustomerAction">
<result name="success">/CustomerLogin.jsp</result>
<result name="input">/CustomerLogin.jsp</result>
</action>
<action name="chat" method="chat" class="com.demo.CustomerAction">
<result name="success">/CustomerChat.jsp</result>
</action>
</package>
</struts>
-----------
So i guess, i must be missing something. Is there a way i would have to tell
Spring which Action classes to inject?
Thanks a lot for your help
Frank

Attachment:
user_184350.ezm (zipped)Frank,
Check two things:
1) You have included the struts2-spring-pliugin.jar in your classpath
2) Your applicationContext.xml file is getting loaded on startup. If
you haven't already done so, check your web.xml for a context parameter
like this:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext*.xml</param-value>
</context-param>
HTH,
MG
-----Original Message-----
From: Frank Fischer [mailto:frank.fischer@(protected)]
Sent: Monday, March 17, 2008 11:09 AM
To: 'Struts Users Mailing List'
Subject: RE: How to initialize business service objects?
Hi all
first i'd like to thank all of you that have given me valuable feedback
to
my question.
Following the answers from Dave and Jeromy i decided to go the "hard"
way
with Spring and DI. After reading some manuals (thanks to GF, good
reading)
i managed to load the Spring ContextLoaderListener and even define an
POJO
bean that serves as my BusinessLogicService. From the Tomcat logs i can
see
that an instance of that Service is created.
As far as i read/unterstood, i now would only have to create a setter
method
on my Action class and Spring then would automatically inject the
related
dependcy to my Action class. So far, this doesn't seem to work, so i
guess,
i must be missing something.
My applicationContext.xml looks quite simple (and seems to work, since
the
DispatcherService is created on startup):
-----------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd">
<beans default-autowire="autodetect">
<bean id="DispatcherService"
class="com.demo.businesslogic.DispatcherService"/>
</beans>
-----------
The Struts config looks like:
-----------
<?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="customerAgent" extends="struts-default">
<action name="login" method="login"
class="com.demo.CustomerAction">
<result name="input">/CustomerLogin.jsp</result>
<result name="success">/CustomerChat.jsp</result>
</action>
<action name="logout" method="logout"
class="com.demo.CustomerAction">
<result name="success">/CustomerLogin.jsp</result>
<result name="input">/CustomerLogin.jsp</result>
</action>
<action name="chat" method="chat"
class="com.demo.CustomerAction">
<result name="success">/CustomerChat.jsp</result>
</action>
</package>
</struts>
-----------
So i guess, i must be missing something. Is there a way i would have to
tell
Spring which Action classes to inject?
Thanks a lot for your help
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_184351.ezm (zipped)Am Donnerstag, 13. März 2008 22:32:34 schrieb Frank Fischer:
> Now i don't understand (1) where to create/initialize these business logic
> classes and (2) how to get access to them from the action classes.
Just build your business logic without thinking about s2 too much. From your
action classes you can access your business logic like everything else. Its
really more of a java problem how to do this =)
If you have to run initialization code at startup, maybe a normal Listener is
what you are looking for...
Piero

Attachment:
user_184352.ezm (zipped)You also need to setup your action in the application context so that Spring
knows where to inject the business object. Your class name in the Struts
action also needs to be the *bean id of the action* so that the
Struts/Spring plugin can do it's work. So assuming you have a setter for
DispatcherService in CustomerAction your struts.xml would look like this.
> <struts>
>
> <package name="customerAgent" extends="struts-default">
>
> <action name="login" method="login" class="customerAction">
> <result name="input">/CustomerLogin.jsp</result>
> <result name="success">/CustomerChat.jsp</result>
> </action>
...
Application context:
...
<bean id="customerAction" class="com.demo.CustomerAction">
<property name="DispatcherService" ref="DispatcherService"/>
</bean
I recommend making your bean id's lower case and lower case properties in
the Action.
Private DispatcherService dispatcherService;
Then the property would be
<property name="dispatcherService" ref="dispatcherService"/>
Regards,
Randy Burgess
Sr. Web Applications Developer
Nuvox Communications
> From: Frank Fischer <frank.fischer@(protected)>
> Reply-To: Struts Users Mailing List <user@(protected)>
> Date: Mon, 17 Mar 2008 17:08:30 +0100
> To: 'Struts Users Mailing List' <user@(protected)>
> Subject: RE: How to initialize business service objects?
>
>
> Hi all
>
> first i'd like to thank all of you that have given me valuable feedback to
> my question.
>
> Following the answers from Dave and Jeromy i decided to go the "hard" way
> with Spring and DI. After reading some manuals (thanks to GF, good reading)
> i managed to load the Spring ContextLoaderListener and even define an POJO
> bean that serves as my BusinessLogicService. From the Tomcat logs i can see
> that an instance of that Service is created.
>
> As far as i read/unterstood, i now would only have to create a setter method
> on my Action class and Spring then would automatically inject the related
> dependcy to my Action class. So far, this doesn't seem to work, so i guess,
> i must be missing something.
>
> My applicationContext.xml looks quite simple (and seems to work, since the
> DispatcherService is created on startup):
>
> -----------
> <?xml version="1.0" encoding="UTF-8"?>
> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN"
> "http://www.springframework.org/dtd/spring-beans.dtd">
> <beans default-autowire="autodetect">
> <bean id="DispatcherService"
> class="com.demo.businesslogic.DispatcherService"/>
> </beans>
> -----------
>
> The Struts config looks like:
>
> -----------
> <?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="customerAgent" extends="struts-default">
>
> <action name="login" method="login" class="com.demo.CustomerAction">
> <result name="input">/CustomerLogin.jsp</result>
> <result name="success">/CustomerChat.jsp</result>
> </action>
>
> <action name="logout" method="logout"
> class="com.demo.CustomerAction">
> <result name="success">/CustomerLogin.jsp</result>
> <result name="input">/CustomerLogin.jsp</result>
> </action>
>
> <action name="chat" method="chat" class="com.demo.CustomerAction">
> <result name="success">/CustomerChat.jsp</result>
> </action>
>
>
> </package>
>
> </struts>
> -----------
>
> So i guess, i must be missing something. Is there a way i would have to tell
> Spring which Action classes to inject?
>
> Thanks a lot for your help
> Frank
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
This email and any attachments ("Message") may contain legally privileged and/or confidential information. If you are not the addressee, or if this Message has been addressed to you in error, you are not authorized to read, copy, or distribute it, and we ask that you please delete it (including all copies) and notify the sender by return email. Delivery of this Message to any person other than the intended recipient(s) shall not be deemed a waiver of confidentiality and/or a privilege.

Attachment:
user_184353.ezm (zipped)Frank,
AFAIU, you want your Business Service Object to be injected in your Struts2
actions. To achieve that, I have done this:
- Using Spring ObjectFactory.
- Declare Business Service Object (BSO) in Spring's
applicationContext.xml(you've already done that)
- Define action that has setter method for your BSO.
- Declare this action as a <bean> in applicationContext.xml, with BSO
injected as dependency.
Sample Code:
Action:
public class SetEndPoint extends ActionSupport {
private DispatcherService dispatcherService;
public String execute () throws Exception {
//-----your business logic-----
return SUCCESS;
}
// DispatcherService object will be set (i.e. injected) by Spring (see
applicationContext.xml)
*public void setDispatcherService(DispatcherService dispatcherService)*{
this.dispatcherService = dispatcherService;
}
}
applicationContext.xml
<!-- ..... your existing bean declaration for DispatcherService
remains .... ->
<!-- ..... Declare action here, injecting DispatcherService .... ->
<bean id="setEndPoint" class="example.client.web.action.SetEndPoint">
*<property name="dispatcherService">*
<ref bean="DispatcherService"/>
</property>
</bean>
struts.xml
<struts>
*<constant name="struts.objectFactory" value="spring" />*
<package name="no.bbs" extends="struts-default">
<action name="setEndPoint" method="execute" *class="setEndPoint"* >
<result name="consumeA">/view/consumeAcos.jsp</result>
<result name="consumeB">/view/consumeMapp.jsp</result>
<result name="error">/view/error.jsp</result>
</action>
</package>
</struts>
I have underlined important parts of each artifact..
I hope this helps..
-Rushikesh
On Mon, Mar 17, 2008 at 5:28 PM, Piero Sartini <lists@(protected)>
wrote:
> Am Donnerstag, 13. März 2008 22:32:34 schrieb Frank Fischer:
> > Now i don't understand (1) where to create/initialize these business
> logic
> > classes and (2) how to get access to them from the action classes.
>
> Just build your business logic without thinking about s2 too much. From
> your
> action classes you can access your business logic like everything else.
> Its
> really more of a java problem how to do this =)
>
> If you have to run initialization code at startup, maybe a normal Listener
> is
> what you are looking for...
>
> Piero
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184355.ezm (zipped)--- Randy Burgess <RBurgess@(protected):
> You also need to setup your action in the application context so that
> Spring knows where to inject the business object.
You *can* do it that way, but the default setup doesn't require it. It
depends on how you're wiring, whether or not your philosophically opposed to
magic, and so on.
Dave

Attachment:
user_184358.ezm (zipped)Hi Michael
Thanks for your answer.
> 1) You have included the struts2-spring-pliugin.jar in your classpath
Yes, it put it under "WEB-INF/lib/" so it's packaged to the war file and
should be available to tomcat it think. I also can't see any error or
warning messages while deploying the application, so i guess the package can
be resolved.
> 2) Your applicationContext.xml file is getting loaded on startup. If
> you haven't already done so, check your web.xml for a context
> parameter
> like this:
> <context-param>
> <param-name>contextConfigLocation</param-name>
>
> <param-value>classpath*:applicationContext*.xml</param-value>
> </context-param>
I did not include that line because i read, that this is the default setting
Spring uses when no contextConfigLocation parameter is defined. I just added
it but it didn't change anything as far as i see.
Thanks again for your help.
Frank

Attachment:
user_184359.ezm (zipped)--- Frank Fischer <frank.fischer@(protected):
> <beans default-autowire="autodetect">
Off the top of my head I don't recall what "autodetect" means.
Did you try leaving out the "default-autowire" attribute or switching it to
the default ("name" or something like that; I don't recall) and seeing if
that works?
That would at least help determine if everything is getting
deployed/initialized correctly.
Dave

Attachment:
user_184360.ezm (zipped)Frank,
I would check your struts.properties file:
Make sure it has these entries and that it is on your classpath (i.e. in
WEB-INF/classes)
struts.objectFactory = spring
struts.objectFactory.spring.autoWire = name
MG
-----Original Message-----
From: Frank Fischer [mailto:frank.fischer@(protected)]
Sent: Monday, March 17, 2008 1:35 PM
To: 'Struts Users Mailing List'
Subject: RE: How to initialize business service objects?
Hi Michael
Thanks for your answer.
> 1) You have included the struts2-spring-pliugin.jar in your classpath
Yes, it put it under "WEB-INF/lib/" so it's packaged to the war file and
should be available to tomcat it think. I also can't see any error or
warning messages while deploying the application, so i guess the package
can
be resolved.
> 2) Your applicationContext.xml file is getting loaded on startup. If
> you haven't already done so, check your web.xml for a context
> parameter
> like this:
> <context-param>
> <param-name>contextConfigLocation</param-name>
>
> <param-value>classpath*:applicationContext*.xml</param-value>
> </context-param>
I did not include that line because i read, that this is the default
setting
Spring uses when no contextConfigLocation parameter is defined. I just
added
it but it didn't change anything as far as i see.
Thanks again for your help.
Frank
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)

Attachment:
user_184356.ezm (zipped)Hi,
Is there anyway to use the JSP 2.0 tag files and the Struts 2.0 tags together.
I have created a JSP 2.0 .tag file. Inside that file, I want to access the attributes passed from the main jsp. I want to access the attributes using the Struts 2.0 tags. Is there any way to do it?
I am using Struts 2.0.11.
Any help appreciated.
Thanks,
-Kal
---------------------------------
Looking for last minute shopping deals? Find them fast with Yahoo! Search.

Attachment:
user_184357.ezm (zipped)Kalpesh Modi wrote:
> Is there anyway to use the JSP 2.0 tag files and the Struts 2.0 tags together.
Yes, all you have to do is add the taglib at the top of your .tag file
so that you can refer to the s: tags. The difficulty comes in passing
arguments. At first I was only able to successfully pass the top of the
VS, but that's brittle (and only really supports 1 argument well), so
I've changed over to passing objects as tag attributes. In order to do
this you must pass using EL, not OGNL.
I found that arguments from one .tag file to another didn't work
correctly in tomcat6. (But it does in tomcat5.5 and in glassfish.)
-Dale

Attachment:
user_184361.ezm (zipped)Hi,
I am using fileuploadinterceptor which is part defaultStack. I upload an image *.jpg using IE and Firefox and get a different contentType in action for different browser.
IE returns content type as image/pjpeg whereas Firefox returns content type as image/jpeg.
Similary for a *.png image uploading using IE and Firefox returns different content types. IE returns content type as image/x-png whereas Firefox returns image/png.
What can I do to resolve this conflict and not get different content types? Is there other property which can be accessed regarding the image types (like mime type)?
Anyone else came across such a use case?
Thanks.
---------------------------------
Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now.

Attachment:
user_184362.ezm (zipped)--- akash agrawal <akash_agrawal@(protected):
> What can I do to resolve this conflict and not get different content types?
Only use one browser?
Can't you just do some processing/aggregation of content types on the server
side?
Dave

Attachment:
user_184363.ezm (zipped)Thanks for the reply Dave.
I have to support both IE and Firefox so can't use just one browser.
Yes, I can do some processing on the server side and handle image/pjpeg and image/jpeg as same and image/x-png and image/png as same but would prefer not to as decoding these images requires different decoders and may get into some trouble down the road.
I was wondering if this is an issue of combination of browser and struts framework and if there is access to more properties which can give more information about the uploaded images.
Thanks.
Dave Newton <newton.dave@(protected):
> What can I do to resolve this conflict and not get different content types?
Only use one browser?
Can't you just do some processing/aggregation of content types on the server
side?
Dave
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@(protected)
For additional commands, e-mail: user-help@(protected)
---------------------------------
Never miss a thing. Make Yahoo your homepage.

Attachment:
user_184364.ezm (zipped)--- akash agrawal <akash_agrawal@(protected):
> I have to support both IE and Firefox so can't use just one browser.
I was kidding.
> Yes, I can do some processing on the server side and handle image/pjpeg and
> image/jpeg as same and image/x-png and image/png as same but would prefer
> not to as decoding these images requires different decoders and may get
> into some trouble down the road.
I don't know what you're doing with the files that they need decoding anyway,
but it probably doesn't matter. If you're that concerned then you'll probably
need to sniff the file yourself to determine the content type. Searching the
web may give you some leads on what libraries are available.
I don't know of a way to control what the browser sends as an upload content
type; each browser sniffs the files differently, but someone else may have
some ideas.
Dave

Attachment:
user_184365.ezm (zipped)Hello,
I started struts by learning struts2. However, now i am working with
struts 1: (
I am faced with a problem where user downloads a file.
I have this in the struts.xml
<action path="/viewModificationDocument"
type="org.something1.something2.actions.download.ModificationDocumentDownloadAction"
scope="request" input="viewAwardModification">
</action>
And then in the action I have this which is returning a bytestream
protected class ByteArrayStreamInfo implements StreamInfo {
protected String contentType;
protected byte[] bytes;
public ByteArrayStreamInfo(String contentType, byte[] bytes) {
this.contentType = contentType;
this.bytes = bytes;
}
public String getContentType() {
return contentType;
}
public InputStream getInputStream() throws IOException {
return new ByteArrayInputStream(bytes);
}
}
But when user clicks a link is sees a open close cancel dialog
box...he just sees <actionname>.do as file name. I know I am not
returning the file name (I can) but where will I catch it?? like in
struts 2...shouldnt tehre be more in the action of this? like
specifying what is returned? and if i return the name.....should I
just make public String getFileName() method in ByteArrayStreamInfo
class?
Thanks!

Attachment:
user_184366.ezm (zipped)Does this help?
http://wiki.apache.org/struts/StrutsFileDownload
Dave
--- bhaarat Sharma <bhaarat.s@(protected):
> Hello,
>
> I started struts by learning struts2. However, now i am working with
> struts 1: (
>
> I am faced with a problem where user downloads a file.
>
> I have this in the struts.xml
>
> <action path="/viewModificationDocument"
>
>
type="org.something1.something2.actions.download.ModificationDocumentDownloadAction"
> scope="request" input="viewAwardModification">
> </action>
>
> And then in the action I have this which is returning a bytestream
>
> protected class ByteArrayStreamInfo implements StreamInfo {
>
> protected String contentType;
>
> protected byte[] bytes;
>
> public ByteArrayStreamInfo(String contentType, byte[] bytes) {
> this.contentType = contentType;
> this.bytes = bytes;
> }
>
> public String getContentType() {
> return contentType;
> }
>
> public InputStream getInputStream() throws IOException {
> return new ByteArrayInputStream(bytes);
> }
>
> }
>
> But when user clicks a link is sees a open close cancel dialog
> box...he just sees <actionname>.do as file name. I know I am not
> returning the file name (I can) but where will I catch it?? like in
> struts 2...shouldnt tehre be more in the action of this? like
> specifying what is returned? and if i return the name.....should I
> just make public String getFileName() method in ByteArrayStreamInfo
> class?
>
> Thanks!
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184367.ezm (zipped)yes, that worked!
Thanks! I remember you helped me with similar problem in S2 as well
On Mon, Mar 17, 2008 at 10:07 PM, Dave Newton <newton.dave@(protected):
> Does this help?
>
> http://wiki.apache.org/struts/StrutsFileDownload
>
> Dave
>
>
>
> --- bhaarat Sharma <bhaarat.s@(protected):
>
> > Hello,
> >
> > I started struts by learning struts2. However, now i am working with
> > struts 1: (
> >
> > I am faced with a problem where user downloads a file.
> >
> > I have this in the struts.xml
> >
> > <action path="/viewModificationDocument"
> >
> >
> type="org.something1.something2.actions.download.ModificationDocumentDownloadAction"
> > scope="request" input="viewAwardModification">
> > </action>
> >
> > And then in the action I have this which is returning a bytestream
> >
> > protected class ByteArrayStreamInfo implements StreamInfo {
> >
> > protected String contentType;
> >
> > protected byte[] bytes;
> >
> > public ByteArrayStreamInfo(String contentType, byte[] bytes) {
> > this.contentType = contentType;
> > this.bytes = bytes;
> > }
> >
> > public String getContentType() {
> > return contentType;
> > }
> >
> > public InputStream getInputStream() throws IOException {
> > return new ByteArrayInputStream(bytes);
> > }
> >
> > }
> >
> > But when user clicks a link is sees a open close cancel dialog
> > box...he just sees <actionname>.do as file name. I know I am not
> > returning the file name (I can) but where will I catch it?? like in
> > struts 2...shouldnt tehre be more in the action of this? like
> > specifying what is returned? and if i return the name.....should I
> > just make public String getFileName() method in ByteArrayStreamInfo
> > class?
> >
> > Thanks!
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: user-unsubscribe@(protected)
> > For additional commands, e-mail: user-help@(protected)
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184368.ezm (zipped)--- bhaarat Sharma <bhaarat.s@(protected):
> Thanks! I remember you helped me with similar problem in S2 as well
I'm very good at using the work of others to make me look good ;)
Dave

Attachment:
user_184369.ezm (zipped)Quick question
in all other examples on that page they show how the fileName is
retrieved. But for Byte Array Example they do not mention anything
regarding the fileName.
How are we suppose to supply the fileName?
On Mon, Mar 17, 2008 at 10:41 PM, Dave Newton <newton.dave@(protected):
> --- bhaarat Sharma <bhaarat.s@(protected):
>
> > Thanks! I remember you helped me with similar problem in S2 as well
>
> I'm very good at using the work of others to make me look good ;)
>
> Dave
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>

Attachment:
user_184370.ezm (zipped) HI,
I am using struts 1.2 in my web application. I have to display one
<html:select>.... <html:options> list
list will be build dynamically. User can select any option. base on the
user's selection page will be refreshed (need to hit the database and
display information in other fields on same page.) I need to know two
things:
1) there is one submit button on that page and one action is associated with
that submit button. i can call the associated action class once the user
finish the form and click the submit button. When user select from list i
need to call another action class.
I want to know how to call another action class, (when user select something
from list), as list control is inside the same html:form tag.
2) When user selects some value from list i need to refresh the page and
populate the other fields.
I would like to know, Lets say there are ten values and user has selected
third option, how to keep selected that third option as page is already
refreshed?
I am beginner in struts.. any sample code would be a great help for me
Thank you for time and help.
sonu

Attachment:
user_184372.ezm (zipped)You can simply call a struts action through AJAX. A little bit of AJAX can
help to do your task. If you know AJAX, you can call struts action while
sending request as req.open("GET", someaction.do, true);
On Tue, Mar 18, 2008 at 9:20 AM, Sonu S <sonu.in@(protected):
> HI,
>
> I am using struts 1.2 in my web application. I have to display one
> <html:select>.... <html:options> list
>
> list will be build dynamically. User can select any option. base on the
> user's selection page will be refreshed (need to hit the database and
> display information in other fields on same page.) I need to know two
> things:
>
> 1) there is one submit button on that page and one action is associated
> with
> that submit button. i can call the associated action class once the user
> finish the form and click the submit button. When user select from list i
> need to call another action class.
>
> I want to know how to call another action class, (when user select
> something
> from list), as list control is inside the same html:form tag.
>
> 2) When user selects some value from list i need to refresh the page and
> populate the other fields.
>
> I would like to know, Lets say there are ten values and user has selected
> third option, how to keep selected that third option as page is already
> refreshed?
>
> I am beginner in struts.. any sample code would be a great help for me
>
> Thank you for time and help.
>
> sonu
>

Attachment:
user_184371.ezm (zipped)
Dude I dont think autocomplete would be complete till you actually try to
complete it.
Now we are thinking!!!!!!!!!!!!!
Ankur Agar wrote:
>
>
> Hi All,
> I am tryin to make an autocomplete work with its theme="ajax"
> I am using struts 2.0.x
> The data coming from the action is in JSON format
>
> {"Arizona":"AZ","Arkansas":"AR","Armed":"AE","California":"CA","Florida":"FL"}
> the jsp code is
> <%@(protected)" %>
> <html>
> <head>
> <s:head theme="ajax" debug="true"/>
> </head>
> <s:property value="jsonList"/>
> <body>
> <s:url id="ajaxCallUrl" value="autocompleter1.action">
> </s:url>
> <h1>Struts 2 Autocompleter Example!</h1>
> <s:label name="stateName" value="Select State Name:" />
> <br>
> <s:autocompleter name="state" theme="ajax" href="%{ajaxCallUrl}"
> loadOnTextChange="true" loadMinimumCount="1"/>
> <br>
> </body>
> </html>
>
> But still the autocomplete is not working gives a syntax error on page
> when
> run in debug mode. In one of the links I found that struts-dojo-tags has
> to
> be used as a plugin in struts 2.0.x But also in one of the links it was
> specified that its embedded in struts-core.jar.
> Please help me out.
> Regards,
> Ankur
>
> =====-----=====-----=====
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@(protected)
> For additional commands, e-mail: user-help@(protected)
>
>
>
--
Sent from the Struts - User mailing list archive at Nabble.com.